Mat_bones.hpp
Go to the documentation of this file.
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 
00018 
00020 
00021 template<typename eT>
00022 class Mat : public Base< eT, Mat<eT> >
00023   {
00024   public:
00025   
00026   typedef eT                                elem_type;  
00027   typedef typename get_pod_type<eT>::result pod_type;   
00028   
00029   const uword  n_rows;    
00030   const uword  n_cols;    
00031   const uword  n_elem;    
00032   const uhword vec_state; 
00033   const uhword mem_state;
00034   
00035   // mem_state = 0: normal matrix that can be resized; 
00036   // mem_state = 1: use auxiliary memory until change in the number of elements is requested;  
00037   // mem_state = 2: use auxiliary memory and don't allow the number of elements to be changed; 
00038   // mem_state = 3: fixed size (e.g. via template based size specification).
00039   
00040   arma_aligned const eT* const mem;  
00041   
00042   protected:
00043   arma_aligned eT mem_local[ arma_config::mat_prealloc ];
00044   
00045   
00046   public:
00047   
00048   inline ~Mat();
00049   inline  Mat();
00050   
00051   inline Mat(const uword in_rows, const uword in_cols);
00052   
00053   inline                  Mat(const char*        text);
00054   inline const Mat& operator=(const char*        text);
00055   
00056   inline                  Mat(const std::string& text);
00057   inline const Mat& operator=(const std::string& text);
00058   
00059   #if defined(ARMA_USE_CXX11)
00060   inline                  Mat(const std::initializer_list<eT>& list);
00061   inline const Mat& operator=(const std::initializer_list<eT>& list);
00062   #endif
00063   
00064   inline Mat(      eT* aux_mem, const uword aux_n_rows, const uword aux_n_cols, const bool copy_aux_mem = true, const bool strict = true);
00065   inline Mat(const eT* aux_mem, const uword aux_n_rows, const uword aux_n_cols);
00066   
00067   arma_inline const Mat&  operator=(const eT val);
00068   arma_inline const Mat& operator+=(const eT val);
00069   arma_inline const Mat& operator-=(const eT val);
00070   arma_inline const Mat& operator*=(const eT val);
00071   arma_inline const Mat& operator/=(const eT val);
00072   
00073   inline                   Mat(const Mat& m);
00074   inline const Mat&  operator=(const Mat& m);
00075   inline const Mat& operator+=(const Mat& m);
00076   inline const Mat& operator-=(const Mat& m);
00077   inline const Mat& operator*=(const Mat& m);
00078   inline const Mat& operator%=(const Mat& m);
00079   inline const Mat& operator/=(const Mat& m);
00080   
00081   template<typename T1> inline                   Mat(const BaseCube<eT,T1>& X);
00082   template<typename T1> inline const Mat&  operator=(const BaseCube<eT,T1>& X);
00083   template<typename T1> inline const Mat& operator+=(const BaseCube<eT,T1>& X);
00084   template<typename T1> inline const Mat& operator-=(const BaseCube<eT,T1>& X);
00085   template<typename T1> inline const Mat& operator*=(const BaseCube<eT,T1>& X);
00086   template<typename T1> inline const Mat& operator%=(const BaseCube<eT,T1>& X);
00087   template<typename T1> inline const Mat& operator/=(const BaseCube<eT,T1>& X);
00088   
00089   template<typename T1, typename T2>
00090   inline explicit Mat(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B);
00091 
00092   inline                   Mat(const subview<eT>& X);
00093   inline const Mat&  operator=(const subview<eT>& X);
00094   inline const Mat& operator+=(const subview<eT>& X);
00095   inline const Mat& operator-=(const subview<eT>& X);
00096   inline const Mat& operator*=(const subview<eT>& X);
00097   inline const Mat& operator%=(const subview<eT>& X);
00098   inline const Mat& operator/=(const subview<eT>& X);
00099 
00100   //inline explicit          Mat(const subview_cube<eT>& X);
00101   inline                   Mat(const subview_cube<eT>& X);
00102   inline const Mat&  operator=(const subview_cube<eT>& X);
00103   inline const Mat& operator+=(const subview_cube<eT>& X);
00104   inline const Mat& operator-=(const subview_cube<eT>& X);
00105   inline const Mat& operator*=(const subview_cube<eT>& X);
00106   inline const Mat& operator%=(const subview_cube<eT>& X);
00107   inline const Mat& operator/=(const subview_cube<eT>& X);
00108 
00109   //inline explicit          Mat(const diagview<eT>& X);
00110   inline                   Mat(const diagview<eT>& X);
00111   inline const Mat&  operator=(const diagview<eT>& X);
00112   inline const Mat& operator+=(const diagview<eT>& X);
00113   inline const Mat& operator-=(const diagview<eT>& X);
00114   inline const Mat& operator*=(const diagview<eT>& X);
00115   inline const Mat& operator%=(const diagview<eT>& X);
00116   inline const Mat& operator/=(const diagview<eT>& X);
00117   
00118   template<typename T1> inline                   Mat(const subview_elem1<eT,T1>& X);
00119   template<typename T1> inline const Mat& operator= (const subview_elem1<eT,T1>& X);
00120   template<typename T1> inline const Mat& operator+=(const subview_elem1<eT,T1>& X);
00121   template<typename T1> inline const Mat& operator-=(const subview_elem1<eT,T1>& X);
00122   template<typename T1> inline const Mat& operator*=(const subview_elem1<eT,T1>& X);
00123   template<typename T1> inline const Mat& operator%=(const subview_elem1<eT,T1>& X);
00124   template<typename T1> inline const Mat& operator/=(const subview_elem1<eT,T1>& X);
00125   
00126   
00127   inline mat_injector<Mat> operator<<(const eT val);
00128   inline mat_injector<Mat> operator<<(const injector_end_of_row& x);
00129   
00130   
00131   arma_inline       subview_row<eT> row(const uword row_num);
00132   arma_inline const subview_row<eT> row(const uword row_num) const;
00133   
00134   inline            subview_row<eT> operator()(const uword row_num, const span& col_span);
00135   inline      const subview_row<eT> operator()(const uword row_num, const span& col_span) const;
00136   
00137   
00138   arma_inline       subview_col<eT> col(const uword col_num);
00139   arma_inline const subview_col<eT> col(const uword col_num) const;
00140   
00141   inline            subview_col<eT> operator()(const span& row_span, const uword col_num);
00142   inline      const subview_col<eT> operator()(const span& row_span, const uword col_num) const;
00143   
00144   inline            Col<eT>  unsafe_col(const uword col_num);
00145   inline      const Col<eT>  unsafe_col(const uword col_num) const;
00146   
00147   
00148   arma_inline       subview<eT> rows(const uword in_row1, const uword in_row2);
00149   arma_inline const subview<eT> rows(const uword in_row1, const uword in_row2) const;
00150   
00151   arma_inline       subview<eT> cols(const uword in_col1, const uword in_col2);
00152   arma_inline const subview<eT> cols(const uword in_col1, const uword in_col2) const;
00153   
00154   arma_inline       subview<eT> submat(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2);
00155   arma_inline const subview<eT> submat(const uword in_row1, const uword in_col1, const uword in_row2, const uword in_col2) const;
00156   
00157   
00158   inline            subview<eT> submat    (const span& row_span, const span& col_span);
00159   inline      const subview<eT> submat    (const span& row_span, const span& col_span) const;
00160   
00161   inline            subview<eT> operator()(const span& row_span, const span& col_span);
00162   inline      const subview<eT> operator()(const span& row_span, const span& col_span) const;
00163   
00164   
00165   template<typename T1> arma_inline       subview_elem1<eT,T1> elem(const Base<uword,T1>& a);
00166   template<typename T1> arma_inline const subview_elem1<eT,T1> elem(const Base<uword,T1>& a) const;
00167   
00168   // template<typename T1, typename T2> arma_inline       subview_elem2<eT,T1,T2> submat(const Base<uword,T1>& a, const Base<uword,T2>& b);
00169   // template<typename T1, typename T2> arma_inline const subview_elem2<eT,T1,T2> submat(const Base<uword,T1>& a, const Base<uword,T2>& b) const;
00170   
00171   
00172   arma_inline       diagview<eT> diag(const sword in_id = 0);
00173   arma_inline const diagview<eT> diag(const sword in_id = 0) const;
00174   
00175   
00176   inline void swap_rows(const uword in_row1, const uword in_row2);
00177   inline void swap_cols(const uword in_col1, const uword in_col2);
00178   
00179   inline void shed_row(const uword row_num);
00180   inline void shed_col(const uword col_num);
00181   
00182   inline void shed_rows(const uword in_row1, const uword in_row2);
00183   inline void shed_cols(const uword in_col1, const uword in_col2);
00184   
00185   inline void insert_rows(const uword row_num, const uword N, const bool set_to_zero = true);
00186   inline void insert_cols(const uword col_num, const uword N, const bool set_to_zero = true);
00187   
00188   template<typename T1> inline void insert_rows(const uword row_num, const Base<eT,T1>& X);
00189   template<typename T1> inline void insert_cols(const uword col_num, const Base<eT,T1>& X);
00190   
00191   
00192   template<typename gen_type> inline                   Mat(const Gen<eT, gen_type>& X);
00193   template<typename gen_type> inline const Mat&  operator=(const Gen<eT, gen_type>& X);
00194   template<typename gen_type> inline const Mat& operator+=(const Gen<eT, gen_type>& X);
00195   template<typename gen_type> inline const Mat& operator-=(const Gen<eT, gen_type>& X);
00196   template<typename gen_type> inline const Mat& operator*=(const Gen<eT, gen_type>& X);
00197   template<typename gen_type> inline const Mat& operator%=(const Gen<eT, gen_type>& X);
00198   template<typename gen_type> inline const Mat& operator/=(const Gen<eT, gen_type>& X);
00199   
00200   template<typename T1, typename op_type> inline                   Mat(const Op<T1, op_type>& X);
00201   template<typename T1, typename op_type> inline const Mat&  operator=(const Op<T1, op_type>& X);
00202   template<typename T1, typename op_type> inline const Mat& operator+=(const Op<T1, op_type>& X);
00203   template<typename T1, typename op_type> inline const Mat& operator-=(const Op<T1, op_type>& X);
00204   template<typename T1, typename op_type> inline const Mat& operator*=(const Op<T1, op_type>& X);
00205   template<typename T1, typename op_type> inline const Mat& operator%=(const Op<T1, op_type>& X);
00206   template<typename T1, typename op_type> inline const Mat& operator/=(const Op<T1, op_type>& X);
00207   
00208   template<typename T1, typename eop_type> inline                   Mat(const eOp<T1, eop_type>& X);
00209   template<typename T1, typename eop_type> inline const Mat&  operator=(const eOp<T1, eop_type>& X);
00210   template<typename T1, typename eop_type> inline const Mat& operator+=(const eOp<T1, eop_type>& X);
00211   template<typename T1, typename eop_type> inline const Mat& operator-=(const eOp<T1, eop_type>& X);
00212   template<typename T1, typename eop_type> inline const Mat& operator*=(const eOp<T1, eop_type>& X);
00213   template<typename T1, typename eop_type> inline const Mat& operator%=(const eOp<T1, eop_type>& X);
00214   template<typename T1, typename eop_type> inline const Mat& operator/=(const eOp<T1, eop_type>& X);
00215   
00216   template<typename T1, typename op_type> inline                   Mat(const mtOp<eT, T1, op_type>& X);
00217   template<typename T1, typename op_type> inline const Mat&  operator=(const mtOp<eT, T1, op_type>& X);
00218   template<typename T1, typename op_type> inline const Mat& operator+=(const mtOp<eT, T1, op_type>& X);
00219   template<typename T1, typename op_type> inline const Mat& operator-=(const mtOp<eT, T1, op_type>& X);
00220   template<typename T1, typename op_type> inline const Mat& operator*=(const mtOp<eT, T1, op_type>& X);
00221   template<typename T1, typename op_type> inline const Mat& operator%=(const mtOp<eT, T1, op_type>& X);
00222   template<typename T1, typename op_type> inline const Mat& operator/=(const mtOp<eT, T1, op_type>& X);
00223   
00224   template<typename T1, typename T2, typename glue_type> inline                   Mat(const Glue<T1, T2, glue_type>& X);
00225   template<typename T1, typename T2, typename glue_type> inline const Mat&  operator=(const Glue<T1, T2, glue_type>& X);
00226   template<typename T1, typename T2, typename glue_type> inline const Mat& operator+=(const Glue<T1, T2, glue_type>& X);
00227   template<typename T1, typename T2, typename glue_type> inline const Mat& operator-=(const Glue<T1, T2, glue_type>& X);
00228   template<typename T1, typename T2, typename glue_type> inline const Mat& operator*=(const Glue<T1, T2, glue_type>& X);
00229   template<typename T1, typename T2, typename glue_type> inline const Mat& operator%=(const Glue<T1, T2, glue_type>& X);
00230   template<typename T1, typename T2, typename glue_type> inline const Mat& operator/=(const Glue<T1, T2, glue_type>& X);
00231   
00232   template<typename T1, typename T2>                     inline const Mat& operator+=(const Glue<T1, T2, glue_times>& X);
00233   template<typename T1, typename T2>                     inline const Mat& operator-=(const Glue<T1, T2, glue_times>& X);
00234   
00235   template<typename T1, typename T2, typename eglue_type> inline                   Mat(const eGlue<T1, T2, eglue_type>& X);
00236   template<typename T1, typename T2, typename eglue_type> inline const Mat&  operator=(const eGlue<T1, T2, eglue_type>& X);
00237   template<typename T1, typename T2, typename eglue_type> inline const Mat& operator+=(const eGlue<T1, T2, eglue_type>& X);
00238   template<typename T1, typename T2, typename eglue_type> inline const Mat& operator-=(const eGlue<T1, T2, eglue_type>& X);
00239   template<typename T1, typename T2, typename eglue_type> inline const Mat& operator*=(const eGlue<T1, T2, eglue_type>& X);
00240   template<typename T1, typename T2, typename eglue_type> inline const Mat& operator%=(const eGlue<T1, T2, eglue_type>& X);
00241   template<typename T1, typename T2, typename eglue_type> inline const Mat& operator/=(const eGlue<T1, T2, eglue_type>& X);
00242   
00243   template<typename T1, typename T2, typename glue_type> inline                   Mat(const mtGlue<eT, T1, T2, glue_type>& X);
00244   template<typename T1, typename T2, typename glue_type> inline const Mat&  operator=(const mtGlue<eT, T1, T2, glue_type>& X);
00245   template<typename T1, typename T2, typename glue_type> inline const Mat& operator+=(const mtGlue<eT, T1, T2, glue_type>& X);
00246   template<typename T1, typename T2, typename glue_type> inline const Mat& operator-=(const mtGlue<eT, T1, T2, glue_type>& X);
00247   template<typename T1, typename T2, typename glue_type> inline const Mat& operator*=(const mtGlue<eT, T1, T2, glue_type>& X);
00248   template<typename T1, typename T2, typename glue_type> inline const Mat& operator%=(const mtGlue<eT, T1, T2, glue_type>& X);
00249   template<typename T1, typename T2, typename glue_type> inline const Mat& operator/=(const mtGlue<eT, T1, T2, glue_type>& X);
00250   
00251   
00252   arma_inline arma_warn_unused eT& operator[] (const uword i);
00253   arma_inline arma_warn_unused eT  operator[] (const uword i) const;
00254   arma_inline arma_warn_unused eT& at         (const uword i);
00255   arma_inline arma_warn_unused eT  at         (const uword i) const;
00256   arma_inline arma_warn_unused eT& operator() (const uword i);
00257   arma_inline arma_warn_unused eT  operator() (const uword i) const;
00258   
00259   arma_inline arma_warn_unused eT& at         (const uword in_row, const uword in_col);
00260   arma_inline arma_warn_unused eT  at         (const uword in_row, const uword in_col) const;
00261   arma_inline arma_warn_unused eT& operator() (const uword in_row, const uword in_col);
00262   arma_inline arma_warn_unused eT  operator() (const uword in_row, const uword in_col) const;
00263   
00264   arma_inline const Mat& operator++();
00265   arma_inline void       operator++(int);
00266   
00267   arma_inline const Mat& operator--();
00268   arma_inline void       operator--(int);
00269   
00270   arma_inline arma_warn_unused bool is_empty()  const;
00271   arma_inline arma_warn_unused bool is_vec()    const;
00272   arma_inline arma_warn_unused bool is_rowvec() const;
00273   arma_inline arma_warn_unused bool is_colvec() const;
00274   arma_inline arma_warn_unused bool is_square() const;
00275        inline arma_warn_unused bool is_finite() const;
00276   
00277   arma_inline arma_warn_unused bool in_range(const uword i) const;
00278   arma_inline arma_warn_unused bool in_range(const span& x) const;
00279   
00280   arma_inline arma_warn_unused bool in_range(const uword   in_row, const uword   in_col) const;
00281   arma_inline arma_warn_unused bool in_range(const span& row_span, const uword   in_col) const;
00282   arma_inline arma_warn_unused bool in_range(const uword   in_row, const span& col_span) const;
00283   arma_inline arma_warn_unused bool in_range(const span& row_span, const span& col_span) const;
00284   
00285   arma_inline arma_warn_unused       eT* colptr(const uword in_col);
00286   arma_inline arma_warn_unused const eT* colptr(const uword in_col) const;
00287   
00288   arma_inline arma_warn_unused       eT* memptr();
00289   arma_inline arma_warn_unused const eT* memptr() const;
00290   
00291   
00292   inline void impl_print(const std::string& extra_text) const;
00293   inline void impl_print(std::ostream& user_stream, const std::string& extra_text) const;
00294   
00295   inline void impl_print_trans(const std::string& extra_text) const;
00296   inline void impl_print_trans(std::ostream& user_stream, const std::string& extra_text) const;
00297   
00298   inline void impl_raw_print(const std::string& extra_text) const;
00299   inline void impl_raw_print(std::ostream& user_stream, const std::string& extra_text) const;
00300   
00301   inline void impl_raw_print_trans(const std::string& extra_text) const;
00302   inline void impl_raw_print_trans(std::ostream& user_stream, const std::string& extra_text) const;
00303   
00304   
00305   template<typename eT2>
00306   inline void copy_size(const Mat<eT2>& m);
00307   
00308   inline void set_size(const uword in_elem);
00309   inline void set_size(const uword in_rows, const uword in_cols);
00310   
00311   inline void   resize(const uword in_elem);
00312   inline void   resize(const uword in_rows, const uword in_cols);
00313   inline void  reshape(const uword in_rows, const uword in_cols, const uword dim = 0);
00314   
00315   
00316   arma_hot inline const Mat& fill(const eT val);
00317   
00318   inline const Mat& zeros();
00319   inline const Mat& zeros(const uword in_elem);
00320   inline const Mat& zeros(const uword in_rows, const uword in_cols);
00321   
00322   inline const Mat& ones();
00323   inline const Mat& ones(const uword in_elem);
00324   inline const Mat& ones(const uword in_rows, const uword in_cols);
00325   
00326   inline const Mat& randu();
00327   inline const Mat& randu(const uword in_elem);
00328   inline const Mat& randu(const uword in_rows, const uword in_cols);
00329   
00330   inline const Mat& randn();
00331   inline const Mat& randn(const uword in_elem);
00332   inline const Mat& randn(const uword in_rows, const uword in_cols);
00333   
00334   inline const Mat& eye();
00335   inline const Mat& eye(const uword in_rows, const uword in_cols);
00336   
00337   inline void reset();
00338   
00339   
00340   template<typename T1> inline void set_real(const Base<pod_type,T1>& X);
00341   template<typename T1> inline void set_imag(const Base<pod_type,T1>& X);
00342   
00343   
00344   inline arma_warn_unused eT min() const;
00345   inline arma_warn_unused eT max() const;
00346   
00347   inline eT min(uword& index_of_min_val) const;
00348   inline eT max(uword& index_of_max_val) const;
00349   
00350   inline eT min(uword& row_of_min_val, uword& col_of_min_val) const;
00351   inline eT max(uword& row_of_max_val, uword& col_of_max_val) const;
00352   
00353   
00354   inline bool save(const std::string   name, const file_type type = arma_binary, const bool print_status = true) const;
00355   inline bool save(      std::ostream& os,   const file_type type = arma_binary, const bool print_status = true) const;
00356   
00357   inline bool load(const std::string   name, const file_type type = auto_detect, const bool print_status = true);
00358   inline bool load(      std::istream& is,   const file_type type = auto_detect, const bool print_status = true);
00359   
00360   inline bool quiet_save(const std::string   name, const file_type type = arma_binary) const;
00361   inline bool quiet_save(      std::ostream& os,   const file_type type = arma_binary) const;
00362   
00363   inline bool quiet_load(const std::string   name, const file_type type = auto_detect);
00364   inline bool quiet_load(      std::istream& is,   const file_type type = auto_detect);
00365   
00366   
00367   // for container-like functionality
00368   
00369   typedef eT    value_type;
00370   typedef uword size_type;
00371   
00372   typedef       eT*       iterator;
00373   typedef const eT* const_iterator;
00374   
00375   typedef       eT*       col_iterator;
00376   typedef const eT* const_col_iterator;
00377   
00378   class row_iterator
00379     {
00380     public:
00381     
00382     inline row_iterator(Mat<eT>& in_M, const uword in_row);
00383     
00384     inline eT& operator* ();
00385     
00386     inline row_iterator& operator++();
00387     inline void          operator++(int);
00388     
00389     inline row_iterator& operator--();
00390     inline void          operator--(int);
00391     
00392     inline bool operator!=(const row_iterator& X) const;
00393     inline bool operator==(const row_iterator& X) const;
00394     
00395     arma_aligned Mat<eT>& M;
00396     arma_aligned uword    row;
00397     arma_aligned uword    col;
00398     };
00399   
00400   
00401   class const_row_iterator
00402     {
00403     public:
00404     
00405     const_row_iterator(const Mat<eT>& in_M, const uword in_row);
00406     const_row_iterator(const row_iterator& X);
00407     
00408     inline eT operator*() const;
00409     
00410     inline const_row_iterator& operator++();
00411     inline void                operator++(int);
00412     
00413     inline const_row_iterator& operator--();
00414     inline void                operator--(int);
00415     
00416     inline bool operator!=(const const_row_iterator& X) const;
00417     inline bool operator==(const const_row_iterator& X) const;
00418     
00419     arma_aligned const Mat<eT>& M;
00420     arma_aligned       uword    row;
00421     arma_aligned       uword    col;
00422     };
00423   
00424   inline       iterator begin();
00425   inline const_iterator begin() const;
00426   
00427   inline       iterator end();
00428   inline const_iterator end()   const;
00429   
00430   inline       col_iterator begin_col(const uword col_num);
00431   inline const_col_iterator begin_col(const uword col_num) const;
00432   
00433   inline       col_iterator end_col  (const uword col_num);
00434   inline const_col_iterator end_col  (const uword col_num) const;
00435   
00436   inline       row_iterator begin_row(const uword row_num);
00437   inline const_row_iterator begin_row(const uword row_num) const;
00438   
00439   inline       row_iterator end_row  (const uword row_num);
00440   inline const_row_iterator end_row  (const uword row_num) const;
00441   
00442   inline void  clear();
00443   inline bool  empty() const;
00444   inline uword size()  const;
00445   
00446   template<uword fixed_n_rows, uword fixed_n_cols>
00447   class fixed : public Mat<eT>
00448     {
00449     private:
00450     
00451     static const uword fixed_n_elem = fixed_n_rows * fixed_n_cols;
00452     static const bool  use_extra    = (fixed_n_elem > arma_config::mat_prealloc);
00453     
00454     arma_aligned eT mem_local_extra[ (use_extra) ? fixed_n_elem : 1 ];
00455     
00456     arma_inline void mem_setup();
00457     
00458     
00459     public:
00460     
00461     static const uword n_rows = fixed_n_rows;
00462     static const uword n_cols = fixed_n_cols;
00463     static const uword n_elem = fixed_n_elem;
00464     
00465     
00466     arma_inline fixed();
00467     arma_inline fixed(const fixed<fixed_n_rows, fixed_n_cols>& X);
00468     
00469     template<typename T1>              inline fixed(const Base<eT,T1>& A);
00470     template<typename T1, typename T2> inline fixed(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B);
00471     
00472     inline fixed(      eT* aux_mem, const bool copy_aux_mem = true);
00473     inline fixed(const eT* aux_mem);
00474     
00475     inline fixed(const char*        text);
00476     inline fixed(const std::string& text);
00477     
00478     // TODO: handling of initializer_list ?
00479     
00480     template<typename T1> inline const Mat& operator=(const Base<eT,T1>& A);
00481     
00482     inline const Mat& operator=(const eT val);
00483     inline const Mat& operator=(const char*        text);
00484     inline const Mat& operator=(const std::string& text);
00485     
00486     
00487     inline       subview_row<eT> operator()(const uword  row_num, const span& col_span);
00488     inline const subview_row<eT> operator()(const uword  row_num, const span& col_span) const;
00489     
00490     inline       subview_col<eT> operator()(const span& row_span, const uword col_num);
00491     inline const subview_col<eT> operator()(const span& row_span, const uword col_num) const;
00492     
00493     inline       subview<eT>     operator()(const span& row_span, const span& col_span);
00494     inline const subview<eT>     operator()(const span& row_span, const span& col_span) const;
00495     
00496     
00497     arma_inline arma_warn_unused eT& operator[] (const uword i);
00498     arma_inline arma_warn_unused eT  operator[] (const uword i) const;
00499     arma_inline arma_warn_unused eT& at         (const uword i);
00500     arma_inline arma_warn_unused eT  at         (const uword i) const;
00501     arma_inline arma_warn_unused eT& operator() (const uword i);
00502     arma_inline arma_warn_unused eT  operator() (const uword i) const;
00503     
00504     arma_inline arma_warn_unused eT& at         (const uword in_row, const uword in_col);
00505     arma_inline arma_warn_unused eT  at         (const uword in_row, const uword in_col) const;
00506     arma_inline arma_warn_unused eT& operator() (const uword in_row, const uword in_col);
00507     arma_inline arma_warn_unused eT  operator() (const uword in_row, const uword in_col) const;
00508     
00509     
00510     arma_hot inline const Mat<eT>& fill(const eT val);
00511     arma_hot inline const Mat<eT>& zeros();
00512     arma_hot inline const Mat<eT>& ones();
00513     };
00514   
00515   
00516   protected:
00517   
00518   inline void init_cold();
00519   inline void init_warm(uword in_rows, uword in_cols);
00520   
00521   inline void init(const std::string& text);
00522   
00523   #if defined(ARMA_USE_CXX11)
00524   inline void init(const std::initializer_list<eT>& list);
00525   #endif
00526   
00527   template<typename T1, typename T2>
00528   inline void init(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B);
00529   
00530   inline void steal_mem(Mat& X);
00531   
00532   inline Mat(const char junk, const eT* aux_mem, const uword aux_n_rows, const uword aux_n_cols);
00533   
00534   friend class Cube<eT>;
00535   friend class glue_join;
00536   friend class op_strans;
00537   friend class op_htrans;
00538   friend class op_resize;
00539   
00540   
00541   public:
00542   
00543   #ifdef ARMA_EXTRA_MAT_PROTO
00544     #include ARMA_INCFILE_WRAP(ARMA_EXTRA_MAT_PROTO)
00545   #endif
00546   };
00547 
00548 
00549 
00550 class Mat_aux
00551   {
00552   public:
00553 
00554   template<typename eT> arma_inline static void prefix_pp(Mat<eT>& x);
00555   template<typename T>  arma_inline static void prefix_pp(Mat< std::complex<T> >& x);
00556   
00557   template<typename eT> arma_inline static void postfix_pp(Mat<eT>& x);
00558   template<typename T>  arma_inline static void postfix_pp(Mat< std::complex<T> >& x);
00559   
00560   template<typename eT> arma_inline static void prefix_mm(Mat<eT>& x);
00561   template<typename T>  arma_inline static void prefix_mm(Mat< std::complex<T> >& x);
00562   
00563   template<typename eT> arma_inline static void postfix_mm(Mat<eT>& x);
00564   template<typename T>  arma_inline static void postfix_mm(Mat< std::complex<T> >& x);
00565   
00566   template<typename eT, typename T1> inline static void set_real(Mat<eT>&                out, const Base<eT,T1>& X);
00567   template<typename T,  typename T1> inline static void set_real(Mat< std::complex<T> >& out, const Base< T,T1>& X);
00568   
00569   template<typename eT, typename T1> inline static void set_imag(Mat<eT>&                out, const Base<eT,T1>& X);
00570   template<typename T,  typename T1> inline static void set_imag(Mat< std::complex<T> >& out, const Base< T,T1>& X);
00571   };
00572 
00573 
00574 


armadillo_matrix
Author(s): Conrad Sanderson - NICTA (www.nicta.com.au), (Wrapper by Sjoerd van den Dries)
autogenerated on Tue Jan 7 2014 11:42:04