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 Op
20 //! @{
21 
22 
23 
24 template<typename T1, typename op_type, bool condition>
25 struct Op_traits {};
26 
27 
28 template<typename T1, typename op_type>
29 struct Op_traits<T1, op_type, true>
30   {
31   static constexpr bool is_row  = op_type::template traits<T1>::is_row;
32   static constexpr bool is_col  = op_type::template traits<T1>::is_col;
33   static constexpr bool is_xvec = op_type::template traits<T1>::is_xvec;
34   };
35 
36 template<typename T1, typename op_type>
37 struct Op_traits<T1, op_type, false>
38   {
39   static constexpr bool is_row  = false;
40   static constexpr bool is_col  = false;
41   static constexpr bool is_xvec = false;
42   };
43 
44 
45 template<typename T1, typename op_type>
46 class Op
47   : public Base< typename T1::elem_type, Op<T1, op_type> >
48   , public Op_traits<T1, op_type, has_nested_op_traits<op_type>::value>
49   {
50   public:
51 
52   typedef typename T1::elem_type                   elem_type;
53   typedef typename get_pod_type<elem_type>::result pod_type;
54 
55   inline explicit Op(const T1& in_m);
56   inline          Op(const T1& in_m, const elem_type in_aux);
57   inline          Op(const T1& in_m, const elem_type in_aux,         const uword in_aux_uword_a, const uword in_aux_uword_b);
58   inline          Op(const T1& in_m, const uword     in_aux_uword_a, const uword in_aux_uword_b);
59   inline          Op(const T1& in_m, const uword     in_aux_uword_a, const uword in_aux_uword_b, const uword in_aux_uword_c, const char junk);
60   inline         ~Op();
61 
62   arma_aligned const T1&       m;            //!< the operand; must be derived from Base
63   arma_aligned       elem_type aux;          //!< auxiliary data, using the element type as used by T1
64   arma_aligned       uword     aux_uword_a;  //!< auxiliary data, uword format
65   arma_aligned       uword     aux_uword_b;  //!< auxiliary data, uword format
66   arma_aligned       uword     aux_uword_c;  //!< auxiliary data, uword format
67   };
68 
69 
70 
71 //! @}
72