Logo Search packages:      
Sourcecode: jblas version File versions  Download package

int org::jblas::la::DoubleMatrix::argmin (  )  [inline]

Returns the linear index of the minimal element. If there are more than one elements with this value, the first one is returned.

Definition at line 1604 of file DoubleMatrix.java.

References isEmpty(), and length.

Referenced by columnArgmins(), and rowArgmins().

                        {
        if (isEmpty()) {
            return -1;
        }
        double v = Double.POSITIVE_INFINITY;
        int a = -1;
        for (int i = 0; i < length; i++) {
            if (!Double.isNaN(get(i)) && get(i) < v) {
                v = get(i);
                a = i;
            }
        }

        return a;
    }


Generated by  Doxygen 1.6.0   Back to index