// Copyright (C) 2008-2016 National ICT Australia (NICTA) // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. // ------------------------------------------------------------------- // // Written by Conrad Sanderson - http://conradsanderson.id.au // Written by James Sanders // Written by Eric Jon Sundstrom //! \addtogroup auxlib //! @{ //! interface functions for accessing decompositions in LAPACK and ATLAS class auxlib { public: template struct pos { static const uword n2 = row + col*2; static const uword n3 = row + col*3; static const uword n4 = row + col*4; }; // // inv template inline static bool inv(Mat& out, const Base& X); template inline static bool inv(Mat& out, const Mat& A); template inline static bool inv_noalias_tinymat(Mat& out, const Mat& X, const uword N); template inline static bool inv_inplace_lapack(Mat& out); // // inv_tr template inline static bool inv_tr(Mat& out, const Base& X, const uword layout); // // inv_sym template inline static bool inv_sym(Mat& out, const Base& X, const uword layout); // // inv_sympd template inline static bool inv_sympd(Mat& out, const Base& X); // // det template inline static eT det(const Base& X); template inline static eT det_tinymat(const Mat& X, const uword N); template inline static eT det_lapack(const Mat& X, const bool make_copy); // // log_det template inline static bool log_det(eT& out_val, typename get_pod_type::result& out_sign, const Base& X); // // lu template inline static bool lu(Mat& L, Mat& U, podarray& ipiv, const Base& X); template inline static bool lu(Mat& L, Mat& U, Mat& P, const Base& X); template inline static bool lu(Mat& L, Mat& U, const Base& X); // // eig_gen template inline static bool eig_gen(Mat< std::complex >& vals, Mat< std::complex >& vecs, const bool vecs_on, const Base& expr); template inline static bool eig_gen(Mat< std::complex >& vals, Mat< std::complex >& vecs, const bool vecs_on, const Base< std::complex, T1 >& expr); // // eig_pair template inline static bool eig_pair(Mat< std::complex >& vals, Mat< std::complex >& vecs, const bool vecs_on, const Base& A_expr, const Base& B_expr); template inline static bool eig_pair(Mat< std::complex >& vals, Mat< std::complex >& vecs, const bool vecs_on, const Base< std::complex, T1 >& A_expr, const Base< std::complex, T2 >& B_expr); // // eig_sym template inline static bool eig_sym(Col& eigval, const Base& X); template inline static bool eig_sym(Col& eigval, const Base,T1>& X); template inline static bool eig_sym(Col& eigval, Mat& eigvec, const Base& X); template inline static bool eig_sym(Col& eigval, Mat< std::complex >& eigvec, const Base,T1>& X); template inline static bool eig_sym_dc(Col& eigval, Mat& eigvec, const Base& X); template inline static bool eig_sym_dc(Col& eigval, Mat< std::complex >& eigvec, const Base,T1>& X); // // chol template inline static bool chol(Mat& out, const Base& X, const uword layout); // // qr template inline static bool qr(Mat& Q, Mat& R, const Base& X); template inline static bool qr_econ(Mat& Q, Mat& R, const Base& X); // // svd template inline static bool svd(Col& S, const Base& X, uword& n_rows, uword& n_cols); template inline static bool svd(Col& S, const Base, T1>& X, uword& n_rows, uword& n_cols); template inline static bool svd(Col& S, const Base& X); template inline static bool svd(Col& S, const Base, T1>& X); template inline static bool svd(Mat& U, Col& S, Mat& V, const Base& X); template inline static bool svd(Mat< std::complex >& U, Col& S, Mat< std::complex >& V, const Base< std::complex, T1>& X); template inline static bool svd_econ(Mat& U, Col& S, Mat& V, const Base& X, const char mode); template inline static bool svd_econ(Mat< std::complex >& U, Col& S, Mat< std::complex >& V, const Base< std::complex, T1>& X, const char mode); template inline static bool svd_dc(Col& S, const Base& X, uword& n_rows, uword& n_cols); template inline static bool svd_dc(Col& S, const Base, T1>& X, uword& n_rows, uword& n_cols); template inline static bool svd_dc(Col& S, const Base& X); template inline static bool svd_dc(Col& S, const Base, T1>& X); template inline static bool svd_dc(Mat& U, Col& S, Mat& V, const Base& X); template inline static bool svd_dc(Mat< std::complex >& U, Col& S, Mat< std::complex >& V, const Base< std::complex, T1>& X); template inline static bool svd_dc_econ(Mat& U, Col& S, Mat& V, const Base& X); template inline static bool svd_dc_econ(Mat< std::complex >& U, Col& S, Mat< std::complex >& V, const Base< std::complex, T1>& X); // // solve template inline static bool solve_square_fast(Mat& out, Mat& A, const Base& B_expr); template inline static bool solve_square_refine(Mat& out, typename T1::pod_type& out_rcond, Mat& A, const Base& B_expr, const bool equilibrate); template inline static bool solve_square_refine(Mat< std::complex >& out, typename T1::pod_type& out_rcond, Mat< std::complex >& A, const Base,T1>& B_expr, const bool equilibrate); template inline static bool solve_approx_fast(Mat& out, Mat& A, const Base& B_expr); template inline static bool solve_approx_svd(Mat& out, Mat& A, const Base& B_expr); template inline static bool solve_approx_svd(Mat< std::complex >& out, Mat< std::complex >& A, const Base,T1>& B_expr); template inline static bool solve_tri(Mat& out, const Mat& A, const Base& B_expr, const uword layout); // // Schur decomposition template inline static bool schur(Mat& U, Mat& S, const Base& X, const bool calc_U = true); template inline static bool schur(Mat >& U, Mat >& S, const Base,T1>& X, const bool calc_U = true); // // syl (solution of the Sylvester equation AX + XB = C) template inline static bool syl(Mat& X, const Mat& A, const Mat& B, const Mat& C); // // QZ decomposition template inline static bool qz(Mat& A, Mat& B, Mat& vsl, Mat& vsr, const Base& X_expr, const Base& Y_expr); template inline static bool qz(Mat< std::complex >& A, Mat< std::complex >& B, Mat< std::complex >& vsl, Mat< std::complex >& vsr, const Base< std::complex, T1 >& X_expr, const Base< std::complex, T2 >& Y_expr); // // rcond template inline static typename T1::pod_type rcond(const Base& A_expr); template inline static typename T1::pod_type rcond(const Base,T1>& A_expr); }; //! @}