Java Utililty Methods Matrix Max Value

List of utility methods to do Matrix Max Value

Description

The list of methods to do Matrix Max Value are organized into topic(s).

Method

doublemax(double[][] x)
max
double v = 0;
for (int i = 0; i < x.length; i++) {
    for (int j = 0; j < x[0].length; j++) {
        if (x[i][j] > v) {
            v = x[i][j];
return v;
floatmax(float a[][][])
Find maximum value in a 3D matrix
float max = a[0][0][0];
for (int i = 0; i < a.length; i++)
    for (int j = 0; j < a[i].length; j++)
        for (int k = 0; k < a[i][j].length; k++)
            max = (a[i][j][k] > max ? a[i][j][k] : max);
return max;
floatmax(float[][] a)
Gets the max value of a real array.
checkDimension(a);
int M = a.length;
int N = a[0].length;
float max = a[0][0];
for (int i = 0; i < M; i++) {
    for (int j = 0; j < N; j++) {
        max = Math.max(max, a[i][j]);
return max;
voidmax(float[][] originalValues, float[][] newValues, int[] indexArray, float value)
Copy the values in originalValues[indexArray] that are greater than the given value to newValues
for (int j = 0; j < indexArray.length; j++) {
    if (originalValues[0][indexArray[j]] > value) {
        newValues[0][indexArray[j]] = value;
doublemax_abs(double[][] matrix)
Returns the absolute maximum of the elements in the two dimensional array matrix.
int i, j;
boolean set = false;
double max = 0;
for (i = 0; i < matrix.length; i++) {
    for (j = 0; j < matrix[i].length; j++) {
        if (!set) {
            max = Math.abs(matrix[i][j]);
            set = true;
...
double[]maxDifffer(double[][] pos)
Returns max diff.
double[] min = new double[3]; 
double[] max = new double[3]; 
int i, j;
for (j = 0; j < 3; j++) {
    min[j] = pos[0][j]; 
    max[j] = pos[0][j]; 
    for (i = 1; i < 4; i++) {
        max[j] = Math.max(pos[i][j], max[j]);
...
doublemaxDistance(double[][] _values)

Computes the maximun distance between vectors in a double[][]

double toRet = 0;
double distancia;
int numDatos = _values.length;
for (int i = 0; i < numDatos; ++i) {
    for (int j = i + 1; j < numDatos; ++j) {
        distancia = euclidean(_values[i], _values[j]);
        toRet = (distancia > toRet) ? distancia : toRet;
return toRet;
int[]maxIndices(double M[][])
returns argmax_{j,k} M[j][k]
double max = Double.MIN_VALUE;
int i_max = -1;
int j_max = -1;
for (int i = 0; i < M.length; i++) {
    for (int j = 0; j < M[i].length; j++) {
        if (M[i][j] > max) {
            max = M[i][j];
            i_max = i;
...
intmaxInRowIndex(double[][] M, int row)
Returns the row index of the maximal element in the given row of the given matrix.
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;
...
int[][]maxtrixPermutation(int beforeArray[][])
maxtrix Permutation
int newArray[][] = new int[beforeArray[0].length][beforeArray.length];
for (int i = 0; i < newArray.length; i++) {
    for (int j = 0; j < newArray[i].length; j++) {
        newArray[i][j] = beforeArray[j][i];
return newArray;