fn_randu.hpp
Go to the documentation of this file.
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 inline
00019 double
00020 randu()
00021   {
00022   return double(eop_aux_randu<double>());
00023   }
00024 
00025 
00026 template<typename eT>
00027 inline
00028 typename arma_scalar_only<eT>::result
00029 randu()
00030   {
00031   return eT(eop_aux_randu<eT>());
00032   }
00033 
00034 
00035 
00037 arma_inline
00038 const Gen<vec::elem_type, gen_randu>
00039 randu(const uword n_elem)
00040   {
00041   arma_extra_debug_sigprint();
00042   
00043   return Gen<vec::elem_type, gen_randu>(n_elem, 1);
00044   }
00045 
00046 
00047 
00048 template<typename vec_type>
00049 arma_inline
00050 const Gen<typename vec_type::elem_type, gen_randu>
00051 randu(const uword n_elem, const arma_empty_class junk1 = arma_empty_class(), const typename arma_Mat_Col_Row_only<vec_type>::result* junk2 = 0)
00052   {
00053   arma_extra_debug_sigprint();
00054   arma_ignore(junk1);
00055   arma_ignore(junk2);
00056   
00057   if(is_Row<vec_type>::value == true)
00058     {
00059     return Gen<typename vec_type::elem_type, gen_randu>(1, n_elem);
00060     }
00061   else
00062     {
00063     return Gen<typename vec_type::elem_type, gen_randu>(n_elem, 1);
00064     }
00065   }
00066 
00067 
00068 
00070 arma_inline
00071 const Gen<mat::elem_type, gen_randu>
00072 randu(const uword n_rows, const uword n_cols)
00073   {
00074   arma_extra_debug_sigprint();
00075   
00076   return Gen<mat::elem_type, gen_randu>(n_rows, n_cols);
00077   }
00078 
00079 
00080 
00081 template<typename mat_type>
00082 arma_inline
00083 const Gen<typename mat_type::elem_type, gen_randu>
00084 randu(const uword n_rows, const uword n_cols, const typename arma_Mat_Col_Row_only<mat_type>::result* junk = 0)
00085   {
00086   arma_extra_debug_sigprint();
00087   arma_ignore(junk);
00088   
00089   return Gen<typename mat_type::elem_type, gen_randu>(n_rows, n_cols);
00090   }
00091 
00092 
00093 
00094 arma_inline
00095 const GenCube<cube::elem_type, gen_randu>
00096 randu(const uword n_rows, const uword n_cols, const uword n_slices)
00097   {
00098   arma_extra_debug_sigprint();
00099   
00100   return GenCube<cube::elem_type, gen_randu>(n_rows, n_cols, n_slices);
00101   }
00102 
00103 
00104 
00105 template<typename cube_type>
00106 arma_inline
00107 const GenCube<typename cube_type::elem_type, gen_randu>
00108 randu(const uword n_rows, const uword n_cols, const uword n_slices, const typename arma_Cube_only<cube_type>::result* junk = 0)
00109   {
00110   arma_extra_debug_sigprint();
00111   arma_ignore(junk);
00112   
00113   return GenCube<typename cube_type::elem_type, gen_randu>(n_rows, n_cols, n_slices);
00114   }
00115 
00116 
00117 


armadillo_matrix
Author(s): Conrad Sanderson - NICTA (www.nicta.com.au), (Wrapper by Sjoerd van den Dries)
autogenerated on Tue Jan 7 2014 11:42:04