$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 00018 00019 template<typename eT> 00020 class Col : public Mat<eT> 00021 { 00022 public: 00023 00024 typedef eT elem_type; 00025 typedef typename get_pod_type<eT>::result pod_type; 00026 00027 00028 inline Col(); 00029 inline Col(const Col<eT>& X); 00030 inline explicit Col(const uword n_elem); 00031 inline Col(const uword in_rows, const uword in_cols); 00032 00033 inline Col(const char* text); 00034 inline const Col& operator=(const char* text); 00035 00036 inline Col(const std::string& text); 00037 inline const Col& operator=(const std::string& text); 00038 00039 #if defined(ARMA_USE_CXX11) 00040 inline Col(const std::initializer_list<eT>& list); 00041 inline const Col& operator=(const std::initializer_list<eT>& list); 00042 #endif 00043 00044 00045 inline const Col& operator=(const eT val); 00046 00047 template<typename T1> inline Col(const Base<eT,T1>& X); 00048 template<typename T1> inline const Col& operator=(const Base<eT,T1>& X); 00049 00050 inline Col( eT* aux_mem, const uword aux_length, const bool copy_aux_mem = true, const bool strict = true); 00051 inline Col(const eT* aux_mem, const uword aux_length); 00052 00053 template<typename T1, typename T2> 00054 inline explicit Col(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B); 00055 00056 template<typename T1> inline Col(const BaseCube<eT,T1>& X); 00057 template<typename T1> inline const Col& operator=(const BaseCube<eT,T1>& X); 00058 00059 inline Col(const subview_cube<eT>& X); 00060 inline const Col& operator=(const subview_cube<eT>& X); 00061 00062 inline mat_injector<Col> operator<<(const eT val); 00063 00064 arma_inline eT& row(const uword row_num); 00065 arma_inline eT row(const uword row_num) const; 00066 00067 arma_inline subview_col<eT> rows(const uword in_row1, const uword in_row2); 00068 arma_inline const subview_col<eT> rows(const uword in_row1, const uword in_row2) const; 00069 00070 arma_inline subview_col<eT> subvec(const uword in_row1, const uword in_row2); 00071 arma_inline const subview_col<eT> subvec(const uword in_row1, const uword in_row2) const; 00072 00073 arma_inline subview_col<eT> subvec(const span& row_span); 00074 arma_inline const subview_col<eT> subvec(const span& row_span) const; 00075 00076 //arma_inline subview_col<eT> operator()(const span& row_span); 00077 //arma_inline const subview_col<eT> operator()(const span& row_span) const; 00078 00079 00080 inline void shed_row (const uword row_num); 00081 inline void shed_rows(const uword in_row1, const uword in_row2); 00082 00083 inline void insert_rows(const uword row_num, const uword N, const bool set_to_zero = true); 00084 template<typename T1> inline void insert_rows(const uword row_num, const Base<eT,T1>& X); 00085 00086 00087 typedef eT* row_iterator; 00088 typedef const eT* const_row_iterator; 00089 00090 inline row_iterator begin_row(const uword row_num); 00091 inline const_row_iterator begin_row(const uword row_num) const; 00092 00093 inline row_iterator end_row (const uword row_num); 00094 inline const_row_iterator end_row (const uword row_num) const; 00095 00096 00097 template<uword fixed_n_elem> 00098 class fixed : public Col<eT> 00099 { 00100 private: 00101 00102 static const bool use_extra = (fixed_n_elem > arma_config::mat_prealloc); 00103 00104 arma_aligned eT mem_local_extra[ (use_extra) ? fixed_n_elem : 1 ]; 00105 00106 arma_inline void mem_setup(); 00107 arma_inline void change_to_row(); 00108 00109 00110 public: 00111 00112 static const uword n_rows = fixed_n_elem; 00113 static const uword n_cols = 1; 00114 static const uword n_elem = fixed_n_elem; 00115 00116 arma_inline fixed(); 00117 arma_inline fixed(const fixed<fixed_n_elem>& X); 00118 inline fixed(const subview_cube<eT>& X); 00119 00120 template<typename T1> inline fixed(const Base<eT,T1>& A); 00121 template<typename T1, typename T2> inline fixed(const Base<pod_type,T1>& A, const Base<pod_type,T2>& B); 00122 00123 inline fixed( eT* aux_mem, const bool copy_aux_mem = true); 00124 inline fixed(const eT* aux_mem); 00125 00126 inline fixed(const char* text); 00127 inline fixed(const std::string& text); 00128 00129 template<typename T1> inline const Col& operator=(const Base<eT,T1>& A); 00130 00131 inline const Col& operator=(const eT val); 00132 inline const Col& operator=(const char* text); 00133 inline const Col& operator=(const std::string& text); 00134 inline const Col& operator=(const subview_cube<eT>& X); 00135 00136 inline subview_row<eT> operator()(const uword row_num, const span& col_span); 00137 inline const subview_row<eT> operator()(const uword row_num, const span& col_span) const; 00138 00139 inline subview_col<eT> operator()(const span& row_span, const uword col_num ); 00140 inline const subview_col<eT> operator()(const span& row_span, const uword col_num ) const; 00141 00142 inline subview<eT> operator()(const span& row_span, const span& col_span); 00143 inline const subview<eT> operator()(const span& row_span, const span& col_span) const; 00144 00145 arma_inline arma_warn_unused eT& operator[] (const uword i); 00146 arma_inline arma_warn_unused eT operator[] (const uword i) const; 00147 arma_inline arma_warn_unused eT& at (const uword i); 00148 arma_inline arma_warn_unused eT at (const uword i) const; 00149 arma_inline arma_warn_unused eT& operator() (const uword i); 00150 arma_inline arma_warn_unused eT operator() (const uword i) const; 00151 00152 arma_inline arma_warn_unused eT& at (const uword in_row, const uword in_col); 00153 arma_inline arma_warn_unused eT at (const uword in_row, const uword in_col) const; 00154 arma_inline arma_warn_unused eT& operator() (const uword in_row, const uword in_col); 00155 arma_inline arma_warn_unused eT operator() (const uword in_row, const uword in_col) const; 00156 00157 arma_hot inline const Col<eT>& fill(const eT val); 00158 arma_hot inline const Col<eT>& zeros(); 00159 arma_hot inline const Col<eT>& ones(); 00160 }; 00161 00162 00163 #ifdef ARMA_EXTRA_COL_PROTO 00164 #include ARMA_INCFILE_WRAP(ARMA_EXTRA_COL_PROTO) 00165 #endif 00166 00167 }; 00168 00169 00170