本文整理了Java中Jama.Matrix.eig()
方法的一些代码示例,展示了Matrix.eig()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Matrix.eig()
方法的具体详情如下:
包路径:Jama.Matrix
类名称:Matrix
方法名:eig
暂无
代码示例来源:origin: marytts/marytts
EigenvalueDecomposition pc = covariance.eig();
if (debug) {
System.out.println("EigenValues (on the diagonal)");
代码示例来源:origin: marytts/marytts
EigenvalueDecomposition pc = covariance.eig();
if (debug) {
System.out.println("EigenValues (on the diagonal)");
代码示例来源:origin: lessthanoptimal/Java-Matrix-Benchmark
@Override
public long process(BenchmarkMatrix[] inputs, BenchmarkMatrix[] outputs, long numTrials) {
Matrix matA = inputs[0].getOriginal();
Matrix D = null;
Matrix V = null;
long prev = System.nanoTime();
for( long i = 0; i < numTrials; i++ ) {
EigenvalueDecomposition e = matA.eig();
D = e.getD();
V = e.getV();
}
long elapsed = System.nanoTime()-prev;
if( outputs != null ) {
outputs[0] = new JamaBenchmarkMatrix(D);
outputs[1] = new JamaBenchmarkMatrix(V);
}
return elapsed;
}
}
代码示例来源:origin: mkobos/pca_transform
public EVD(Matrix m){
EigenvalueDecomposition evd = m.eig();
double[] diagonal = getDiagonal(evd.getD());
PermutationResult result=
calculateNondecreasingPermutation(diagonal);
int[] permutation = result.permutation;
double[] newDiagonal = result.values;
this.v = permutateColumns(evd.getV(), permutation);
this.d = createDiagonalMatrix(newDiagonal);
assert eigenvaluesAreNonIncreasing(this.d);
}
代码示例来源:origin: openimaj/openimaj
final EigenvalueDecomposition ueig = U.eig();
uVal = ueig.getD();
uVec = ueig.getV();
代码示例来源:origin: openimaj/openimaj
final EigenvalueDecomposition rdr = secondMoments.times(divFactor).eig();
double d1, d2;
if (rdr.getD().get(0, 0) == 0)
代码示例来源:origin: openimaj/openimaj
@Override
protected void learnBasisNorm(Matrix m) {
Matrix covar = m.transpose().times(m);
EigenvalueDecomposition eig = covar.eig();
Matrix all_eigenvectors = eig.getV();
//note eigenvalues are in increasing order, so last vec is first pc
if (ndims > 0)
basis = all_eigenvectors.getMatrix(0, all_eigenvectors.getRowDimension()-1, Math.max(0, all_eigenvectors.getColumnDimension() - ndims), all_eigenvectors.getColumnDimension()-1);
else
basis = all_eigenvectors;
eigenvalues = eig.getRealEigenvalues();
double norm = 1.0 / (m.getRowDimension() - 1);
for (int i=0; i<eigenvalues.length; i++) eigenvalues[i] *= norm;
//swap evecs
MatrixUtils.reverseColumnsInplace(basis);
//swap evals
ArrayUtils.reverse(eigenvalues);
}
}
代码示例来源:origin: nz.ac.waikato.cms.moa/moa
EigenvalueDecomposition evd = matrix.eig();
double[] lambdasquare = evd.getRealEigenvalues();
Arrays.sort(lambdasquare);
代码示例来源:origin: openimaj/openimaj
/**
* Compute the principle square root, X, of the matrix A such that A=X*X
*
* @param matrix
* the matrix
* @return the sqrt of the matrix
*/
public static Matrix sqrt(Matrix matrix) {
// A = V*D*V'
final EigenvalueDecomposition evd = matrix.eig();
final Matrix v = evd.getV();
final Matrix d = evd.getD();
// sqrt of cells of D and store in-place
for (int r = 0; r < d.getRowDimension(); r++)
for (int c = 0; c < d.getColumnDimension(); c++)
d.set(r, c, Math.sqrt(d.get(r, c)));
// Y = V*D/V
// Y = V'.solve(V*D)'
final Matrix a = v.inverse();
final Matrix b = v.times(d).inverse();
return a.solve(b).inverse();
}
代码示例来源:origin: openimaj/openimaj
/**
* Compute the inverse square root, X, of the symmetric matrix A; A^-(1/2)
*
* @param matrix
* the symmetric matrix
* @return the inverse sqrt of the matrix
*/
public static Matrix invSqrtSym(Matrix matrix) {
// A = V*D*V'
final EigenvalueDecomposition evd = matrix.eig();
final Matrix v = evd.getV();
final Matrix d = evd.getD();
// sqrt of cells of D and store in-place
for (int r = 0; r < d.getRowDimension(); r++) {
for (int c = 0; c < d.getColumnDimension(); c++) {
if (d.get(r, c) > 0)
d.set(r, c, 1 / Math.sqrt(d.get(r, c)));
else
d.set(r, c, 0);
}
}
return v.times(d).times(v.transpose());
}
代码示例来源:origin: cdk/cdk
EigenvalueDecomposition ed = m.eig();
this.eval = ed.getRealEigenvalues();
this.evec = ed.getV();
代码示例来源:origin: org.openscience.cdk/cdk-qsarmolecular
EigenvalueDecomposition ed = m.eig();
this.eval = ed.getRealEigenvalues();
this.evec = ed.getV();
代码示例来源:origin: com.google.cloud.genomics/google-genomics-dataflow
EigenvalueDecomposition eig = matrix.eig();
Matrix eigenvectors = eig.getV();
double[] realEigenvalues = eig.getRealEigenvalues();
代码示例来源:origin: googlegenomics/dataflow-java
EigenvalueDecomposition eig = matrix.eig();
Matrix eigenvectors = eig.getV();
double[] realEigenvalues = eig.getRealEigenvalues();
代码示例来源:origin: openimaj/openimaj
final EigenvalueDecomposition e = m.eig();
return new EigenValueVectorPair(e.getD(), e.getV());
代码示例来源:origin: openimaj/openimaj
final EigenvalueDecomposition e = m.eig();
return new EigenValueVectorPair(e.getD(), e.getV());
final EigenvalueDecomposition e = m.eig();
return new EigenValueVectorPair(e.getD(), e.getV());
代码示例来源:origin: cdk/cdk
EigenvalueDecomposition eigenDecomp = tmp.eig();
double[] eval = eigenDecomp.getRealEigenvalues();
代码示例来源:origin: org.openscience.cdk/cdk-qsarmolecular
EigenvalueDecomposition eigenDecomp = tmp.eig();
double[] eval = eigenDecomp.getRealEigenvalues();
代码示例来源:origin: org.openimaj/sandbox
final EigenvalueDecomposition eigs = Lsym.eig();
代码示例来源:origin: openimaj/openimaj
final EigenvalueDecomposition eigs = Lsym.eig();
内容来源于网络,如有侵权,请联系作者删除!