Java Matrix matrixIsWellformed(int numLabels, int[][] matrix)

Here you can find the source of matrixIsWellformed(int numLabels, int[][] matrix)

Description

matrix Is Wellformed

License

Apache License

Declaration

public static boolean matrixIsWellformed(int numLabels, int[][] matrix) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static boolean matrixIsWellformed(int numLabels, int[][] matrix) {
        boolean isWellformed = true;
        if (matrix.length != numLabels) {
            isWellformed = false;//  w w  w  .j  av  a 2s .c o m
        }
        for (int[] gold : matrix) {
            if (gold.length != numLabels) {
                isWellformed = false;
            }
            for (int pred : gold) {
                if (pred < 0) {
                    isWellformed = false;
                }
            }
        }
        return isWellformed;
    }
}

Related

  1. matrixConcatLR(double[][] LMatrix, double[][] RMatrix)
  2. matrixConcatUL(double[][] UMatrix, double[][] LMatrix)
  3. matrixDestructAdd(double[][] m1, double[][] m2)
  4. matrixDeterminant(final float[] m, final int m_offset)
  5. matrixEquals(int[][] firstMatrix, int[][] secondMatrix)
  6. matrixKLDivergence(double m1[][], double m2[][])
  7. matrixModule(double[][] matrix, int module)
  8. matrixTimesVector(double[][] matrix, double[] vector)