Java 类org.apache.commons.math3.linear.AbstractRealMatrix 实例源码

项目:clust4j    文件:ClustTests.java   
@Test
public void testCallerConstructor() {
    KMeans k = new KMeans(TestSuite.IRIS_DATASET.getData());
    AbstractRealMatrix ref = k.data;

    /*
     * Assert that this constructor retains the reference
     */
    AbstractClusterer a = new AbstractClusterer(k) {
        private static final long serialVersionUID = 1L;

        @Override public Algo getLoggerTag() { return null; }
        @Override public String getName() { return null; }
        @Override public boolean isValidMetric(GeometricallySeparable geo) { return false; }
        @Override public AbstractClusterer fit() { return null; }
        @Override protected ModelSummary modelSummary() { return null; }
        @Override protected Object[] getModelFitSummaryHeaders() { return null; }
    };

    assertTrue(ref == a.data);
}
项目:clust4j    文件:MatUtils.java   
final static public void checkDims(final AbstractRealMatrix a, final AbstractRealMatrix b) {
    checkDims(a);
    checkDims(b);

    int m1 = a.getRowDimension(), m2 = b.getRowDimension();
    int n1 = a.getColumnDimension(), n2 = b.getColumnDimension();

    if(m1 != m2) throw new DimensionMismatchException(m1, m2);
    if(n1 != n2) throw new DimensionMismatchException(n1, n2);
}
项目:clust4j    文件:Pairwise.java   
public static double[][] getDistance(AbstractRealMatrix a,
        GeometricallySeparable geo,
        boolean upperTriang, boolean partial) {
    return getDistance(a.getData(), geo, upperTriang, partial);
}
项目:clust4j    文件:Pairwise.java   
public static double[][] getSimilarity(AbstractRealMatrix a,
        GeometricallySeparable geo,
        boolean upperTriang, boolean partial) {
    return getSimilarity(a.getData(), geo, upperTriang, partial);
}
项目:clust4j    文件:MatUtils.java   
final static public void checkDims(final AbstractRealMatrix a) {
    int m = a.getRowDimension();
    if(m < MIN_ACCEPTABLE_MAT_LEN) throw new IllegalArgumentException(MAT_DIM_ERR_MSG + m);
    //if(n < MIN_ACCEPTABLE_MAT_LEN) throw new IllegalArgumentException(MAT_DIM_ERR_MSG + n);
}
项目:clust4j    文件:MatUtils.java   
/**
 * Returns a matrix of complete cases, or rows which do not
 * contain NaN values.
 * @param data
 * @throws IllegalArgumentException if there are no rows in the matrix
 * @return the complete cases in the matrix
 */
public static double[][] completeCases(final AbstractRealMatrix data) {
    return completeCases(data.getData());
}
项目:clust4j    文件:MatUtils.java   
/**
 * Returns true if there are any NaN values in the matrix.
 * @throws IllegalArgumentException if there are no rows in the data
 * @param mat
 * @return true if the matrix contains NaN
 */
public static boolean containsNaN(final AbstractRealMatrix mat) {
    return containsNaN(mat.getData());
}