UMM-CSci-Systems / Threaded-minimum-pairwise-distance

Using threads to parallelize computing the shortest distance between any pair of values in an array
MIT License
0 stars 1 forks source link

Get rid of the weird inner classes thing? #2

Open NicMcPhee opened 7 years ago

NicMcPhee commented 7 years ago

The current setup suggests people create four separate inner classes, one for each triangle. Can't we have one inner class with arguments that indicate how the ranges should be handled, to avoid a lot of annoying duplication?

NicMcPhee commented 7 years ago

Looking back over it with the students today, it turns out that the problem is what I call the "center" triangle in the write-up. Because it "points" the opposite direction from the others, it ends up needing to be treated separately, which makes it more difficult to have a single Worker class.

It turns out, though, that if you "reflect" that triangle by swapping all the is and js you get the same set of differences in a triangle that "points" the same direction as the others and which can be handled uniformly.

I think the range we want there is N/2≤j<i+n/2<N. But I'm not entirely sure if we need to swap all the is for js in this range, and if we do then we would still need to treat that separately. Hmph. I need to do some more math.