annotate armadillo-3.900.4/include/armadillo_bits/Base_bones.hpp @ 84:55a047986812 tip

Update library URI so as not to be document-local
author Chris Cannam
date Wed, 22 Apr 2020 14:21:57 +0100
parents 1ec0e2823891
children
rev   line source
Chris@49 1 // Copyright (C) 2008-2012 NICTA (www.nicta.com.au)
Chris@49 2 // Copyright (C) 2008-2012 Conrad Sanderson
Chris@49 3 //
Chris@49 4 // This Source Code Form is subject to the terms of the Mozilla Public
Chris@49 5 // License, v. 2.0. If a copy of the MPL was not distributed with this
Chris@49 6 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
Chris@49 7
Chris@49 8
Chris@49 9 //! \addtogroup Base
Chris@49 10 //! @{
Chris@49 11
Chris@49 12
Chris@49 13
Chris@49 14 template<typename derived>
Chris@49 15 struct Base_blas_elem_type
Chris@49 16 {
Chris@49 17 arma_inline const Op<derived,op_inv> i(const bool slow = false) const; //!< matrix inverse
Chris@49 18 };
Chris@49 19
Chris@49 20
Chris@49 21 template<typename derived>
Chris@49 22 struct Base_other_elem_type
Chris@49 23 {
Chris@49 24 };
Chris@49 25
Chris@49 26
Chris@49 27 template<typename derived, bool condition>
Chris@49 28 struct Base_extra {};
Chris@49 29
Chris@49 30 template<typename derived>
Chris@49 31 struct Base_extra<derived, true> { typedef Base_blas_elem_type<derived> result; };
Chris@49 32
Chris@49 33 template<typename derived>
Chris@49 34 struct Base_extra<derived, false> { typedef Base_other_elem_type<derived> result; };
Chris@49 35
Chris@49 36
Chris@49 37
Chris@49 38 template<typename elem_type, typename derived>
Chris@49 39 struct Base_eval_Mat
Chris@49 40 {
Chris@49 41 const derived& eval() const;
Chris@49 42 };
Chris@49 43
Chris@49 44
Chris@49 45 template<typename elem_type, typename derived>
Chris@49 46 struct Base_eval_expr
Chris@49 47 {
Chris@49 48 Mat<elem_type> eval() const; //!< force the immediate evaluation of a delayed expression
Chris@49 49 };
Chris@49 50
Chris@49 51
Chris@49 52 template<typename elem_type, typename derived, bool condition>
Chris@49 53 struct Base_eval {};
Chris@49 54
Chris@49 55 template<typename elem_type, typename derived>
Chris@49 56 struct Base_eval<elem_type, derived, true> { typedef Base_eval_Mat<elem_type, derived> result; };
Chris@49 57
Chris@49 58 template<typename elem_type, typename derived>
Chris@49 59 struct Base_eval<elem_type, derived, false> { typedef Base_eval_expr<elem_type, derived> result; };
Chris@49 60
Chris@49 61
Chris@49 62
Chris@49 63 //! Class for static polymorphism, modelled after the "Curiously Recurring Template Pattern" (CRTP).
Chris@49 64 //! Used for type-safe downcasting in functions that restrict their input(s) to be classes that are
Chris@49 65 //! derived from Base (e.g. Mat, Op, Glue, diagview, subview).
Chris@49 66 //! A Base object can be converted to a Mat object by the unwrap class.
Chris@49 67
Chris@49 68 template<typename elem_type, typename derived>
Chris@49 69 struct Base
Chris@49 70 : public Base_extra<derived, is_supported_blas_type<elem_type>::value>::result
Chris@49 71 , public Base_eval<elem_type, derived, is_Mat<derived>::value>::result
Chris@49 72 {
Chris@49 73 arma_inline const derived& get_ref() const;
Chris@49 74
Chris@49 75 arma_inline const Op<derived,op_htrans> t() const; //!< Hermitian transpose
Chris@49 76 arma_inline const Op<derived,op_htrans> ht() const; //!< Hermitian transpose
Chris@49 77 arma_inline const Op<derived,op_strans> st() const; //!< simple transpose
Chris@49 78
Chris@49 79 inline void print(const std::string extra_text = "") const;
Chris@49 80 inline void print(std::ostream& user_stream, const std::string extra_text = "") const;
Chris@49 81
Chris@49 82 inline void raw_print(const std::string extra_text = "") const;
Chris@49 83 inline void raw_print(std::ostream& user_stream, const std::string extra_text = "") const;
Chris@49 84 };
Chris@49 85
Chris@49 86
Chris@49 87
Chris@49 88 //! @}