max@0: // Copyright (C) 2008-2011 NICTA (www.nicta.com.au) max@0: // Copyright (C) 2008-2011 Conrad Sanderson max@0: // max@0: // This file is part of the Armadillo C++ library. max@0: // It is provided without any warranty of fitness max@0: // for any purpose. You can redistribute this file max@0: // and/or modify it under the terms of the GNU max@0: // Lesser General Public License (LGPL) as published max@0: // by the Free Software Foundation, either version 3 max@0: // of the License or (at your option) any later version. max@0: // (see http://www.opensource.org/licenses for more info) max@0: max@0: max@0: //! \addtogroup subview_cube max@0: //! @{ max@0: max@0: max@0: //! Class for storing data required to construct or apply operations to a subcube max@0: //! (i.e. where the subcube starts and ends as well as a reference/pointer to the original cube), max@0: template max@0: class subview_cube : public BaseCube > max@0: { max@0: public: arma_aligned const Cube& m; max@0: protected: arma_aligned Cube* m_ptr; max@0: max@0: public: max@0: max@0: typedef eT elem_type; max@0: typedef typename get_pod_type::result pod_type; max@0: max@0: const uword aux_row1; max@0: const uword aux_col1; max@0: const uword aux_slice1; max@0: max@0: const uword n_rows; max@0: const uword n_cols; max@0: const uword n_elem_slice; max@0: const uword n_slices; max@0: const uword n_elem; max@0: max@0: max@0: protected: max@0: max@0: arma_inline subview_cube(const Cube& 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); max@0: arma_inline subview_cube( Cube& 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); max@0: max@0: max@0: public: max@0: max@0: inline ~subview_cube(); max@0: max@0: inline void operator+= (const eT val); max@0: inline void operator-= (const eT val); max@0: inline void operator*= (const eT val); max@0: inline void operator/= (const eT val); max@0: max@0: // deliberately returning void max@0: template inline void operator= (const BaseCube& x); max@0: template inline void operator+= (const BaseCube& x); max@0: template inline void operator-= (const BaseCube& x); max@0: template inline void operator%= (const BaseCube& x); max@0: template inline void operator/= (const BaseCube& x); max@0: max@0: inline void operator= (const subview_cube& x); max@0: inline void operator+= (const subview_cube& x); max@0: inline void operator-= (const subview_cube& x); max@0: inline void operator%= (const subview_cube& x); max@0: inline void operator/= (const subview_cube& x); max@0: max@0: template inline void operator= (const Base& x); max@0: template inline void operator+= (const Base& x); max@0: template inline void operator-= (const Base& x); max@0: template inline void operator%= (const Base& x); max@0: template inline void operator/= (const Base& x); max@0: max@0: inline static void extract(Cube& out, const subview_cube& in); max@0: inline static void plus_inplace(Cube& out, const subview_cube& in); max@0: inline static void minus_inplace(Cube& out, const subview_cube& in); max@0: inline static void schur_inplace(Cube& out, const subview_cube& in); max@0: inline static void div_inplace(Cube& out, const subview_cube& in); max@0: max@0: inline static void extract(Mat& out, const subview_cube& in); max@0: inline static void plus_inplace(Mat& out, const subview_cube& in); max@0: inline static void minus_inplace(Mat& out, const subview_cube& in); max@0: inline static void schur_inplace(Mat& out, const subview_cube& in); max@0: inline static void div_inplace(Mat& out, const subview_cube& in); max@0: max@0: inline void fill(const eT val); max@0: inline void zeros(); max@0: inline void ones(); max@0: max@0: inline eT& operator[](const uword i); max@0: inline eT operator[](const uword i) const; max@0: max@0: inline eT& operator()(const uword i); max@0: inline eT operator()(const uword i) const; max@0: max@0: arma_inline eT& operator()(const uword in_row, const uword in_col, const uword in_slice); max@0: arma_inline eT operator()(const uword in_row, const uword in_col, const uword in_slice) const; max@0: max@0: arma_inline eT& at(const uword in_row, const uword in_col, const uword in_slice); max@0: arma_inline eT at(const uword in_row, const uword in_col, const uword in_slice) const; max@0: max@0: arma_inline eT* slice_colptr(const uword in_slice, const uword in_col); max@0: arma_inline const eT* slice_colptr(const uword in_slice, const uword in_col) const; max@0: max@0: inline bool check_overlap(const subview_cube& x) const; max@0: inline bool check_overlap(const Mat& x) const; max@0: max@0: max@0: private: max@0: max@0: friend class Mat; max@0: friend class Cube; max@0: max@0: subview_cube(); max@0: }; max@0: max@0: max@0: max@0: //! @}