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 BaseCube
20 //! @{
21 
22 
23 
24 template<typename elem_type, typename derived>
25 struct BaseCube_eval_Cube
26   {
27   arma_inline arma_warn_unused const derived& eval() const;
28   };
29 
30 
31 template<typename elem_type, typename derived>
32 struct BaseCube_eval_expr
33   {
34   inline arma_warn_unused Cube<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 BaseCube_eval {};
40 
41 template<typename elem_type, typename derived>
42 struct BaseCube_eval<elem_type, derived, true>  { typedef BaseCube_eval_Cube<elem_type, derived>  result; };
43 
44 template<typename elem_type, typename derived>
45 struct BaseCube_eval<elem_type, derived, false> { typedef BaseCube_eval_expr<elem_type, derived> result; };
46 
47 
48 
49 //! Analog of the Base class, intended for cubes
50 template<typename elem_type, typename derived>
51 struct BaseCube
52   : public BaseCube_eval<elem_type, derived, is_Cube<derived>::value>::result
53   {
54   arma_inline const derived& get_ref() const;
55 
56   arma_cold inline void print(                           const std::string extra_text = "") const;
57   arma_cold inline void print(std::ostream& user_stream, const std::string extra_text = "") const;
58 
59   arma_cold inline void raw_print(                           const std::string extra_text = "") const;
60   arma_cold inline void raw_print(std::ostream& user_stream, const std::string extra_text = "") const;
61 
62   arma_cold inline void brief_print(                           const std::string extra_text = "") const;
63   arma_cold inline void brief_print(std::ostream& user_stream, const std::string extra_text = "") const;
64 
65   inline arma_warn_unused elem_type min() const;
66   inline arma_warn_unused elem_type max() const;
67 
68   inline arma_warn_unused uword index_min() const;
69   inline arma_warn_unused uword index_max() const;
70 
71   inline arma_warn_unused bool is_zero(const typename get_pod_type<elem_type>::result tol = 0) const;
72 
73   inline arma_warn_unused bool is_empty()  const;
74   inline arma_warn_unused bool is_finite() const;
75   inline arma_warn_unused bool has_inf()   const;
76   inline arma_warn_unused bool has_nan()   const;
77   };
78 
79 
80 
81 //! @}
82