operator_cube_times.hpp

Go to the documentation of this file.
00001 // Copyright (C) 2009 NICTA
00002 // 
00003 // Authors:
00004 // - Conrad Sanderson (conradsand at ieee dot org)
00005 // 
00006 // This file is part of the Armadillo C++ library.
00007 // It is provided without any warranty of fitness
00008 // for any purpose. You can redistribute this file
00009 // and/or modify it under the terms of the GNU
00010 // Lesser General Public License (LGPL) as published
00011 // by the Free Software Foundation, either version 3
00012 // of the License or (at your option) any later version.
00013 // (see http://www.opensource.org/licenses for more info)
00014 
00015 
00016 
00017 
00018 //! \addtogroup operator_cube_times
00019 //! @{
00020 
00021 
00022 
00023 //! BaseCube * scalar
00024 template<typename T1>
00025 arma_inline
00026 const OpCube<T1, op_scalar_times>
00027 operator*
00028 (const BaseCube<typename T1::elem_type,T1>& X, const typename T1::elem_type k)
00029   {
00030   arma_extra_debug_sigprint();
00031   
00032   return OpCube<T1, op_scalar_times>(X.get_ref(),k);
00033   }
00034 
00035 
00036 
00037 //! op * scalar, level 2
00038 template<typename T1>
00039 arma_inline
00040 const OpCube<T1,op_scalar_times>
00041 operator*
00042 (const OpCube<T1,op_scalar_times>& X, const typename T1::elem_type k)
00043   {
00044   arma_extra_debug_sigprint();
00045   
00046   return OpCube<T1, op_scalar_times>(X.m, X.aux * k);
00047   }
00048 
00049 
00050 
00051 //! OpCube<cube,op_ones_full> * scalar
00052 template<typename eT>
00053 arma_inline
00054 Cube<eT>
00055 operator*
00056 (const OpCube<Cube<eT>,op_ones_full>& X, const eT k)
00057   {
00058   arma_extra_debug_sigprint();
00059     
00060   Cube<eT> tmp(X.aux_u32_a, X.aux_u32_b, X.aux_u32_c);
00061   tmp.fill(k);
00062   
00063   return tmp;
00064   }
00065 
00066 
00067 
00068 //! scalar * Base
00069 template<typename T1>
00070 arma_inline
00071 const OpCube<T1, op_scalar_times>
00072 operator*
00073 (const typename T1::elem_type k, const BaseCube<typename T1::elem_type,T1>& X)
00074   {
00075   arma_extra_debug_sigprint();
00076   
00077   return OpCube<T1, op_scalar_times>(X.get_ref(),k);  // NOTE: order is swapped
00078   }
00079 
00080 
00081 
00082 //! scalar * OpCube<cube,op_ones_full>
00083 template<typename eT>
00084 arma_inline
00085 Cube<eT>
00086 operator*
00087 (const eT k, const OpCube<Cube<eT>,op_ones_full>& X)
00088   {
00089   arma_extra_debug_sigprint();
00090     
00091   Cube<eT> tmp(X.aux_u32_a, X.aux_u32_b, X.aux_u32_c);
00092   tmp.fill(k);
00093   
00094   return tmp;
00095   }
00096 
00097 
00098 
00099 //! @}