Java Code Examples for org.ejml.factory.DecompositionFactory#eig()
The following examples show how to use
org.ejml.factory.DecompositionFactory#eig() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ArimaModel.java From java-timeseries with MIT License | 5 votes |
private static Complex64F[] findRoots(double... coefficients) { int N = coefficients.length - 1; // Construct the companion matrix. This is a square N x N matrix. final DenseMatrix64F c = new DenseMatrix64F(N, N); double a = coefficients[N]; for (int i = 0; i < N; i++) { c.set(i, N - 1, -coefficients[i] / a); } for (int i = 1; i < N; i++) { c.set(i, i - 1, 1); } // Use generalized eigenvalue decomposition to find the roots. EigenDecomposition<DenseMatrix64F> evd = DecompositionFactory.eig(N, false); evd.decompose(c); final Complex64F[] roots = new Complex64F[N]; for (int i = 0; i < N; i++) { roots[i] = evd.getEigenvalue(i); } return roots; }
Example 2
Source File: MultivariateElasticModel.java From beast-mcmc with GNU Lesser General Public License v2.1 | 5 votes |
@Override public EigenDecomposition decomposeStrenghtOfSelection(MatrixParameterInterface AParam, int dim, boolean isSymmetric) { DenseMatrix64F A = MissingOps.wrap(AParam); org.ejml.interfaces.decomposition.EigenDecomposition eigA = DecompositionFactory.eig(dim, true, isSymmetric); if (!eigA.decompose(A)) throw new RuntimeException("Eigen decomposition failed."); return new EigenDecomposition(eigenVectorsMatrix(eigA), null, eigenValuesMatrix(eigA, dim)); }
Example 3
Source File: CompoundEigenMatrixTest.java From beast-mcmc with GNU Lesser General Public License v2.1 | 5 votes |
private EigenDecomposition decomposeStrenghtOfSelection(double[] Aparam) { int n = getDimTrait(); DenseMatrix64F A = MissingOps.wrap(Aparam, 0, n, n); // Decomposition EigenDecomposition eigA = DecompositionFactory.eig(n, true, false); if (!eigA.decompose(A)) throw new RuntimeException("Eigen decomposition failed."); return eigA; }
Example 4
Source File: SafeMultivariateActualizedWithDriftIntegratorTest.java From beast-mcmc with GNU Lesser General Public License v2.1 | 5 votes |
private EigenDecomposition decomposeStrenghtOfSelection(double[] Aparam) { int n = getDimTrait(); DenseMatrix64F A = MissingOps.wrap(Aparam, 0, n, n); // Decomposition EigenDecomposition eigA = DecompositionFactory.eig(n, true, false); if (!eigA.decompose(A)) throw new RuntimeException("Eigen decomposition failed."); return eigA; }