comparison armadillo-3.900.4/include/armadillo_bits/fn_ones.hpp @ 49:1ec0e2823891

Switch to using subrepo copies of qm-dsp, nnls-chroma, vamp-plugin-sdk; update Armadillo version; assume build without external BLAS/LAPACK
author Chris Cannam
date Thu, 13 Jun 2013 10:25:24 +0100
parents
children
comparison
equal deleted inserted replaced
48:69251e11a913 49:1ec0e2823891
1 // Copyright (C) 2008-2012 NICTA (www.nicta.com.au)
2 // Copyright (C) 2008-2012 Conrad Sanderson
3 //
4 // This Source Code Form is subject to the terms of the Mozilla Public
5 // License, v. 2.0. If a copy of the MPL was not distributed with this
6 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
7
8
9 //! \addtogroup fn_ones
10 //! @{
11
12
13
14 arma_inline
15 const Gen<vec, gen_ones_full>
16 ones(const uword n_elem)
17 {
18 arma_extra_debug_sigprint();
19
20 return Gen<vec, gen_ones_full>(n_elem, 1);
21 }
22
23
24
25 template<typename obj_type>
26 arma_inline
27 const Gen<obj_type, gen_ones_full>
28 ones(const uword n_elem, const arma_empty_class junk1 = arma_empty_class(), const typename arma_Mat_Col_Row_only<obj_type>::result* junk2 = 0)
29 {
30 arma_extra_debug_sigprint();
31 arma_ignore(junk1);
32 arma_ignore(junk2);
33
34 if(is_Row<obj_type>::value == true)
35 {
36 return Gen<obj_type, gen_ones_full>(1, n_elem);
37 }
38 else
39 {
40 return Gen<obj_type, gen_ones_full>(n_elem, 1);
41 }
42 }
43
44
45
46 arma_inline
47 const Gen<mat, gen_ones_full>
48 ones(const uword n_rows, const uword n_cols)
49 {
50 arma_extra_debug_sigprint();
51
52 return Gen<mat, gen_ones_full>(n_rows, n_cols);
53 }
54
55
56
57 template<typename obj_type>
58 inline
59 const Gen<obj_type, gen_ones_full>
60 ones(const uword n_rows, const uword n_cols, const typename arma_Mat_Col_Row_only<obj_type>::result* junk = 0)
61 {
62 arma_extra_debug_sigprint();
63 arma_ignore(junk);
64
65 if(is_Col<obj_type>::value == true)
66 {
67 arma_debug_check( (n_cols != 1), "ones(): incompatible size" );
68 }
69 else
70 if(is_Row<obj_type>::value == true)
71 {
72 arma_debug_check( (n_rows != 1), "ones(): incompatible size" );
73 }
74
75 return Gen<obj_type, gen_ones_full>(n_rows, n_cols);
76 }
77
78
79
80 arma_inline
81 const GenCube<cube::elem_type, gen_ones_full>
82 ones(const uword n_rows, const uword n_cols, const uword n_slices)
83 {
84 arma_extra_debug_sigprint();
85
86 return GenCube<cube::elem_type, gen_ones_full>(n_rows, n_cols, n_slices);
87 }
88
89
90
91 template<typename cube_type>
92 arma_inline
93 const GenCube<typename cube_type::elem_type, gen_ones_full>
94 ones(const uword n_rows, const uword n_cols, const uword n_slices, const typename arma_Cube_only<cube_type>::result* junk = 0)
95 {
96 arma_extra_debug_sigprint();
97 arma_ignore(junk);
98
99 return GenCube<typename cube_type::elem_type, gen_ones_full>(n_rows, n_cols, n_slices);
100 }
101
102
103
104 //! @}