fn_zeros.hpp

Go to the documentation of this file.
00001 // Copyright (C) 2010 NICTA and the authors listed below
00002 // http://nicta.com.au
00003 // 
00004 // Authors:
00005 // - Conrad Sanderson (conradsand at ieee dot org)
00006 // 
00007 // This file is part of the Armadillo C++ library.
00008 // It is provided without any warranty of fitness
00009 // for any purpose. You can redistribute this file
00010 // and/or modify it under the terms of the GNU
00011 // Lesser General Public License (LGPL) as published
00012 // by the Free Software Foundation, either version 3
00013 // of the License or (at your option) any later version.
00014 // (see http://www.opensource.org/licenses for more info)
00015 
00016 
00017 //! \addtogroup fn_zeros
00018 //! @{
00019 
00020 
00021 //! Generate a dense matrix with all elements set to zero
00022 arma_inline
00023 const eOp<mat, eop_zeros>
00024 zeros(const u32 n_rows, const u32 n_cols)
00025   {
00026   arma_extra_debug_sigprint();
00027   
00028   return eOp<mat, eop_zeros>(n_rows, n_cols);
00029   }
00030 
00031 
00032 
00033 arma_inline
00034 const eOpCube<cube, eop_cube_zeros>
00035 zeros(const u32 n_rows, const u32 n_cols, const u32 n_slices)
00036   {
00037   arma_extra_debug_sigprint();
00038   
00039   return eOpCube<cube, eop_cube_zeros>(n_rows, n_cols, n_slices);
00040   }
00041 
00042 
00043 
00044 template<typename mat_type>
00045 arma_inline
00046 const eOp<mat_type, eop_zeros>
00047 zeros(const u32 n_rows, const u32 n_cols)
00048   {
00049   arma_extra_debug_sigprint();
00050   
00051   arma_type_check<is_Mat<mat_type>::value == false>::apply();
00052   
00053   return eOp<mat_type, eop_zeros>(n_rows, n_cols);
00054   }
00055 
00056 
00057 
00058 template<typename cube_type>
00059 arma_inline
00060 const eOpCube<cube_type, eop_cube_zeros>
00061 zeros(const u32 n_rows, const u32 n_cols, const u32 n_slices)
00062   {
00063   arma_extra_debug_sigprint();
00064   
00065   arma_type_check<is_Cube<cube_type>::value == false>::apply();
00066   
00067   return eOpCube<cube_type, eop_cube_zeros>(n_rows, n_cols, n_slices);
00068   }
00069 
00070 
00071 
00072 //! Generate a vector with all elements set to zero
00073 arma_inline
00074 const eOp<colvec, eop_zeros>
00075 zeros(const u32 n_elem)
00076   {
00077   arma_extra_debug_sigprint();
00078   
00079   return eOp<colvec, eop_zeros>(n_elem, 1);
00080   }
00081 
00082 
00083 
00084 template<typename vec_type>
00085 arma_inline
00086 const eOp<vec_type, eop_zeros>
00087 zeros(const u32 n_elem)
00088   {
00089   arma_extra_debug_sigprint();
00090   
00091   arma_type_check< (is_Col<vec_type>::value == false) && (is_Row<vec_type>::value == false) >::apply();
00092   
00093   if(is_Row<vec_type>::value == true)
00094     {
00095     return eOp<vec_type, eop_zeros>(1, n_elem);
00096     }
00097   else
00098     {
00099     return eOp<vec_type, eop_zeros>(n_elem, 1);
00100     }
00101   }
00102 
00103 
00104 
00105 //! @}