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_cumsum
20 //! @{
21 
22 
23 
24 template<typename T1>
25 arma_warn_unused
26 arma_inline
27 typename
28 enable_if2
29   <
30   is_arma_type<T1>::value && resolves_to_vector<T1>::yes,
31   const Op<T1, op_cumsum_vec>
32   >::result
cumsum(const T1 & X)33 cumsum(const T1& X)
34   {
35   arma_extra_debug_sigprint();
36 
37   return Op<T1, op_cumsum_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 Op<T1, op_cumsum>
50   >::result
cumsum(const T1 & X)51 cumsum(const T1& X)
52   {
53   arma_extra_debug_sigprint();
54 
55   return Op<T1, op_cumsum>(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 Op<T1, op_cumsum>
68   >::result
cumsum(const T1 & X,const uword dim)69 cumsum(const T1& X, const uword dim)
70   {
71   arma_extra_debug_sigprint();
72 
73   return Op<T1, op_cumsum>(X, dim, 0);
74   }
75 
76 
77 
78 template<typename T>
79 arma_warn_unused
80 arma_inline
81 typename arma_scalar_only<T>::result
cumsum(const T & x)82 cumsum(const T& x)
83   {
84   return x;
85   }
86 
87 
88 
89 //! @}
90