Package mikera.matrixx

Examples of mikera.matrixx.Matrix.rowCount()


    private Matrix createSymmetric(int len, double min, double max, Random rand) {
        Matrix A = Matrix.create(len, len);

        double range = max-min;

        int length = A.rowCount();

        for( int i = 0; i < length; i++ ) {
            for( int j = i; j < length; j++ ) {
                double val = rand.nextDouble()*range + min;
                A.set(i,j,val);
View Full Code Here


        assertTrue( !U.hasUncountable() );
        assertTrue( !Vt.hasUncountable() );
        assertTrue( !W.hasUncountable() );

        if( svd.isCompact() ) {
          assertTrue(W.columnCount()==W.rowCount());
          assertTrue(U.columnCount()==W.rowCount());
            assertTrue(Vt.rowCount()==W.columnCount());
        } else {
          assertTrue(U.columnCount()==W.rowCount());
          assertTrue(W.columnCount()==Vt.rowCount());
View Full Code Here

        assertTrue( !Vt.hasUncountable() );
        assertTrue( !W.hasUncountable() );

        if( svd.isCompact() ) {
          assertTrue(W.columnCount()==W.rowCount());
          assertTrue(U.columnCount()==W.rowCount());
            assertTrue(Vt.rowCount()==W.columnCount());
        } else {
          assertTrue(U.columnCount()==W.rowCount());
          assertTrue(W.columnCount()==Vt.rowCount());
          assertTrue(U.columnCount()==U.rowCount());
View Full Code Here

        if( svd.isCompact() ) {
          assertTrue(W.columnCount()==W.rowCount());
          assertTrue(U.columnCount()==W.rowCount());
            assertTrue(Vt.rowCount()==W.columnCount());
        } else {
          assertTrue(U.columnCount()==W.rowCount());
          assertTrue(W.columnCount()==Vt.rowCount());
          assertTrue(U.columnCount()==U.rowCount());
            assertTrue(Vt.columnCount()==Vt.rowCount());
        }
View Full Code Here

        int minStride = Math.min(height,width);

        Matrix Q = result.getQ().toMatrix();
        Matrix R = result.getR().toMatrix();
        assertTrue(Q.rowCount() == height && Q.columnCount() == height);
        assertTrue(R.rowCount() == (compact ? minStride : height));
        assertTrue(R.columnCount() == width);

        // see if Q has the expected properties
        assertTrue(Q.isOrthogonal(1e-8));
View Full Code Here

     * @param B A matrix that is n by m.  Not modified.
     * @param X An n by m matrix where the solution is writen to.  Modified.
     */
    public AMatrix solve(AMatrix B) {
      Matrix X = Matrix.create(B.rowCount(), B.columnCount());
        if( B.columnCount() != X.columnCount() && B.rowCount() != n && X.rowCount() != n) {
            throw new IllegalArgumentException("Unexpected matrix size");
        }

        int numCols = B.columnCount();

View Full Code Here

     *
     * @return inverse of matrix that was decomposed
     */
    public AMatrix invert() {
      Matrix inv = Matrix.create(numRows, numCols);
        if( inv.rowCount() != n || inv.columnCount() != n ) {
            throw new RuntimeException("Unexpected matrix dimension");
        }

        double a[] = inv.data;

View Full Code Here

     * @param B A matrix that is n by m.  Not modified.
     * @param X An n by m matrix where the solution is written to.  Modified.
     */
    public AMatrix solve(AMatrix B) {
      Matrix X = Matrix.create(B.rowCount(), B.columnCount());
        if( B.columnCount() != X.columnCount() && B.rowCount() != n && X.rowCount() != n) {
            throw new IllegalArgumentException("Unexpected matrix size");
        }

        int numCols = B.columnCount();

View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.