mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Allow user to compute only the eigenvalues and not the eigenvectors.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
MatrixXcf ones = MatrixXcf::Ones(3,3);
|
||||
ComplexEigenSolver<MatrixXcf> ces(ones);
|
||||
ComplexEigenSolver<MatrixXcf> ces(ones, /* computeEigenvectors = */ false);
|
||||
cout << "The eigenvalues of the 3x3 matrix of ones are:"
|
||||
<< endl << ces.eigenvalues() << endl;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
EigenSolver<MatrixXf> es;
|
||||
MatrixXf A = MatrixXf::Random(4,4);
|
||||
es.compute(A);
|
||||
es.compute(A, /* computeEigenvectors = */ false);
|
||||
cout << "The eigenvalues of A are: " << es.eigenvalues().transpose() << endl;
|
||||
es.compute(A + MatrixXf::Identity(4,4)); // re-use es to compute eigenvalues of A+I
|
||||
es.compute(A + MatrixXf::Identity(4,4), false); // re-use es to compute eigenvalues of A+I
|
||||
cout << "The eigenvalues of A+I are: " << es.eigenvalues().transpose() << endl;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
MatrixXd ones = MatrixXd::Ones(3,3);
|
||||
EigenSolver<MatrixXd> es(ones);
|
||||
EigenSolver<MatrixXd> es(ones, false);
|
||||
cout << "The eigenvalues of the 3x3 matrix of ones are:"
|
||||
<< endl << es.eigenvalues() << endl;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
MatrixXf A = MatrixXf::Random(4,4);
|
||||
RealSchur<MatrixXf> schur(4);
|
||||
schur.compute(A);
|
||||
schur.compute(A, /* computeU = */ false);
|
||||
cout << "The matrix T in the decomposition of A is:" << endl << schur.matrixT() << endl;
|
||||
schur.compute(A.inverse());
|
||||
schur.compute(A.inverse(), /* computeU = */ false);
|
||||
cout << "The matrix T in the decomposition of A^(-1) is:" << endl << schur.matrixT() << endl;
|
||||
|
||||
Reference in New Issue
Block a user