Conversation
similar behavior as in max/min functions in Matlab
|
Hi @malloc82 , very happy to consider this, though I think the implementation still needs a bit of work Specific comments:
|
|
Hi Mike,
public static final double elementMin(double[] data, int offset, int length, int step) {
double result = data[offset];
for (int i=1; i<length; i+=step) {
double v=data[offset+i];
if (v<result) result=v;
}
return result;
}in DoubleArray class. So basically passing a parameter to let i increment by step. This way it can be utilized in old code and as well as in those column max/min functions. For safety, we can just add them as new functions for now since there is an additional parameter, which do make it a new function. What do you think about this?
|
|
Well... in both I've debated this with various experts and the consensus we have come to is that this is better than the approach used in MATLAB (which basically treats everything as a matrix, so your only option is to use "row vectors" and "column vectors"). There is some documentation / discussion on the topic here: https://github.com/mikera/core.matrix/wiki/Vectors-vs.-matrices |
|
In theory I like the idea of an static |
|
@malloc82 Are you still working on this? Or should I close? |
|
Ah, sorry, for the delay. I'll try to push the change in the next week or so, been quite busy almost forgot about it. |
Added functions for Matrix class that has similar behavior as in Matlab's max/min when applied to matrices:
http://www.mathworks.com/help/matlab/ref/max.html