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_all
20 //! @{
21
22
23
24 template<typename T1>
25 arma_warn_unused
26 inline
27 typename
28 enable_if2
29 <
30 is_arma_type<T1>::value && resolves_to_vector<T1>::yes,
31 bool
32 >::result
all(const T1 & X)33 all(const T1& X)
34 {
35 arma_extra_debug_sigprint();
36
37 return op_all::all_vec(X);
38 }
39
40
41
42 template<typename T1>
43 arma_warn_unused
44 arma_inline
45 typename
46 enable_if2
47 <
48 is_arma_type<T1>::value && resolves_to_vector<T1>::no,
49 const mtOp<uword, T1, op_all>
50 >::result
all(const T1 & X)51 all(const T1& X)
52 {
53 arma_extra_debug_sigprint();
54
55 return mtOp<uword, T1, op_all>(X, 0, 0);
56 }
57
58
59
60 template<typename T1>
61 arma_warn_unused
62 arma_inline
63 typename
64 enable_if2
65 <
66 is_arma_type<T1>::value,
67 const mtOp<uword, T1, op_all>
68 >::result
all(const T1 & X,const uword dim)69 all(const T1& X, const uword dim)
70 {
71 arma_extra_debug_sigprint();
72
73 return mtOp<uword, T1, op_all>(X, dim, 0);
74 }
75
76
77
78 //! for compatibility purposes: allows compiling user code designed for earlier versions of Armadillo
79 template<typename T>
80 arma_warn_unused
81 arma_inline
82 typename
83 enable_if2
84 <
85 is_supported_elem_type<T>::value,
86 bool
87 >::result
all(const T & val)88 all(const T& val)
89 {
90 return (val != T(0));
91 }
92
93
94
95 //! @}
96