$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 00019 template<typename eT> 00020 class diagview : public Base<eT, diagview<eT> > 00021 { 00022 public: arma_aligned const Mat<eT>& m; 00023 protected: arma_aligned Mat<eT>* m_ptr; 00024 00025 public: 00026 00027 typedef eT elem_type; 00028 typedef typename get_pod_type<eT>::result pod_type; 00029 00030 const uword row_offset; 00031 const uword col_offset; 00032 00033 const uword n_rows; // equal to n_elem 00034 const uword n_elem; 00035 00036 static const uword n_cols = 1; 00037 00038 00039 protected: 00040 00041 arma_inline diagview(const Mat<eT>& in_m, const uword in_row_offset, const uword in_col_offset, const uword len); 00042 arma_inline diagview( Mat<eT>& in_m, const uword in_row_offset, const uword in_col_offset, const uword len); 00043 00044 00045 public: 00046 00047 inline ~diagview(); 00048 00049 inline void operator=(const diagview& x); 00050 00051 inline void operator+=(const eT val); 00052 inline void operator-=(const eT val); 00053 inline void operator*=(const eT val); 00054 inline void operator/=(const eT val); 00055 00056 template<typename T1> inline void operator= (const Base<eT,T1>& x); 00057 template<typename T1> inline void operator+=(const Base<eT,T1>& x); 00058 template<typename T1> inline void operator-=(const Base<eT,T1>& x); 00059 template<typename T1> inline void operator%=(const Base<eT,T1>& x); 00060 template<typename T1> inline void operator/=(const Base<eT,T1>& x); 00061 00062 00063 arma_inline eT& operator[](const uword i); 00064 arma_inline eT operator[](const uword i) const; 00065 00066 arma_inline eT& at(const uword i); 00067 arma_inline eT at(const uword i) const; 00068 00069 arma_inline eT& operator()(const uword i); 00070 arma_inline eT operator()(const uword i) const; 00071 00072 arma_inline eT& at(const uword in_n_row, const uword in_n_col); 00073 arma_inline eT at(const uword in_n_row, const uword in_n_col) const; 00074 00075 arma_inline eT& operator()(const uword in_n_row, const uword in_n_col); 00076 arma_inline eT operator()(const uword in_n_row, const uword in_n_col) const; 00077 00078 00079 inline void fill(const eT val); 00080 inline void zeros(); 00081 inline void ones(); 00082 00083 inline static void extract(Mat<eT>& out, const diagview& in); 00084 00085 inline static void plus_inplace(Mat<eT>& out, const diagview& in); 00086 inline static void minus_inplace(Mat<eT>& out, const diagview& in); 00087 inline static void schur_inplace(Mat<eT>& out, const diagview& in); 00088 inline static void div_inplace(Mat<eT>& out, const diagview& in); 00089 00090 00091 private: 00092 00093 friend class Mat<eT>; 00094 friend class subview<eT>; 00095 00096 diagview(); 00097 //diagview(const diagview&); // making this private causes an error under gcc 4.1/4.2, but not 4.3 00098 }; 00099 00100