00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef EIGEN_COEFFS_H
00026 #define EIGEN_COEFFS_H
00027
00042 template<typename Derived>
00043 EIGEN_STRONG_INLINE const typename ei_traits<Derived>::Scalar MatrixBase<Derived>
00044 ::coeff(int row, int col) const
00045 {
00046 ei_internal_assert(row >= 0 && row < rows()
00047 && col >= 0 && col < cols());
00048 return derived().coeff(row, col);
00049 }
00050
00055 template<typename Derived>
00056 EIGEN_STRONG_INLINE const typename ei_traits<Derived>::Scalar MatrixBase<Derived>
00057 ::operator()(int row, int col) const
00058 {
00059 ei_assert(row >= 0 && row < rows()
00060 && col >= 0 && col < cols());
00061 return derived().coeff(row, col);
00062 }
00063
00078 template<typename Derived>
00079 EIGEN_STRONG_INLINE typename ei_traits<Derived>::Scalar& MatrixBase<Derived>
00080 ::coeffRef(int row, int col)
00081 {
00082 ei_internal_assert(row >= 0 && row < rows()
00083 && col >= 0 && col < cols());
00084 return derived().coeffRef(row, col);
00085 }
00086
00091 template<typename Derived>
00092 EIGEN_STRONG_INLINE typename ei_traits<Derived>::Scalar& MatrixBase<Derived>
00093 ::operator()(int row, int col)
00094 {
00095 ei_assert(row >= 0 && row < rows()
00096 && col >= 0 && col < cols());
00097 return derived().coeffRef(row, col);
00098 }
00099
00114 template<typename Derived>
00115 EIGEN_STRONG_INLINE const typename ei_traits<Derived>::Scalar MatrixBase<Derived>
00116 ::coeff(int index) const
00117 {
00118 ei_internal_assert(index >= 0 && index < size());
00119 return derived().coeff(index);
00120 }
00121
00129 template<typename Derived>
00130 EIGEN_STRONG_INLINE const typename ei_traits<Derived>::Scalar MatrixBase<Derived>
00131 ::operator[](int index) const
00132 {
00133 ei_assert(index >= 0 && index < size());
00134 return derived().coeff(index);
00135 }
00136
00146 template<typename Derived>
00147 EIGEN_STRONG_INLINE const typename ei_traits<Derived>::Scalar MatrixBase<Derived>
00148 ::operator()(int index) const
00149 {
00150 ei_assert(index >= 0 && index < size());
00151 return derived().coeff(index);
00152 }
00153
00168 template<typename Derived>
00169 EIGEN_STRONG_INLINE typename ei_traits<Derived>::Scalar& MatrixBase<Derived>
00170 ::coeffRef(int index)
00171 {
00172 ei_internal_assert(index >= 0 && index < size());
00173 return derived().coeffRef(index);
00174 }
00175
00182 template<typename Derived>
00183 EIGEN_STRONG_INLINE typename ei_traits<Derived>::Scalar& MatrixBase<Derived>
00184 ::operator[](int index)
00185 {
00186 ei_assert(index >= 0 && index < size());
00187 return derived().coeffRef(index);
00188 }
00189
00198 template<typename Derived>
00199 EIGEN_STRONG_INLINE typename ei_traits<Derived>::Scalar& MatrixBase<Derived>
00200 ::operator()(int index)
00201 {
00202 ei_assert(index >= 0 && index < size());
00203 return derived().coeffRef(index);
00204 }
00205
00207 template<typename Derived>
00208 EIGEN_STRONG_INLINE const typename ei_traits<Derived>::Scalar MatrixBase<Derived>
00209 ::x() const { return (*this)[0]; }
00210
00212 template<typename Derived>
00213 EIGEN_STRONG_INLINE const typename ei_traits<Derived>::Scalar MatrixBase<Derived>
00214 ::y() const { return (*this)[1]; }
00215
00217 template<typename Derived>
00218 EIGEN_STRONG_INLINE const typename ei_traits<Derived>::Scalar MatrixBase<Derived>
00219 ::z() const { return (*this)[2]; }
00220
00222 template<typename Derived>
00223 EIGEN_STRONG_INLINE const typename ei_traits<Derived>::Scalar MatrixBase<Derived>
00224 ::w() const { return (*this)[3]; }
00225
00227 template<typename Derived>
00228 EIGEN_STRONG_INLINE typename ei_traits<Derived>::Scalar& MatrixBase<Derived>
00229 ::x() { return (*this)[0]; }
00230
00232 template<typename Derived>
00233 EIGEN_STRONG_INLINE typename ei_traits<Derived>::Scalar& MatrixBase<Derived>
00234 ::y() { return (*this)[1]; }
00235
00237 template<typename Derived>
00238 EIGEN_STRONG_INLINE typename ei_traits<Derived>::Scalar& MatrixBase<Derived>
00239 ::z() { return (*this)[2]; }
00240
00242 template<typename Derived>
00243 EIGEN_STRONG_INLINE typename ei_traits<Derived>::Scalar& MatrixBase<Derived>
00244 ::w() { return (*this)[3]; }
00245
00254 template<typename Derived>
00255 template<int LoadMode>
00256 EIGEN_STRONG_INLINE typename ei_packet_traits<typename ei_traits<Derived>::Scalar>::type
00257 MatrixBase<Derived>::packet(int row, int col) const
00258 {
00259 ei_internal_assert(row >= 0 && row < rows()
00260 && col >= 0 && col < cols());
00261 return derived().template packet<LoadMode>(row,col);
00262 }
00263
00272 template<typename Derived>
00273 template<int StoreMode>
00274 EIGEN_STRONG_INLINE void MatrixBase<Derived>::writePacket
00275 (int row, int col, const typename ei_packet_traits<typename ei_traits<Derived>::Scalar>::type& x)
00276 {
00277 ei_internal_assert(row >= 0 && row < rows()
00278 && col >= 0 && col < cols());
00279 derived().template writePacket<StoreMode>(row,col,x);
00280 }
00281
00290 template<typename Derived>
00291 template<int LoadMode>
00292 EIGEN_STRONG_INLINE typename ei_packet_traits<typename ei_traits<Derived>::Scalar>::type
00293 MatrixBase<Derived>::packet(int index) const
00294 {
00295 ei_internal_assert(index >= 0 && index < size());
00296 return derived().template packet<LoadMode>(index);
00297 }
00298
00307 template<typename Derived>
00308 template<int StoreMode>
00309 EIGEN_STRONG_INLINE void MatrixBase<Derived>::writePacket
00310 (int index, const typename ei_packet_traits<typename ei_traits<Derived>::Scalar>::type& x)
00311 {
00312 ei_internal_assert(index >= 0 && index < size());
00313 derived().template writePacket<StoreMode>(index,x);
00314 }
00315
00316 #ifndef EIGEN_PARSED_BY_DOXYGEN
00317
00325 template<typename Derived>
00326 template<typename OtherDerived>
00327 EIGEN_STRONG_INLINE void MatrixBase<Derived>::copyCoeff(int row, int col, const MatrixBase<OtherDerived>& other)
00328 {
00329 ei_internal_assert(row >= 0 && row < rows()
00330 && col >= 0 && col < cols());
00331 derived().coeffRef(row, col) = other.derived().coeff(row, col);
00332 }
00333
00341 template<typename Derived>
00342 template<typename OtherDerived>
00343 EIGEN_STRONG_INLINE void MatrixBase<Derived>::copyCoeff(int index, const MatrixBase<OtherDerived>& other)
00344 {
00345 ei_internal_assert(index >= 0 && index < size());
00346 derived().coeffRef(index) = other.derived().coeff(index);
00347 }
00348
00356 template<typename Derived>
00357 template<typename OtherDerived, int StoreMode, int LoadMode>
00358 EIGEN_STRONG_INLINE void MatrixBase<Derived>::copyPacket(int row, int col, const MatrixBase<OtherDerived>& other)
00359 {
00360 ei_internal_assert(row >= 0 && row < rows()
00361 && col >= 0 && col < cols());
00362 derived().template writePacket<StoreMode>(row, col,
00363 other.derived().template packet<LoadMode>(row, col));
00364 }
00365
00373 template<typename Derived>
00374 template<typename OtherDerived, int StoreMode, int LoadMode>
00375 EIGEN_STRONG_INLINE void MatrixBase<Derived>::copyPacket(int index, const MatrixBase<OtherDerived>& other)
00376 {
00377 ei_internal_assert(index >= 0 && index < size());
00378 derived().template writePacket<StoreMode>(index,
00379 other.derived().template packet<LoadMode>(index));
00380 }
00381
00382 #endif
00383
00384 #endif // EIGEN_COEFFS_H