24 #include <tensor/linalg.h>
25 #include <tensor/arpack_z.h>
32 eigs(
const CSparse &A,
int eig_type,
size_t neig, CTensor *eigenvectors,
33 const CTensor::elt_t *initial_guess)
36 size_t n = A.columns();
39 return eigs(full(A), t, neig, eigenvectors, initial_guess);
43 std::cerr <<
"In eigs(): Can only compute eigenvalues of square matrices.";
49 CArpack data(n, t, neig);
52 data.set_start_vector(initial_guess);
54 while (data.update() < CArpack::Finished) {
55 data.set_y(mmult(A, data.get_x()));
57 if (data.get_status() != CArpack::Finished) {
58 std::cerr << data.error_message() <<
'\n';
61 output = data.get_data(eigenvectors);
CTensor eigs(const CTensor &A, int eig_type, size_t neig, CTensor *vectors=NULL, const tensor::cdouble *initial_guess=NULL)
Find out a few eigenvalues and eigenvectors of a complex nonsymmetric matrix.
EigType
Type of eigenvalues that eigs and Arpack compute.