00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 template<class Rep> class ConstTransView;
00025
00027 template<class Rep>
00028 class TransView : public TransposeViewTag
00029 {
00030 public:
00031 typedef TransView<Rep> self_type;
00032 typedef TransposeViewTag exp_tag;
00033 typedef NullTag extra_param_type;
00034 typedef ConstTransView<Rep> const_view_type;
00035 COMMON_VIEW_TYPEDEFS();
00036
00037 enum {
00038 ROWS = super_type::COLS,
00039 COLS = super_type::ROWS,
00040 IsLinear = false,
00041 IsLinearRecursive = IsLinear && super_type::IsLinearRecursive,
00042 TNOP = Rep::TNOP,
00043 ENOP = Rep::ENOP,
00044 EXPLevel = Rep::EXPLevel + 1
00045 };
00046
00048 typedef Mat<DenseMatCon<value_type,ROWS,COLS>, EmptyErrorChecker> temp_type;
00049
00050
00051
00052 EXMAT_INLINE2 TransView(const self_type& self)
00053 : rep(self.rep) {}
00054 EXMAT_INLINE2 TransView(super_type& mat)
00055 : rep(mat) {}
00057 template<class Rep2> EXMAT_INLINE2
00058 TransView(const Rep2& self, super_type& mat)
00059 : rep(mat) {}
00060
00062 EXMAT_INLINE2 self_type operator=(const_param_type s) {
00063 rep = s;
00064 return *this;
00065 }
00066
00067
00068 EXMAT_INLINE2 size_t size() const { return rep.size(); }
00069 EXMAT_INLINE2 size_t rows() const { return rep.cols(); }
00070 EXMAT_INLINE2 size_t cols() const { return rep.rows(); }
00071
00072
00073 EXMAT_INLINE2 reference setAt(index_type i) {
00074 if(ROWS == 1 || COLS == 1)
00075 return rep.setAt(i);
00076 else
00077 return rep.setAt(i%rep.cols(), i/rep.cols());
00078 }
00079 EXMAT_INLINE2 const_reference getAt(index_type i) const {
00080 if(ROWS == 1 || COLS == 1)
00081 return rep.getAt(i);
00082 else
00083 return rep.getAt(i%rep.cols(), i/rep.cols());
00084 }
00085 EXMAT_INLINE2 reference setAt(index_type i, index_type j)
00086 { return rep.setAt(j, i); }
00087 EXMAT_INLINE2 const_reference getAt(index_type i, index_type j) const
00088 { return rep.getAt(j, i); }
00089 };
00093 template<class Rep, class ErrChk> EXMAT_INLINE2 static
00094 Mat<ExpMat<TransView<typename Rep::rep_type> >, ErrChk>
00095 trans(Mat<Rep, ErrChk>& mat) {
00096 return ExpMat<TransView<TTYPENAME Rep::rep_type> >(mat);
00097 }
00102 template<class Rep, class ErrChk> EXMAT_INLINE2 static
00103 Vec<ExpMat<TransView<typename Rep::rep_type> >, ErrChk>
00104 trans(Vec<Rep, ErrChk>& vec) {
00105 return ExpMat<TransView<TTYPENAME Rep::rep_type> >(vec);
00106 }
00107 #if HAVE_TT_PARAMETER
00108
00112 template<class Rep, class ErrChk, template<class Rep, class ErrChk> class RepT, template<class RepT> class MathClass > EXMAT_INLINE2
00113 static MathClass<RepT<ExpMat<ConstTransView<Rep> >, ErrChk> >
00114 trans(MathClass<RepT<Rep, ErrChk> >& vec) {
00115 return MathClass<RepT<ExpMat<ConstTransView<Rep> >, ErrChk> >(ExpMat<ConstTransView<Rep> >(vec));
00116 }
00117 #endif // HAVE_TT_PARAMETER
00118
00119
00121 template<class Rep>
00122 class ConstTransView : public TransposeViewTag
00123 {
00124 public:
00125 typedef ConstTransView<Rep> self_type;
00126 typedef TransposeViewTag exp_tag;
00127 typedef NullTag extra_param_type;
00128 COMMON_CONST_VIEW_TYPEDEFS();
00129
00130 enum {
00131 ROWS = super_type::COLS,
00132 COLS = super_type::ROWS,
00133 IsLinear = false,
00134 IsLinearRecursive = IsLinear && super_type::IsLinearRecursive,
00135 TNOP = Rep::TNOP,
00136 ENOP = Rep::ENOP,
00137 EXPLevel = Rep::EXPLevel +1
00138 };
00139
00141 typedef Mat<DenseMatCon<value_type,ROWS,COLS>, EmptyErrorChecker> temp_type;
00142
00143
00144
00145 EXMAT_INLINE2 ConstTransView(const self_type& self)
00146 : rep(self.rep) {}
00147 EXMAT_INLINE2 ConstTransView(const super_type& mat)
00148 : rep(mat) {}
00150 template<class Rep2> EXMAT_INLINE2
00151 ConstTransView(const Rep2& self, const super_type& mat)
00152 : rep(mat) {}
00153
00154
00155
00156 EXMAT_INLINE2 size_t size() const { return rep.size(); }
00157 EXMAT_INLINE2 size_t rows() const { return rep.cols(); }
00158 EXMAT_INLINE2 size_t cols() const { return rep.rows(); }
00159
00160
00161 EXMAT_INLINE2 const_reference getAt(index_type i) const {
00162 if(ROWS == 1 || COLS == 1)
00163 return rep.getAt(i);
00164 else
00165 return rep.getAt(i%rep.cols(), i/rep.cols());
00166 }
00167 EXMAT_INLINE2 const_reference getAt(index_type i, index_type j) const
00168 { return rep.getAt(j, i); }
00169 };
00173 template<class Rep, class ErrChk> EXMAT_INLINE2 static
00174 const Mat<ExpMat<ConstTransView<typename Rep::rep_type> >, ErrChk>
00175 trans(const Mat<Rep, ErrChk>& mat) {
00176 return ExpMat<ConstTransView<TTYPENAME Rep::rep_type> >(mat);
00177 }
00182 template<class Rep, class ErrChk> EXMAT_INLINE2 static
00183 const Vec<ExpMat<ConstTransView<typename Rep::rep_type> >, ErrChk>
00184 trans(const Vec<Rep, ErrChk>& vec) {
00185 return ExpMat<ConstTransView<TTYPENAME Rep::rep_type> >(vec);
00186 }
00187 #if HAVE_TT_PARAMETER
00188
00192 template<class Rep, class ErrChk, template<class Rep, class ErrChk> class RepT, template<class RepT> class MathClass > EXMAT_INLINE2
00193 static const MathClass<RepT<ExpMat<ConstTransView<Rep> >, ErrChk> >
00194 trans(const MathClass<RepT<Rep, ErrChk> >& vec) {
00195 return ExpMat<ConstTransView<Rep> >(vec);
00196 }
00197 #endif // HAVE_TT_PARAMETER