Package org.apache.mahout.math

Examples of org.apache.mahout.math.DenseMatrix.times()


      }
      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


      new double[]{0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000}};
    Matrix x = new DenseMatrix(m);
    EigenDecomposition eig = new EigenDecomposition(x, true);
    Matrix d = eig.getD();
    Matrix v = eig.getV();
    check("EigenvalueDecomposition (evil)...", x.times(v), v.times(d));
  }

  @Test
  public void testDeficientRank() {
    Matrix a = new DenseMatrix(10, 3).assign(new DoubleFunction() {
View Full Code Here

      }
    }
    EigenDecomposition eig = new EigenDecomposition(a);
    Matrix d = eig.getD();
    Matrix v = eig.getV();
    check("EigenvalueDecomposition (nonsymmetric)...", a.times(v), v.times(d));
  }

  @Test
  public void testSequential() {
    int validld = 3;
View Full Code Here

    }

    EigenDecomposition Eig = new EigenDecomposition(A);
    Matrix D = Eig.getD();
    Matrix V = Eig.getV();
    check("EigenvalueDecomposition (nonsymmetric)...", A.times(V), V.times(D));

    A = A.transpose().times(A);
    Eig = new EigenDecomposition(A);
    D = Eig.getD();
    V = Eig.getV();
View Full Code Here

    A = A.transpose().times(A);
    Eig = new EigenDecomposition(A);
    D = Eig.getD();
    V = Eig.getV();
    check("EigenvalueDecomposition (symmetric)...", A.times(V), V.times(D));

  }

  private static void check(String msg, Matrix a, Matrix b) {
    Assert.assertEquals(msg, 0, a.minus(b).aggregate(Functions.PLUS, Functions.ABS), 1.0e-10);
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

      }
      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

    A = A.transpose().times(A);
    Eig = new EigenDecomposition(A);
    D = Eig.getD();
    V = Eig.getV();
    check("EigenvalueDecomposition (symmetric)...", A.times(V), V.times(D));

  }

  private void check(String msg, Matrix a, Matrix b) {
    assertEquals(msg, 0, a.minus(b).aggregate(Functions.PLUS, Functions.ABS), 1e-10);
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

      new double[]{0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000}};
    Matrix x = new DenseMatrix(m);
    EigenDecomposition eig = new EigenDecomposition(x, true);
    Matrix d = eig.getD();
    Matrix v = eig.getV();
    check("EigenvalueDecomposition (evil)...", x.times(v), v.times(d));
  }

  @Test
  public void testDeficientRank() {
    Matrix a = new DenseMatrix(10, 3).assign(new DoubleFunction() {
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.