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 vector with all elements set to zero
00022 arma_inline
00023 const eOp<colvec, eop_zeros>
00024 zeros(const u32 n_elem, const arma_Mat_Col_Row_only<colvec>::result* junk = 0)
00025   {
00026   arma_extra_debug_sigprint();
00027   
00028   return eOp<colvec, eop_zeros>(n_elem, 1);
00029   }
00030 
00031 
00032 
00033 template<typename vec_type>
00034 arma_inline
00035 const eOp<vec_type, eop_zeros>
00036 zeros(const u32 n_elem, const typename arma_Mat_Col_Row_only<vec_type>::result* junk = 0)
00037   {
00038   arma_extra_debug_sigprint();
00039   
00040   if(is_Row<vec_type>::value == true)
00041     {
00042     return eOp<vec_type, eop_zeros>(1, n_elem);
00043     }
00044   else
00045     {
00046     return eOp<vec_type, eop_zeros>(n_elem, 1);
00047     }
00048   }
00049 
00050 
00051 
00052 //! Generate a dense matrix with all elements set to zero
00053 arma_inline
00054 const eOp<mat, eop_zeros>
00055 zeros(const u32 n_rows, const u32 n_cols, const arma_Mat_Col_Row_only<mat>::result* junk = 0)
00056   {
00057   arma_extra_debug_sigprint();
00058   
00059   return eOp<mat, eop_zeros>(n_rows, n_cols);
00060   }
00061 
00062 
00063 
00064 template<typename mat_type>
00065 arma_inline
00066 const eOp<mat_type, eop_zeros>
00067 zeros(const u32 n_rows, const u32 n_cols, const typename arma_Mat_Col_Row_only<mat_type>::result* junk = 0)
00068   {
00069   arma_extra_debug_sigprint();
00070   
00071   arma_type_check<is_Mat<mat_type>::value == false>::apply();
00072   
00073   return eOp<mat_type, eop_zeros>(n_rows, n_cols);
00074   }
00075 
00076 
00077 
00078 arma_inline
00079 const eOpCube<cube, eop_cube_zeros>
00080 zeros(const u32 n_rows, const u32 n_cols, const u32 n_slices, const arma_Cube_only<cube>::result* junk = 0)
00081   {
00082   arma_extra_debug_sigprint();
00083   
00084   return eOpCube<cube, eop_cube_zeros>(n_rows, n_cols, n_slices);
00085   }
00086 
00087 
00088 
00089 template<typename cube_type>
00090 arma_inline
00091 const eOpCube<cube_type, eop_cube_zeros>
00092 zeros(const u32 n_rows, const u32 n_cols, const u32 n_slices, const typename arma_Cube_only<cube_type>::result* junk = 0)
00093   {
00094   arma_extra_debug_sigprint();
00095   
00096   arma_type_check<is_Cube<cube_type>::value == false>::apply();
00097   
00098   return eOpCube<cube_type, eop_cube_zeros>(n_rows, n_cols, n_slices);
00099   }
00100 
00101 
00102 
00103 //! @}