24 #include <tensor/linalg.h>
25 #include <tensor/arpack_d.h>
30 eigs(
const RSparse &A,
int eig_type,
size_t neig, RTensor *eigenvectors,
31 const RTensor::elt_t *initial_guess)
34 size_t n = A.columns();
37 return eigs(full(A), t, neig, eigenvectors, initial_guess);
41 std::cerr <<
"In eigs(): Can only compute eigenvalues of square matrices.";
47 RArpack data(A.columns(), t, neig);
50 data.set_start_vector(initial_guess);
52 while (data.update() < RArpack::Finished) {
53 data.set_y(mmult(A, data.get_x()));
55 if (data.get_status() != RArpack::Finished) {
56 std::cerr << data.error_message() <<
'\n';
59 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.