40 template <
typename ScalarType>
44 ScalarType M[9][9] = {{ 4, 1, -2, 2, -7, 3, 9, -6, -2},
45 { 1, -2, 0, 1, -1, 5, 4, 7, 3},
46 {-2, 0, 3, 2, 0, 3, 6, 1, -1},
47 { 2, 1, 2, 1, 4, 5, 6, 7, 8},
48 {-7, -1, 0, 4, 5, 4, 9, 1, -8},
49 { 3, 5, 3, 5, 4, 9, -3, 3, 3},
50 { 9, 4, 6, 6, 9, -3, 3, 6, -7},
51 {-6, 7, 1, 7, 1, 3, 6, 2, 6},
52 {-2, 3, -1, 8, -8, 3, -7, 6, 1}};
54 for(std::size_t i = 0; i < 9; i++)
55 for(std::size_t j = 0; j < 9; j++)
62 for(std::size_t i = 0; i < 9; i++)
69 template <
typename ScalarType>
72 for (
unsigned int i = 0; i < v.size(); i++)
73 std::cout << std::setprecision(6) << std::fixed << v[i] <<
"\t";
74 std::cout << std::endl;
85 std::cout <<
"Testing matrix of size " << 9 <<
"-by-" << 9 << std::endl;
89 std::vector<ScalarType> eigenvalues_ref(9);
90 std::vector<ScalarType> eigenvalues(9);
94 initialize(A_input, eigenvalues_ref);
96 std::cout << std::endl <<
"Input matrix: " << std::endl;
97 std::cout << A_input << std::endl;
110 std::cout <<
"Calculation..." << std::endl;
121 std::cout << std::endl <<
"Eigenvalues with std::vector<T>:" << std::endl;
123 std::cout <<
"Eigenvalues with viennacl::vector<T>: " << std::endl << vcl_eigenvalues << std::endl;
124 std::cout << std::endl <<
"Reference eigenvalues:" << std::endl;
126 std::cout << std::endl;
127 std::cout <<
"Eigenvectors - each column is an eigenvector" << std::endl;
128 std::cout << Q << std::endl;
133 std::cout << std::endl;
134 std::cout <<
"------- Tutorial completed --------" << std::endl;
135 std::cout << std::endl;
Generic interface for matrix-vector and matrix-matrix products. See viennacl/linalg/vector_operations...
Implementation of the dense matrix class.
Implementation of the QR method for eigenvalue computations. Experimental.
void vector_print(std::vector< ScalarType > &v)
void qr_method_sym(viennacl::matrix< SCALARTYPE > &A, viennacl::matrix< SCALARTYPE > &Q, std::vector< SCALARTYPE > &D)