1 // SPDX-License-Identifier: Apache-2.0
2 //
3 // Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
4 // Copyright 2008-2016 National ICT Australia (NICTA)
5 //
6 // Licensed under the Apache License, Version 2.0 (the "License");
7 // you may not use this file except in compliance with the License.
8 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 // ------------------------------------------------------------------------
17 
18 
19 //! \addtogroup SpBase
20 //! @{
21 
22 
23 
24 template<typename elem_type, typename derived>
25 struct SpBase_eval_SpMat
26   {
27   inline arma_warn_unused const derived& eval() const;
28   };
29 
30 
31 template<typename elem_type, typename derived>
32 struct SpBase_eval_expr
33   {
34   inline arma_warn_unused SpMat<elem_type> eval() const;   //!< force the immediate evaluation of a delayed expression
35   };
36 
37 
38 template<typename elem_type, typename derived, bool condition>
39 struct SpBase_eval {};
40 
41 template<typename elem_type, typename derived>
42 struct SpBase_eval<elem_type, derived, true>  { typedef SpBase_eval_SpMat<elem_type, derived> result; };
43 
44 template<typename elem_type, typename derived>
45 struct SpBase_eval<elem_type, derived, false> { typedef SpBase_eval_expr<elem_type, derived>  result; };
46 
47 
48 
49 template<typename elem_type, typename derived>
50 struct SpBase
51   : public SpBase_eval<elem_type, derived, is_SpMat<derived>::value>::result
52   {
53   arma_inline const derived& get_ref() const;
54 
55   arma_inline bool is_alias(const SpMat<elem_type>& X) const;
56 
57   inline arma_warn_unused const SpOp<derived,spop_htrans>  t() const;  //!< Hermitian transpose
58   inline arma_warn_unused const SpOp<derived,spop_htrans> ht() const;  //!< Hermitian transpose
59   inline arma_warn_unused const SpOp<derived,spop_strans> st() const;  //!< simple transpose
60 
61   arma_cold inline void print(                           const std::string extra_text = "") const;
62   arma_cold inline void print(std::ostream& user_stream, const std::string extra_text = "") const;
63 
64   arma_cold inline void raw_print(                           const std::string extra_text = "") const;
65   arma_cold inline void raw_print(std::ostream& user_stream, const std::string extra_text = "") const;
66 
67   arma_cold inline void print_dense(                           const std::string extra_text = "") const;
68   arma_cold inline void print_dense(std::ostream& user_stream, const std::string extra_text = "") const;
69 
70   arma_cold inline void raw_print_dense(                           const std::string extra_text = "") const;
71   arma_cold inline void raw_print_dense(std::ostream& user_stream, const std::string extra_text = "") const;
72 
73   arma_cold inline void brief_print(                           const std::string extra_text = "") const;
74   arma_cold inline void brief_print(std::ostream& user_stream, const std::string extra_text = "") const;
75 
76   inline arma_warn_unused elem_type min() const;
77   inline arma_warn_unused elem_type max() const;
78 
79   inline elem_type min(uword& index_of_min_val) const;
80   inline elem_type max(uword& index_of_max_val) const;
81 
82   inline elem_type min(uword& row_of_min_val, uword& col_of_min_val) const;
83   inline elem_type max(uword& row_of_max_val, uword& col_of_max_val) const;
84 
85   inline arma_warn_unused uword index_min() const;
86   inline arma_warn_unused uword index_max() const;
87 
88   inline arma_warn_unused bool is_symmetric() const;
89   inline arma_warn_unused bool is_symmetric(const typename get_pod_type<elem_type>::result tol) const;
90 
91   inline arma_warn_unused bool is_hermitian() const;
92   inline arma_warn_unused bool is_hermitian(const typename get_pod_type<elem_type>::result tol) const;
93 
94   inline arma_warn_unused bool is_zero(const typename get_pod_type<elem_type>::result tol = 0) const;
95 
96   inline arma_warn_unused bool is_trimatu() const;
97   inline arma_warn_unused bool is_trimatl() const;
98   inline arma_warn_unused bool is_diagmat() const;
99   inline arma_warn_unused bool is_empty()   const;
100   inline arma_warn_unused bool is_square()  const;
101   inline arma_warn_unused bool is_vec()     const;
102   inline arma_warn_unused bool is_colvec()  const;
103   inline arma_warn_unused bool is_rowvec()  const;
104   inline arma_warn_unused bool is_finite()  const;
105   inline arma_warn_unused bool has_inf()    const;
106   inline arma_warn_unused bool has_nan()    const;
107 
108   inline arma_warn_unused const SpOp<derived,spop_vectorise_col> as_col() const;
109   inline arma_warn_unused const SpOp<derived,spop_vectorise_row> as_row() const;
110   };
111 
112 
113 
114 //! @}
115