Chris@49: // Copyright (C) 2008-2012 NICTA (www.nicta.com.au) Chris@49: // Copyright (C) 2008-2012 Conrad Sanderson Chris@49: // Chris@49: // This Source Code Form is subject to the terms of the Mozilla Public Chris@49: // License, v. 2.0. If a copy of the MPL was not distributed with this Chris@49: // file, You can obtain one at http://mozilla.org/MPL/2.0/. Chris@49: Chris@49: Chris@49: //! \addtogroup Base Chris@49: //! @{ Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct Base_blas_elem_type Chris@49: { Chris@49: arma_inline const Op i(const bool slow = false) const; //!< matrix inverse Chris@49: }; Chris@49: Chris@49: Chris@49: template Chris@49: struct Base_other_elem_type Chris@49: { Chris@49: }; Chris@49: Chris@49: Chris@49: template Chris@49: struct Base_extra {}; Chris@49: Chris@49: template Chris@49: struct Base_extra { typedef Base_blas_elem_type result; }; Chris@49: Chris@49: template Chris@49: struct Base_extra { typedef Base_other_elem_type result; }; Chris@49: Chris@49: Chris@49: Chris@49: template Chris@49: struct Base_eval_Mat Chris@49: { Chris@49: const derived& eval() const; Chris@49: }; Chris@49: Chris@49: Chris@49: template Chris@49: struct Base_eval_expr Chris@49: { Chris@49: Mat eval() const; //!< force the immediate evaluation of a delayed expression Chris@49: }; Chris@49: Chris@49: Chris@49: template Chris@49: struct Base_eval {}; Chris@49: Chris@49: template Chris@49: struct Base_eval { typedef Base_eval_Mat result; }; Chris@49: Chris@49: template Chris@49: struct Base_eval { typedef Base_eval_expr result; }; Chris@49: Chris@49: Chris@49: Chris@49: //! Class for static polymorphism, modelled after the "Curiously Recurring Template Pattern" (CRTP). Chris@49: //! Used for type-safe downcasting in functions that restrict their input(s) to be classes that are Chris@49: //! derived from Base (e.g. Mat, Op, Glue, diagview, subview). Chris@49: //! A Base object can be converted to a Mat object by the unwrap class. Chris@49: Chris@49: template Chris@49: struct Base Chris@49: : public Base_extra::value>::result Chris@49: , public Base_eval::value>::result Chris@49: { Chris@49: arma_inline const derived& get_ref() const; Chris@49: Chris@49: arma_inline const Op t() const; //!< Hermitian transpose Chris@49: arma_inline const Op ht() const; //!< Hermitian transpose Chris@49: arma_inline const Op st() const; //!< simple transpose Chris@49: Chris@49: inline void print(const std::string extra_text = "") const; Chris@49: inline void print(std::ostream& user_stream, const std::string extra_text = "") const; Chris@49: Chris@49: inline void raw_print(const std::string extra_text = "") const; Chris@49: inline void raw_print(std::ostream& user_stream, const std::string extra_text = "") const; Chris@49: }; Chris@49: Chris@49: Chris@49: Chris@49: //! @}