$search
00001 // Copyright (C) 2008-2011 NICTA (www.nicta.com.au) 00002 // Copyright (C) 2008-2011 Conrad Sanderson 00003 // 00004 // This file is part of the Armadillo C++ library. 00005 // It is provided without any warranty of fitness 00006 // for any purpose. You can redistribute this file 00007 // and/or modify it under the terms of the GNU 00008 // Lesser General Public License (LGPL) as published 00009 // by the Free Software Foundation, either version 3 00010 // of the License or (at your option) any later version. 00011 // (see http://www.opensource.org/licenses for more info) 00012 00013 00016 00017 00018 00019 arma_inline 00020 const Gen<vec::elem_type, gen_ones_full> 00021 ones(const uword n_elem) 00022 { 00023 arma_extra_debug_sigprint(); 00024 00025 return Gen<vec::elem_type, gen_ones_full>(n_elem, 1); 00026 } 00027 00028 00029 00030 template<typename vec_type> 00031 arma_inline 00032 const Gen<typename vec_type::elem_type, gen_ones_full> 00033 ones(const uword n_elem, const arma_empty_class junk1 = arma_empty_class(), const typename arma_Mat_Col_Row_only<vec_type>::result* junk2 = 0) 00034 { 00035 arma_extra_debug_sigprint(); 00036 arma_ignore(junk1); 00037 arma_ignore(junk2); 00038 00039 if(is_Row<vec_type>::value == true) 00040 { 00041 return Gen<typename vec_type::elem_type, gen_ones_full>(1, n_elem); 00042 } 00043 else 00044 { 00045 return Gen<typename vec_type::elem_type, gen_ones_full>(n_elem, 1); 00046 } 00047 } 00048 00049 00050 00051 arma_inline 00052 const Gen<mat::elem_type, gen_ones_full> 00053 ones(const uword n_rows, const uword n_cols) 00054 { 00055 arma_extra_debug_sigprint(); 00056 00057 return Gen<mat::elem_type, gen_ones_full>(n_rows, n_cols); 00058 } 00059 00060 00061 00062 template<typename mat_type> 00063 arma_inline 00064 const Gen<typename mat_type::elem_type, gen_ones_full> 00065 ones(const uword n_rows, const uword n_cols, const typename arma_Mat_Col_Row_only<mat_type>::result* junk = 0) 00066 { 00067 arma_extra_debug_sigprint(); 00068 arma_ignore(junk); 00069 00070 return Gen<typename mat_type::elem_type, gen_ones_full>(n_rows, n_cols); 00071 } 00072 00073 00074 00075 arma_inline 00076 const GenCube<cube::elem_type, gen_ones_full> 00077 ones(const uword n_rows, const uword n_cols, const uword n_slices) 00078 { 00079 arma_extra_debug_sigprint(); 00080 00081 return GenCube<cube::elem_type, gen_ones_full>(n_rows, n_cols, n_slices); 00082 } 00083 00084 00085 00086 template<typename cube_type> 00087 arma_inline 00088 const GenCube<typename cube_type::elem_type, gen_ones_full> 00089 ones(const uword n_rows, const uword n_cols, const uword n_slices, const typename arma_Cube_only<cube_type>::result* junk = 0) 00090 { 00091 arma_extra_debug_sigprint(); 00092 arma_ignore(junk); 00093 00094 return GenCube<typename cube_type::elem_type, gen_ones_full>(n_rows, n_cols, n_slices); 00095 } 00096 00097 00098