diagview_proto.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 //! \addtogroup diagview
00017 //! @{
00018 
00019 
00020 //! Class for storing data required to extract and set the diagonals of a matrix
00021 template<typename eT>
00022 class diagview : public Base<eT, diagview<eT> >
00023   {
00024   public:   const Mat<eT>& m;
00025   protected:      Mat<eT>* m_ptr;
00026   
00027   public:
00028   
00029   typedef eT elem_type;
00030   typedef typename get_pod_type<elem_type>::pod_type pod_type;
00031 
00032   const u32 row_offset;
00033   const u32 col_offset;
00034   const u32 n_elem;
00035   
00036   
00037   protected:
00038   
00039   arma_inline diagview(const Mat<eT>& in_m, const u32 in_row_offset, const u32 in_col_offset, const u32 len);
00040   arma_inline diagview(      Mat<eT>& in_m, const u32 in_row_offset, const u32 in_col_offset, const u32 len);
00041   
00042   
00043   public:
00044   
00045   inline ~diagview();
00046   
00047   template<typename T1>
00048   inline void operator=(const Base<eT,T1>& x);
00049   
00050   inline void operator=(const diagview& x);
00051   
00052   arma_inline eT& operator[](const u32 i);
00053   arma_inline eT  operator[](const u32 i) const;
00054   
00055   arma_inline eT& operator()(const u32 i);
00056   arma_inline eT  operator()(const u32 i) const;
00057 
00058 //   arma_inline double& at(const u32 in_n_row, in_n_col);
00059 //   arma_inline double  at(const u32 in_n_row, in_n_col) const;
00060 //    
00061 //   arma_inline double& operator()(const u32 in_n_row, in_n_col);
00062 //   arma_inline double  operator()(const u32 in_n_row, in_n_col) const;
00063   
00064   inline void fill(const eT val);
00065   inline void zeros();
00066   
00067   inline static void extract(Mat<eT>& out, const diagview& in);
00068   
00069   
00070   private:
00071   
00072   friend class Mat<eT>;
00073   diagview();
00074   //diagview(const diagview&);  // making this private causes an error under gcc 4.1/4.2, but not 4.3
00075   };
00076 
00077 
00078 //! @}