Package no.uib.cipr.matrix.sparse

Examples of no.uib.cipr.matrix.sparse.CompRowMatrix$CompRowMatrixEntry


    @Override
    void testFactorization(Matrix A, Vector x) {
        Vector b = A.mult(x, x.copy());

        ICC icc = new ICC(new CompRowMatrix(A));
        icc.setMatrix(A);
        icc.apply(b, x);

        Vector r = A.multAdd(-1, x, b.copy());
View Full Code Here


    MatrixTestAbstract.assertEquals(mat, newMat);
  }
 
  public void testSparseWriteRead() throws Exception {
    CompRowMatrix mat = new CompRowMatrix(3, 3, new int[][] {
        { 1, 2 },
        { 0, 2 },
        { 1 }
    });
    mat.set(0, 1, 1);
    mat.set(0, 2, 2);
    mat.set(1, 0, 3);
    mat.set(1, 2, 4);
    mat.set(2, 1, 5);
    File testFile = new File("TestMatrixFile");
      testFile.deleteOnExit();
    BufferedWriter out = new BufferedWriter(new FileWriter(testFile));
    MatrixVectorWriter writer = new MatrixVectorWriter(out);
    MatrixInfo mi = new MatrixInfo(true, MatrixInfo.MatrixField.Real, MatrixInfo.MatrixSymmetry.General);
    writer.printMatrixInfo(mi);
    writer.printMatrixSize(new MatrixSize(mat.numColumns(), mat.numColumns(), mat.getData().length), mi);
    int[] rows = buildRowArray(mat);
    writer.printCoordinate(rows, mat.getColumnIndices(), mat.getData(), 1);
    out.close();
    CompRowMatrix newMat = new CompRowMatrix(new MatrixVectorReader(new FileReader(testFile)));
    MatrixTestAbstract.assertEquals(mat, newMat);
  }
View Full Code Here

  });
  int[] piv = new int[]{2, 3, 3};

  public void testMultiply() {
    Matrix p = PermutationMatrix.fromPartialPivots(piv);
    Matrix c = p.mult(m, new CompRowMatrix(new DenseMatrix(m.numRows(), m.numColumns())));
    MatrixTestAbstract.assertEquals(e, c);
  }
View Full Code Here

    MatrixTestAbstract.assertEquals(e, c);
  }

  public void testMultiplyTrans() {
    Matrix p = PermutationMatrix.fromPartialPivots(piv);
    Matrix c = p.transAmult(m, new CompRowMatrix(new DenseMatrix(m.numRows(), m.numColumns())));
    MatrixTestAbstract.assertEquals(eI, c);
  }
View Full Code Here

    MatrixTestAbstract.assertEquals(eI, c);
  }

  public void testMultiplyCompRow() {
    Matrix p = PermutationMatrix.fromPartialPivots(piv);
    Matrix c = p.mult(new CompRowMatrix(m), new CompRowMatrix(new DenseMatrix(m.numRows(), m.numColumns())));
    MatrixTestAbstract.assertEquals(e, c);
  }
View Full Code Here

    MatrixTestAbstract.assertEquals(e, c);
  }

  public void testMultiplyTransCompRow() {
    Matrix p = PermutationMatrix.fromPartialPivots(piv);
    Matrix c = p.transAmult(new CompRowMatrix(m), new CompRowMatrix(new DenseMatrix(m.numRows(), m.numColumns())));
    MatrixTestAbstract.assertEquals(eI, c);
  }
View Full Code Here

    @Override
    protected void createSolver() throws Exception {
        super.createSolver();
        double omega = Math.random() + 1;
        M = new SSOR(new CompRowMatrix(A), true, omega, omega);
    }
View Full Code Here

    @Override
    void testFactorization(Matrix A, Vector x) {
        Vector b = A.mult(x, x.copy());

        ILU ilu = new ILU(new CompRowMatrix(A));
        ilu.setMatrix(A);
        ilu.apply(b, x);

        Vector r = A.multAdd(-1, x, b.copy());
View Full Code Here

TOP

Related Classes of no.uib.cipr.matrix.sparse.CompRowMatrix$CompRowMatrixEntry

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.