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

int org::jblas::la::FloatMatrix::argmax (  )  [inline]

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

Definition at line 1706 of file FloatMatrix.java.

References isEmpty().

Referenced by columnArgmaxs(), and rowArgmaxs().

                        {
        if (isEmpty()) {
            return -1;
        }
        float v = Float.NEGATIVE_INFINITY;
        int a = -1;
        for (int i = 0; i < length; i++) {
            if (!Float.isNaN(get(i)) && get(i) > v) {
                v = get(i);
                a = i;
            }
        }

        return a;
    }


Generated by  Doxygen 1.6.0   Back to index