max@0: // Copyright (C) 2008-2011 NICTA (www.nicta.com.au) max@0: // Copyright (C) 2008-2011 Conrad Sanderson max@0: // Copyright (C) 2009 Edmund Highcock max@0: // Copyright (C) 2011 James Sanders max@0: // max@0: // This file is part of the Armadillo C++ library. max@0: // It is provided without any warranty of fitness max@0: // for any purpose. You can redistribute this file max@0: // and/or modify it under the terms of the GNU max@0: // Lesser General Public License (LGPL) as published max@0: // by the Free Software Foundation, either version 3 max@0: // of the License or (at your option) any later version. max@0: // (see http://www.opensource.org/licenses for more info) max@0: max@0: max@0: //! \addtogroup auxlib max@0: //! @{ max@0: max@0: max@0: //! wrapper for accessing external functions defined in ATLAS, LAPACK or BLAS libraries max@0: class auxlib max@0: { max@0: public: max@0: max@0: max@0: template max@0: struct pos max@0: { max@0: static const uword n2 = row + col*2; max@0: static const uword n3 = row + col*3; max@0: static const uword n4 = row + col*4; max@0: }; max@0: max@0: max@0: // max@0: // inv max@0: max@0: template max@0: inline static bool inv(Mat& out, const Base& X, const bool slow = false); max@0: max@0: template max@0: inline static bool inv(Mat& out, const Mat& A, const bool slow = false); max@0: max@0: template max@0: inline static bool inv_noalias_tinymat(Mat& out, const Mat& X, const uword N); max@0: max@0: template max@0: inline static bool inv_inplace_tinymat(Mat& out, const uword N); max@0: max@0: template max@0: inline static bool inv_inplace_lapack(Mat& out); max@0: max@0: max@0: // max@0: // inv_tr max@0: max@0: template max@0: inline static bool inv_tr(Mat& out, const Base& X, const uword layout); max@0: max@0: max@0: // max@0: // inv_sym max@0: max@0: template max@0: inline static bool inv_sym(Mat& out, const Base& X, const uword layout); max@0: max@0: max@0: // max@0: // inv_sympd max@0: max@0: template max@0: inline static bool inv_sympd(Mat& out, const Base& X, const uword layout); max@0: max@0: max@0: // max@0: // det max@0: max@0: template max@0: inline static eT det(const Base& X, const bool slow = false); max@0: max@0: template max@0: inline static eT det_tinymat(const Mat& X, const uword N); max@0: max@0: template max@0: inline static eT det_lapack(const Mat& X, const bool make_copy); max@0: max@0: max@0: // max@0: // log_det max@0: max@0: template max@0: inline static bool log_det(eT& out_val, typename get_pod_type::result& out_sign, const Base& X); max@0: max@0: max@0: // max@0: // lu max@0: max@0: template max@0: inline static bool lu(Mat& L, Mat& U, podarray& ipiv, const Base& X); max@0: max@0: template max@0: inline static bool lu(Mat& L, Mat& U, Mat& P, const Base& X); max@0: max@0: template max@0: inline static bool lu(Mat& L, Mat& U, const Base& X); max@0: max@0: max@0: // max@0: // eig max@0: max@0: template max@0: inline static bool eig_sym(Col& eigval, const Base& X); max@0: max@0: template max@0: inline static bool eig_sym(Col& eigval, const Base,T1>& X); max@0: max@0: template max@0: inline static bool eig_sym(Col& eigval, Mat& eigvec, const Base& X); max@0: max@0: template max@0: inline static bool eig_sym(Col& eigval, Mat< std::complex >& eigvec, const Base,T1>& X); max@0: max@0: template max@0: inline static bool eig_gen(Col< std::complex >& eigval, Mat& l_eigvec, Mat& r_eigvec, const Base& X, const char side); max@0: max@0: template max@0: inline static bool eig_gen(Col< std::complex >& eigval, Mat< std::complex >& l_eigvec, Mat< std::complex >& r_eigvec, const Base< std::complex, T1 >& X, const char side); max@0: max@0: max@0: // max@0: // chol max@0: max@0: template max@0: inline static bool chol(Mat& out, const Base& X); max@0: max@0: max@0: // max@0: // qr max@0: max@0: template max@0: inline static bool qr(Mat& Q, Mat& R, const Base& X); max@0: max@0: max@0: // max@0: // svd max@0: max@0: template max@0: inline static bool svd(Col& S, const Base& X, uword& n_rows, uword& n_cols); max@0: max@0: template max@0: inline static bool svd(Col& S, const Base, T1>& X, uword& n_rows, uword& n_cols); max@0: max@0: template max@0: inline static bool svd(Col& S, const Base& X); max@0: max@0: template max@0: inline static bool svd(Col& S, const Base, T1>& X); max@0: max@0: template max@0: inline static bool svd(Mat& U, Col& S, Mat& V, const Base& X); max@0: max@0: template max@0: inline static bool svd(Mat< std::complex >& U, Col& S, Mat< std::complex >& V, const Base< std::complex, T1>& X); max@0: max@0: template max@0: inline static bool svd_econ(Mat& U, Col& S, Mat& V, const Base& X, const char mode); max@0: max@0: template max@0: inline static bool svd_econ(Mat< std::complex >& U, Col& S, Mat< std::complex >& V, const Base< std::complex, T1>& X, const char mode); max@0: max@0: max@0: // max@0: // solve max@0: max@0: template max@0: inline static bool solve (Mat& out, Mat& A, const Mat& B, const bool slow = false); max@0: max@0: template max@0: inline static bool solve_od(Mat& out, Mat& A, const Mat& B); max@0: max@0: template max@0: inline static bool solve_ud(Mat& out, Mat& A, const Mat& B); max@0: max@0: max@0: // max@0: // solve_tr max@0: max@0: template max@0: inline static bool solve_tr(Mat& out, const Mat& A, const Mat& B, const uword layout); max@0: max@0: max@0: // max@0: // Schur decomposition max@0: max@0: template max@0: inline static bool schur_dec(Mat& Z, Mat& T, const Mat& A); max@0: max@0: template max@0: inline static bool schur_dec(Mat >& Z, Mat >& T, const Mat >& A); max@0: max@0: max@0: // max@0: // syl (solution of the Sylvester equation AX + XB = C) max@0: max@0: template max@0: inline static bool syl(Mat& X, const Mat& A, const Mat& B, const Mat& C); max@0: max@0: max@0: // max@0: // lyap (solution of the continuous Lyapunov equation AX + XA^H + Q = 0) max@0: max@0: template max@0: inline static bool lyap(Mat& X, const Mat& A, const Mat& Q); max@0: max@0: max@0: // max@0: // dlyap (solution of the discrete Lyapunov equation AXA^H - X + Q = 0) max@0: max@0: template max@0: inline static bool dlyap(Mat& X, const Mat& A, const Mat& Q); max@0: }; max@0: max@0: max@0: //! @}