LAPACKΒΆ
HighFM also supports more advanced mathematical operations, such as QR factorization, eigen decomposition, solving least-square problems, etc. In many cases, these routines may return more than one object at the same time. Take for example the eigen decomposition \(\mathbf{A} = \mathbf{VDV}^{-1}\), where \(\mathbf{V}\) contains the eigenvectors of A
and \(\mathbf{D}\) is a diagonal matrix containing the corresponding eigenvalues.
Matrix<double> A(n, n);
Vector<std::complex<double>> D(n);
Matrix<double> V(n, n); // Matrix with the eigenvectors
Matrix<double> Vinv(n, n);
D = eigen(A); // Calculates only the eigenvalues.
tie(D, V) = eigen(A); // Calculates the eigenvalues and V.
tie(D, V, Vinv) = eigen(A); // Calculates the eigenvalues, V and Vinv.
Notice that you need to use tie()
to assign the result of the eigen decomposition to multiple objects(D
, V
and Vinv
). Moreover, depending on the number of objects, the eigen
routine will behave differently.
There are some exceptions, though. For instance, both QR and LQ factorizations are stored in a compact form, and thus, qr(A)
and lq(A)
will return an abstract object instead of the corresponding matrices.
Available operations: