Eliminate all the duplicate indexToLong methods
bdezonia opened this issue · 3 comments
All the tensor classes have their own cut and paste code for indexToLong() and longToIntegerIndex(). There should be one version that all these classes could reference. Note that there is also a version in the IndexUtils class. Maybe we can massage all this into one helper class somewhere.
It occurs to me that we could have one in IndexUtils and another (slightly different) one in a helper in the helpers directory. The one in the helpers directory would be the one that needs a another double array param and also it would be smart to pass it a Function1<Boolean,IntegerIndex> or Function1<Boolean,long[]> that can do the test for OOB.
"if oob.call(index)"
Move multidim/IndexUtils to misc/Indexutils and flesh it out more. Also instead of just indexToLong also implement longToIndex and longToInteger index. I think there are versions of these sprinkled throughout the code.
Done on master. Closing.