Here you can find the source of minInRowIndex(double[][] M, int row)
Parameter | Description |
---|---|
M | matrix (2-dimensional array of type <code>double</code>). |
row | row index. |
public static int minInRowIndex(double[][] M, int row)
//package com.java2s; //License from project: Open Source License public class Main { /**/*from w w w . jav a 2s. c om*/ * Returns the row index of the minimal element in the given row of the given matrix. * @param M matrix (2-dimensional array of type <code>double</code>). * @param row row index. * @return index of the element in the row. */ public static int minInRowIndex(double[][] M, int row) { int idx = -1; if (M == null) return idx; int m = M.length; int n = M[0].length; if ((row < 0) || (row >= m)) return idx; idx = 0; for (int i = 1; i < n; i++) if (M[row][i] < M[row][idx]) idx = i; return idx; } }