$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 00020 template<typename eT> 00021 class subview_cube : public BaseCube<eT, subview_cube<eT> > 00022 { 00023 public: arma_aligned const Cube<eT>& m; 00024 protected: arma_aligned Cube<eT>* m_ptr; 00025 00026 public: 00027 00028 typedef eT elem_type; 00029 typedef typename get_pod_type<elem_type>::result pod_type; 00030 00031 const uword aux_row1; 00032 const uword aux_col1; 00033 const uword aux_slice1; 00034 00035 const uword n_rows; 00036 const uword n_cols; 00037 const uword n_elem_slice; 00038 const uword n_slices; 00039 const uword n_elem; 00040 00041 00042 protected: 00043 00044 arma_inline subview_cube(const Cube<eT>& in_m, const uword in_row1, const uword in_col1, const uword in_slice1, const uword in_n_rows, const uword in_n_cols, const uword in_n_slices); 00045 arma_inline subview_cube( Cube<eT>& in_m, const uword in_row1, const uword in_col1, const uword in_slice1, const uword in_n_rows, const uword in_n_cols, const uword in_n_slices); 00046 00047 00048 public: 00049 00050 inline ~subview_cube(); 00051 00052 inline void operator+= (const eT val); 00053 inline void operator-= (const eT val); 00054 inline void operator*= (const eT val); 00055 inline void operator/= (const eT val); 00056 00057 // deliberately returning void 00058 template<typename T1> inline void operator= (const BaseCube<eT,T1>& x); 00059 template<typename T1> inline void operator+= (const BaseCube<eT,T1>& x); 00060 template<typename T1> inline void operator-= (const BaseCube<eT,T1>& x); 00061 template<typename T1> inline void operator%= (const BaseCube<eT,T1>& x); 00062 template<typename T1> inline void operator/= (const BaseCube<eT,T1>& x); 00063 00064 inline void operator= (const subview_cube& x); 00065 inline void operator+= (const subview_cube& x); 00066 inline void operator-= (const subview_cube& x); 00067 inline void operator%= (const subview_cube& x); 00068 inline void operator/= (const subview_cube& x); 00069 00070 template<typename T1> inline void operator= (const Base<eT,T1>& x); 00071 template<typename T1> inline void operator+= (const Base<eT,T1>& x); 00072 template<typename T1> inline void operator-= (const Base<eT,T1>& x); 00073 template<typename T1> inline void operator%= (const Base<eT,T1>& x); 00074 template<typename T1> inline void operator/= (const Base<eT,T1>& x); 00075 00076 inline static void extract(Cube<eT>& out, const subview_cube& in); 00077 inline static void plus_inplace(Cube<eT>& out, const subview_cube& in); 00078 inline static void minus_inplace(Cube<eT>& out, const subview_cube& in); 00079 inline static void schur_inplace(Cube<eT>& out, const subview_cube& in); 00080 inline static void div_inplace(Cube<eT>& out, const subview_cube& in); 00081 00082 inline static void extract(Mat<eT>& out, const subview_cube& in); 00083 inline static void plus_inplace(Mat<eT>& out, const subview_cube& in); 00084 inline static void minus_inplace(Mat<eT>& out, const subview_cube& in); 00085 inline static void schur_inplace(Mat<eT>& out, const subview_cube& in); 00086 inline static void div_inplace(Mat<eT>& out, const subview_cube& in); 00087 00088 inline void fill(const eT val); 00089 inline void zeros(); 00090 inline void ones(); 00091 00092 inline eT& operator[](const uword i); 00093 inline eT operator[](const uword i) const; 00094 00095 inline eT& operator()(const uword i); 00096 inline eT operator()(const uword i) const; 00097 00098 arma_inline eT& operator()(const uword in_row, const uword in_col, const uword in_slice); 00099 arma_inline eT operator()(const uword in_row, const uword in_col, const uword in_slice) const; 00100 00101 arma_inline eT& at(const uword in_row, const uword in_col, const uword in_slice); 00102 arma_inline eT at(const uword in_row, const uword in_col, const uword in_slice) const; 00103 00104 arma_inline eT* slice_colptr(const uword in_slice, const uword in_col); 00105 arma_inline const eT* slice_colptr(const uword in_slice, const uword in_col) const; 00106 00107 inline bool check_overlap(const subview_cube& x) const; 00108 inline bool check_overlap(const Mat<eT>& x) const; 00109 00110 00111 private: 00112 00113 friend class Mat<eT>; 00114 friend class Cube<eT>; 00115 00116 subview_cube(); 00117 }; 00118 00119 00120