Package mikera.matrixx.impl

Examples of mikera.matrixx.impl.DiagonalMatrix


    assertEquals(m.getBand(0),m.getBandWrapped(0));
    assertEquals(Vector.of(1,5,6),m.getBandWrapped(-2));
  }
 
  @Test public void testDiagonalMatrix() {
    DiagonalMatrix m=DiagonalMatrix.create(Vector.of(0,1,2));
   
    assertEquals(0,m.upperBandwidth());
    assertEquals(0,m.upperBandwidthLimit());
    assertEquals(0,m.lowerBandwidth());
    assertEquals(0,m.lowerBandwidthLimit());
  }
View Full Code Here


    assertTrue(mlt.isLowerTriangular());
  }

  @Test
  public void testDiagonalMatrix() {
    DiagonalMatrix d = DiagonalMatrix.create(1, 2);
    Matrix22 m = new Matrix22(1, 2, 3, 4);

    assertEquals(new Matrix22(1, 2, 6, 8), d.compose(m));
    assertEquals(new Matrix22(1, 4, 3, 8), m.compose(d));
  }
View Full Code Here

    assertTrue(m.isIdentity());
  }

  @Test
  public void testJoin() {
    DiagonalMatrix d1 = DiagonalMatrix.create(1, 2);
    DiagonalMatrix d2 = DiagonalMatrix.create(3, 4);
    assertEquals(Vector.of(0, 2, 0, 4), d1.join(d2, 1).slice(1));
  }
View Full Code Here

//        System.out.println("Vector total steps = "+svd.totalSteps);

        Matrix Ut = Matrix.create(svd.getUt());
        Matrix Vt = Matrix.create(svd.getVt());
        DiagonalMatrix W = DiagonalMatrix.create(svd.diag);
//
//            Ut.mult(W).mult(V).print();
        Matrix A_found = Multiplications.multiply(Multiplications.multiply(Ut.getTranspose(), W), Vt);
//            A_found.print();
View Full Code Here

    return ZeroMatrix.create(rows, columns);
  }

  public static ADiagonalMatrix createScaleMatrix(int dimensions,
      double factor) {
    DiagonalMatrix im = new DiagonalMatrix(dimensions);
    for (int i = 0; i < dimensions; i++) {
      im.unsafeSet(i, i, factor);
    }
    return im;
  }
View Full Code Here

  /**
   * Creates a diagonal scaling matrix with the given scale factors for each dimension
   */
  public static DiagonalMatrix createScaleMatrix(double... scalingFactors) {
    int dimensions = scalingFactors.length;
    DiagonalMatrix im = new DiagonalMatrix(dimensions);
    for (int i = 0; i < dimensions; i++) {
      im.unsafeSet(i, i, scalingFactors[i]);
    }
    return im;
  }
View Full Code Here

  /**
   * Creates a diagonal matrix, using the given diagonal values. Performs a defensive copy of the data.
   */
  public static DiagonalMatrix createDiagonalMatrix(double... diagonalValues) {
    int dimensions = diagonalValues.length;
    DiagonalMatrix im = new DiagonalMatrix(dimensions);
    im.getLeadingDiagonal().setElements(diagonalValues);
    return im;
  }
View Full Code Here

TOP

Related Classes of mikera.matrixx.impl.DiagonalMatrix

Copyright © 2018 www.massapicom. 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.