Package org.apache.mahout.math

Examples of org.apache.mahout.math.Matrix.transpose()


    // number is that squared.  This means that we don't get the exact answer with
    // a fast iterative solution.
    // Thus, we have to check the residuals rather than testing that the answer matched
    // the ideal.
    assertEquals(0, m.times(x1).minus(b).norm(2), 1.0e-2);
    assertEquals(0, m.transpose().times(m).times(x1).minus(m.transpose().times(b)).norm(2), 1.0e-7);

    // and we need to check that the error estimates are pretty good.
    assertEquals(m.times(x1).minus(b).norm(2), r.getResidualNorm(), 1.0e-5);
    assertEquals(m.transpose().times(m).times(x1).minus(m.transpose().times(b)).norm(2), r.getNormalEquationResidual(), 1.0e-9);
  }
View Full Code Here


    // number is that squared.  This means that we don't get the exact answer with
    // a fast iterative solution.
    // Thus, we have to check the residuals rather than testing that the answer matched
    // the ideal.
    assertEquals(0, m.times(x1).minus(b).norm(2), 1.0e-2);
    assertEquals(0, m.transpose().times(m).times(x1).minus(m.transpose().times(b)).norm(2), 1.0e-7);

    // and we need to check that the error estimates are pretty good.
    assertEquals(m.times(x1).minus(b).norm(2), r.getResidualNorm(), 1.0e-5);
    assertEquals(m.transpose().times(m).times(x1).minus(m.transpose().times(b)).norm(2), r.getNormalEquationResidual(), 1.0e-9);
  }
View Full Code Here

    assertEquals(0, m.times(x1).minus(b).norm(2), 1.0e-2);
    assertEquals(0, m.transpose().times(m).times(x1).minus(m.transpose().times(b)).norm(2), 1.0e-7);

    // and we need to check that the error estimates are pretty good.
    assertEquals(m.times(x1).minus(b).norm(2), r.getResidualNorm(), 1.0e-5);
    assertEquals(m.transpose().times(m).times(x1).minus(m.transpose().times(b)).norm(2), r.getNormalEquationResidual(), 1.0e-9);
  }
 
  private static Matrix hilbert(int n) {
    Matrix r = new DenseMatrix(n, n);
    for (int i = 0; i < n; i++) {
View Full Code Here

    assertEquals(0, m.times(x1).minus(b).norm(2), 1.0e-2);
    assertEquals(0, m.transpose().times(m).times(x1).minus(m.transpose().times(b)).norm(2), 1.0e-7);

    // and we need to check that the error estimates are pretty good.
    assertEquals(m.times(x1).minus(b).norm(2), r.getResidualNorm(), 1.0e-5);
    assertEquals(m.transpose().times(m).times(x1).minus(m.transpose().times(b)).norm(2), r.getNormalEquationResidual(), 1.0e-9);
  }
 
  private static Matrix hilbert(int n) {
    Matrix r = new DenseMatrix(n, n);
    for (int i = 0; i < n; i++) {
View Full Code Here

      }
      v.assign(Functions.MULT, 1/((row + 1) * v.norm(2)));
      matrix.assignRow(row, v);
    }
    if (symmetric) {
      return matrix.times(matrix.transpose());
    }
    return matrix;
  }

  public static Matrix randomHierarchicalSymmetricMatrix(int size) {
View Full Code Here

                                                      boolean isSymmetric,
                                                      String baseTmpDirSuffix) throws IOException {
    Path baseTmpDirPath = getTestTempDirPath(baseTmpDirSuffix);
    Matrix c = SolverTest.randomSequentialAccessSparseMatrix(numRows, nonNullRows, numCols, entriesPerRow, entryMean);
    if (isSymmetric) {
      c = c.times(c.transpose());
    }
    return saveToFs(c, baseTmpDirPath);
  }

  private static DistributedRowMatrix saveToFs(final Matrix m, Path baseTmpDirPath) throws IOException {
View Full Code Here

                                                      boolean isSymmetric,
                                                      String baseTmpDirSuffix) throws IOException {
    Path baseTmpDirPath = getTestTempDirPath(baseTmpDirSuffix);
    Matrix c = SolverTest.randomSequentialAccessSparseMatrix(numRows, nonNullRows, numCols, entriesPerRow, entryMean);
    if (isSymmetric) {
      c = c.times(c.transpose());
    }
    return saveToFs(c, baseTmpDirPath);
  }

  private DistributedRowMatrix saveToFs(final Matrix m, Path baseTmpDirPath) throws IOException {
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.