예제 #1
0
 private DoubleMatrix SquaredDoubleMatrixFromDistanceMatrix() {
   int n = myDistanceMatrix.getSize();
   DoubleMatrix dm = DoubleMatrixFactory.DEFAULT.make(n, n);
   for (int r = 0; r < n; r++) {
     for (int c = 0; c < n; c++) {
       double val = myDistanceMatrix.getDistance(r, c);
       val *= val;
       dm.set(r, c, val);
     }
   }
   return dm;
 }
  @Override
  public DoubleMatrix getEigenvectors() {
    DoubleMatrix2D V = myDecomposition.getV();
    int nrows = V.rows();
    int ncols = V.columns();
    DoubleMatrix dm = DoubleMatrixFactory.DEFAULT.make(nrows, ncols);

    for (int r = 0; r < nrows; r++) {
      for (int c = 0; c < ncols; c++) {
        dm.set(r, c, V.getQuick(r, c));
      }
    }

    return dm;
  }
 @Override
 public DoubleMatrix getEigenvalueMatrix() {
   double[] eigenvalues = getEigenvalues();
   return DoubleMatrixFactory.DEFAULT.diagonal(eigenvalues);
 }