20 #include <tensor/tensor.h>
21 #include <tensor/tensor_lapack.h>
22 #include <tensor/linalg.h>
26 using namespace tensor;
28 template<
typename elt_t>
30 bool right,
size_t iter,
double tol)
33 std::cerr <<
"eig_right_power cannot solve non-square problems";
46 for (
size_t i = 0; i <= iter; i++) {
48 double n = norm2(v_new);
50 eig = scprod(v_new, v);
52 double eig_change = abs(eig - old_eig);
53 if (eig_change < tol * abs(eig)) {
54 double vec_change = norm2(v - old_v);
55 if (vec_change < tol) {
void randomize()
Fills with random numbers.
const CTensor eig(const RTensor &A, CTensor *R=0, CTensor *L=0)
Eigenvalue decomposition of a real matrix.
index columns() const
Query the size of 2nd index.
index rows() const
Query then size of 1st index.