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 fn_numel
20 //! @{
21 
22 
23 
24 template<typename T1>
25 arma_warn_unused
26 inline
27 typename enable_if2< is_arma_type<T1>::value, uword >::result
numel(const T1 & X)28 numel(const T1& X)
29   {
30   arma_extra_debug_sigprint();
31 
32   const Proxy<T1> P(X);
33 
34   return P.get_n_elem();
35   }
36 
37 
38 
39 template<typename T1>
40 arma_warn_unused
41 inline
42 typename enable_if2< is_arma_cube_type<T1>::value, uword >::result
numel(const T1 & X)43 numel(const T1& X)
44   {
45   arma_extra_debug_sigprint();
46 
47   const ProxyCube<T1> P(X);
48 
49   return P.get_n_elem();
50   }
51 
52 
53 
54 template<typename T1>
55 arma_warn_unused
56 inline
57 typename enable_if2< is_arma_sparse_type<T1>::value, uword >::result
numel(const T1 & X)58 numel(const T1& X)
59   {
60   arma_extra_debug_sigprint();
61 
62   const SpProxy<T1> P(X);
63 
64   return P.get_n_elem();
65   }
66 
67 
68 
69 template<typename oT>
70 arma_warn_unused
71 inline
72 uword
numel(const field<oT> & X)73 numel(const field<oT>& X)
74   {
75   arma_extra_debug_sigprint();
76 
77   return X.n_elem;
78   }
79 
80 
81 
82 template<typename oT>
83 arma_warn_unused
84 inline
85 uword
numel(const subview_field<oT> & X)86 numel(const subview_field<oT>& X)
87   {
88   arma_extra_debug_sigprint();
89 
90   return X.n_elem;
91   }
92 
93 
94 
95 //! @}
96