14 std::cout <<
"I = " << I << std::endl;
18 std::cout <<
"D = " << D << std::endl;
23 std::cout <<
"M = " << M << std::endl;
24 std::cout <<
"v = " << v << std::endl;
28 std::cout <<
"d = " << d << std::endl;
34 std::cout <<
"A_mv = " << A_mv << std::endl;
36 std::cout <<
"Algebra of A_mv: " <<
nda::get_algebra<
decltype(A_mv)> << std::endl;
42 std::cout <<
"v1 = " << v1 << std::endl;
43 std::cout <<
"v2 = " << v2 << std::endl;
44 std::cout <<
"v3 = v1 x v2 = " << v3 << std::endl;
51 auto M_v1 =
nda::matrix<double>{{0, -v1[2], v1[1]}, {v1[2], 0, -v1[0]}, {-v1[1], v1[0], 0}};
52 std::cout <<
"M_v1 = " << M_v1 << std::endl;
53 auto v3_mv = M_v1 * v2;
54 std::cout <<
"v3_mv = " << v3_mv << std::endl;
58 std::cout <<
"M1 = " << M1 << std::endl;
62 std::cout <<
"Eigenvalues of M1: s = " << s << std::endl;
63 std::cout <<
"Eigenvectors of M1: Q = " << Q << std::endl;
67 std::cout <<
"M1_reconstructed = " << M1_reconstructed << std::endl;
72 std::cout <<
"A1 = " << A1 << std::endl;
73 std::cout <<
"b1 = " << b1 << std::endl;
80 std::cerr <<
"Error: nda::lapack::getrf failed with error code " << info << std::endl;
86 x1(nda::range::all, 0) = b1;
89 std::cerr <<
"Error: nda::lapack::getrs failed with error code " << info << std::endl;
92 std::cout <<
"x1 = " << x1(nda::range::all, 0) << std::endl;
95 std::cout <<
"A1 * x1 = " << A1 * x1(nda::range::all, 0) << std::endl;
auto eye(Int dim)
Create an identity nda::matrix with ones on the diagonal.
ArrayOfRank< 2 > auto diag(V const &v)
Get a new nda::matrix with the given values on the diagonal.
auto make_matrix_view(basic_array< T, R, LP, A, CP > const &a)
Make an nda::matrix_view of a given nda::basic_array.
auto transpose(A &&a)
Transpose the memory layout of an nda::MemoryArray or an nda::expr_call.
ArrayOfRank< 1 > auto diagonal(M &&m)
Get a view of the diagonal of a 2-dimensional array/view.
basic_array< ValueType, Rank, Layout, 'A', ContainerPolicy > array
Alias template of an nda::basic_array with an 'A' algebra.
basic_array< ValueType, 1, C_layout, 'V', ContainerPolicy > vector
Alias template of an nda::basic_array with rank 1 and a 'V' algebra.
basic_array< ValueType, 2, Layout, 'M', ContainerPolicy > matrix
Alias template of an nda::basic_array with rank 2 and an 'M' algebra.
constexpr char get_algebra
Constexpr variable that specifies the algebra of a type.
int getrf(A &&a, IPIV &&ipiv)
Interface to the LAPACK getrf routine.
int getrs(A const &a, B &&b, IPIV const &ipiv)
Interface to the LAPACK getrs routine.
Includes all LAPACK relevant headers.
Includes all relevant headers for the linear algebra functionality.
Includes all relevant headers for the core nda library.