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 diagview max@0: //! @{ max@0: max@0: max@0: //! Class for storing data required to extract and set the diagonals of a matrix max@0: template max@0: class diagview : public Base > max@0: { max@0: public: arma_aligned const Mat& m; max@0: protected: arma_aligned Mat* 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 row_offset; max@0: const uword col_offset; max@0: max@0: const uword n_rows; // equal to n_elem max@0: const uword n_elem; max@0: max@0: static const uword n_cols = 1; max@0: max@0: max@0: protected: max@0: max@0: arma_inline diagview(const Mat& in_m, const uword in_row_offset, const uword in_col_offset, const uword len); max@0: arma_inline diagview( Mat& in_m, const uword in_row_offset, const uword in_col_offset, const uword len); max@0: max@0: max@0: public: max@0: max@0: inline ~diagview(); max@0: max@0: inline void operator=(const diagview& x); 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: 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: max@0: arma_inline eT& operator[](const uword i); max@0: arma_inline eT operator[](const uword i) const; max@0: max@0: arma_inline eT& at(const uword i); max@0: arma_inline eT at(const uword i) const; max@0: max@0: arma_inline eT& operator()(const uword i); max@0: arma_inline eT operator()(const uword i) const; max@0: max@0: arma_inline eT& at(const uword in_n_row, const uword in_n_col); max@0: arma_inline eT at(const uword in_n_row, const uword in_n_col) const; max@0: max@0: arma_inline eT& operator()(const uword in_n_row, const uword in_n_col); max@0: arma_inline eT operator()(const uword in_n_row, const uword in_n_col) const; max@0: 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 static void extract(Mat& out, const diagview& in); max@0: max@0: inline static void plus_inplace(Mat& out, const diagview& in); max@0: inline static void minus_inplace(Mat& out, const diagview& in); max@0: inline static void schur_inplace(Mat& out, const diagview& in); max@0: inline static void div_inplace(Mat& out, const diagview& in); max@0: max@0: max@0: private: max@0: max@0: friend class Mat; max@0: friend class subview; max@0: max@0: diagview(); max@0: //diagview(const diagview&); // making this private causes an error under gcc 4.1/4.2, but not 4.3 max@0: }; max@0: max@0: max@0: //! @}