annotate armadillo-3.900.4/include/armadillo_bits/fn_ones.hpp @ 84:55a047986812 tip

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