Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: Eigen_test Odometry_test AttitudeEstimation_usingTicker MPU9250_Quaternion_Binary_Serial ... more
MatrixBase.h
00001 // This file is part of Eigen, a lightweight C++ template library 00002 // for linear algebra. 00003 // 00004 // Copyright (C) 2006-2009 Benoit Jacob <jacob.benoit.1@gmail.com> 00005 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr> 00006 // 00007 // This Source Code Form is subject to the terms of the Mozilla 00008 // Public License v. 2.0. If a copy of the MPL was not distributed 00009 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/. 00010 00011 #ifndef EIGEN_MATRIXBASE_H 00012 #define EIGEN_MATRIXBASE_H 00013 00014 namespace Eigen { 00015 00016 /** \class MatrixBase 00017 * \ingroup Core_Module 00018 * 00019 * \brief Base class for all dense matrices, vectors, and expressions 00020 * 00021 * This class is the base that is inherited by all matrix, vector, and related expression 00022 * types. Most of the Eigen API is contained in this class, and its base classes. Other important 00023 * classes for the Eigen API are Matrix, and VectorwiseOp. 00024 * 00025 * Note that some methods are defined in other modules such as the \ref LU_Module LU module 00026 * for all functions related to matrix inversions. 00027 * 00028 * \tparam Derived is the derived type, e.g. a matrix type, or an expression, etc. 00029 * 00030 * When writing a function taking Eigen objects as argument, if you want your function 00031 * to take as argument any matrix, vector, or expression, just let it take a 00032 * MatrixBase argument. As an example, here is a function printFirstRow which, given 00033 * a matrix, vector, or expression \a x, prints the first row of \a x. 00034 * 00035 * \code 00036 template<typename Derived> 00037 void printFirstRow(const Eigen::MatrixBase<Derived>& x) 00038 { 00039 cout << x.row(0) << endl; 00040 } 00041 * \endcode 00042 * 00043 * This class can be extended with the help of the plugin mechanism described on the page 00044 * \ref TopicCustomizingEigen by defining the preprocessor symbol \c EIGEN_MATRIXBASE_PLUGIN. 00045 * 00046 * \sa \ref TopicClassHierarchy 00047 */ 00048 template<typename Derived> class MatrixBase 00049 : public DenseBase<Derived> 00050 { 00051 public: 00052 #ifndef EIGEN_PARSED_BY_DOXYGEN 00053 typedef MatrixBase StorageBaseType; 00054 typedef typename internal::traits<Derived>::StorageKind StorageKind; 00055 typedef typename internal::traits<Derived>::Index Index; 00056 typedef typename internal::traits<Derived>::Scalar Scalar; 00057 typedef typename internal::packet_traits<Scalar>::type PacketScalar; 00058 typedef typename NumTraits<Scalar>::Real RealScalar; 00059 00060 typedef DenseBase<Derived> Base; 00061 using Base::RowsAtCompileTime; 00062 using Base::ColsAtCompileTime; 00063 using Base::SizeAtCompileTime; 00064 using Base::MaxRowsAtCompileTime; 00065 using Base::MaxColsAtCompileTime; 00066 using Base::MaxSizeAtCompileTime; 00067 using Base::IsVectorAtCompileTime; 00068 using Base::Flags; 00069 using Base::CoeffReadCost; 00070 00071 using Base::derived; 00072 using Base::const_cast_derived; 00073 using Base::rows; 00074 using Base::cols; 00075 using Base::size; 00076 using Base::coeff; 00077 using Base::coeffRef; 00078 using Base::lazyAssign; 00079 using Base::eval; 00080 using Base::operator+=; 00081 using Base::operator-=; 00082 using Base::operator*=; 00083 using Base::operator/=; 00084 00085 typedef typename Base::CoeffReturnType CoeffReturnType; 00086 typedef typename Base::ConstTransposeReturnType ConstTransposeReturnType; 00087 typedef typename Base::RowXpr RowXpr; 00088 typedef typename Base::ColXpr ColXpr; 00089 #endif // not EIGEN_PARSED_BY_DOXYGEN 00090 00091 00092 00093 #ifndef EIGEN_PARSED_BY_DOXYGEN 00094 /** type of the equivalent square matrix */ 00095 typedef Matrix<Scalar,EIGEN_SIZE_MAX(RowsAtCompileTime,ColsAtCompileTime), 00096 EIGEN_SIZE_MAX(RowsAtCompileTime,ColsAtCompileTime)> SquareMatrixType; 00097 #endif // not EIGEN_PARSED_BY_DOXYGEN 00098 00099 /** \returns the size of the main diagonal, which is min(rows(),cols()). 00100 * \sa rows(), cols(), SizeAtCompileTime. */ 00101 inline Index diagonalSize () const { return (std::min)(rows(),cols()); } 00102 00103 /** \brief The plain matrix type corresponding to this expression. 00104 * 00105 * This is not necessarily exactly the return type of eval(). In the case of plain matrices, 00106 * the return type of eval() is a const reference to a matrix, not a matrix! It is however guaranteed 00107 * that the return type of eval() is either PlainObject or const PlainObject&. 00108 */ 00109 typedef Matrix<typename internal::traits<Derived>::Scalar, 00110 internal::traits<Derived>::RowsAtCompileTime, 00111 internal::traits<Derived>::ColsAtCompileTime, 00112 AutoAlign | (internal::traits<Derived>::Flags&RowMajorBit ? RowMajor : ColMajor), 00113 internal::traits<Derived>::MaxRowsAtCompileTime, 00114 internal::traits<Derived>::MaxColsAtCompileTime 00115 > PlainObject; 00116 00117 #ifndef EIGEN_PARSED_BY_DOXYGEN 00118 /** \internal Represents a matrix with all coefficients equal to one another*/ 00119 typedef CwiseNullaryOp<internal::scalar_constant_op<Scalar>,Derived> ConstantReturnType; 00120 /** \internal the return type of MatrixBase::adjoint() */ 00121 typedef typename internal::conditional<NumTraits<Scalar>::IsComplex, 00122 CwiseUnaryOp<internal::scalar_conjugate_op<Scalar>, ConstTransposeReturnType>, 00123 ConstTransposeReturnType 00124 >::type AdjointReturnType; 00125 /** \internal Return type of eigenvalues() */ 00126 typedef Matrix<std::complex<RealScalar>, internal::traits<Derived>::ColsAtCompileTime, 1, ColMajor> EigenvaluesReturnType; 00127 /** \internal the return type of identity */ 00128 typedef CwiseNullaryOp<internal::scalar_identity_op<Scalar>,Derived> IdentityReturnType; 00129 /** \internal the return type of unit vectors */ 00130 typedef Block<const CwiseNullaryOp<internal::scalar_identity_op<Scalar>, SquareMatrixType>, 00131 internal::traits<Derived>::RowsAtCompileTime, 00132 internal::traits<Derived>::ColsAtCompileTime> BasisReturnType; 00133 #endif // not EIGEN_PARSED_BY_DOXYGEN 00134 00135 #define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::MatrixBase 00136 # include "../plugins/CommonCwiseUnaryOps.h" 00137 # include "../plugins/CommonCwiseBinaryOps.h" 00138 # include "../plugins/MatrixCwiseUnaryOps.h" 00139 # include "../plugins/MatrixCwiseBinaryOps.h" 00140 # ifdef EIGEN_MATRIXBASE_PLUGIN 00141 # include EIGEN_MATRIXBASE_PLUGIN 00142 # endif 00143 #undef EIGEN_CURRENT_STORAGE_BASE_CLASS 00144 00145 /** Special case of the template operator=, in order to prevent the compiler 00146 * from generating a default operator= (issue hit with g++ 4.1) 00147 */ 00148 Derived& operator=(const MatrixBase& other); 00149 00150 // We cannot inherit here via Base::operator= since it is causing 00151 // trouble with MSVC. 00152 00153 template <typename OtherDerived> 00154 Derived& operator=(const DenseBase<OtherDerived>& other); 00155 00156 template <typename OtherDerived> 00157 Derived& operator=(const EigenBase<OtherDerived>& other); 00158 00159 template<typename OtherDerived> 00160 Derived& operator=(const ReturnByValue<OtherDerived>& other); 00161 00162 template<typename ProductDerived, typename Lhs, typename Rhs> 00163 Derived& lazyAssign(const ProductBase<ProductDerived, Lhs,Rhs>& other); 00164 00165 template<typename MatrixPower, typename Lhs, typename Rhs> 00166 Derived& lazyAssign(const MatrixPowerProduct<MatrixPower, Lhs,Rhs>& other); 00167 00168 template<typename OtherDerived> 00169 Derived& operator+=(const MatrixBase<OtherDerived>& other); 00170 template<typename OtherDerived> 00171 Derived& operator-=(const MatrixBase<OtherDerived>& other); 00172 00173 template<typename OtherDerived> 00174 const typename ProductReturnType<Derived,OtherDerived>::Type 00175 operator* (const MatrixBase<OtherDerived> &other) const; 00176 00177 template<typename OtherDerived> 00178 const typename LazyProductReturnType<Derived,OtherDerived>::Type 00179 lazyProduct (const MatrixBase<OtherDerived> &other) const; 00180 00181 template<typename OtherDerived> 00182 Derived& operator*=(const EigenBase<OtherDerived>& other); 00183 00184 template<typename OtherDerived> 00185 void applyOnTheLeft(const EigenBase<OtherDerived>& other); 00186 00187 template<typename OtherDerived> 00188 void applyOnTheRight(const EigenBase<OtherDerived>& other); 00189 00190 template<typename DiagonalDerived> 00191 const DiagonalProduct<Derived, DiagonalDerived, OnTheRight> 00192 operator* (const DiagonalBase<DiagonalDerived> &diagonal ) const; 00193 00194 template<typename OtherDerived> 00195 typename internal::scalar_product_traits<typename internal::traits<Derived>::Scalar,typename internal::traits<OtherDerived>::Scalar>::ReturnType 00196 dot (const MatrixBase<OtherDerived>& other) const; 00197 00198 #ifdef EIGEN2_SUPPORT 00199 template<typename OtherDerived> 00200 Scalar eigen2_dot (const MatrixBase<OtherDerived>& other) const; 00201 #endif 00202 00203 RealScalar squaredNorm () const; 00204 RealScalar norm () const; 00205 RealScalar stableNorm () const; 00206 RealScalar blueNorm () const; 00207 RealScalar hypotNorm () const; 00208 const PlainObject normalized () const; 00209 void normalize(); 00210 00211 const AdjointReturnType adjoint () const; 00212 void adjointInPlace(); 00213 00214 typedef Diagonal<Derived> DiagonalReturnType; 00215 DiagonalReturnType diagonal (); 00216 typedef typename internal::add_const<Diagonal<const Derived> >::type ConstDiagonalReturnType; 00217 ConstDiagonalReturnType diagonal () const; 00218 00219 template<int Index> struct DiagonalIndexReturnType { typedef Diagonal<Derived,Index> Type; }; 00220 template<int Index> struct ConstDiagonalIndexReturnType { typedef const Diagonal<const Derived,Index> Type; }; 00221 00222 template<int Index> typename DiagonalIndexReturnType<Index>::Type diagonal (); 00223 template<int Index> typename ConstDiagonalIndexReturnType<Index>::Type diagonal () const; 00224 00225 typedef Diagonal<Derived,DynamicIndex> DiagonalDynamicIndexReturnType; 00226 typedef typename internal::add_const<Diagonal<const Derived,DynamicIndex> >::type ConstDiagonalDynamicIndexReturnType; 00227 00228 DiagonalDynamicIndexReturnType diagonal (Index index); 00229 ConstDiagonalDynamicIndexReturnType diagonal (Index index) const; 00230 00231 #ifdef EIGEN2_SUPPORT 00232 template<unsigned int Mode> typename internal::eigen2_part_return_type<Derived, Mode>::type part (); 00233 template<unsigned int Mode> const typename internal::eigen2_part_return_type<Derived, Mode>::type part () const; 00234 00235 // huuuge hack. make Eigen2's matrix.part<Diagonal>() work in eigen3. Problem: Diagonal is now a class template instead 00236 // of an integer constant. Solution: overload the part() method template wrt template parameters list. 00237 template<template<typename T, int N> class U> 00238 const DiagonalWrapper<ConstDiagonalReturnType> part () const 00239 { return diagonal ().asDiagonal(); } 00240 #endif // EIGEN2_SUPPORT 00241 00242 template<unsigned int Mode> struct TriangularViewReturnType { typedef TriangularView<Derived, Mode> Type; }; 00243 template<unsigned int Mode> struct ConstTriangularViewReturnType { typedef const TriangularView<const Derived, Mode> Type; }; 00244 00245 template<unsigned int Mode> typename TriangularViewReturnType<Mode>::Type triangularView (); 00246 template<unsigned int Mode> typename ConstTriangularViewReturnType<Mode>::Type triangularView () const; 00247 00248 template<unsigned int UpLo> struct SelfAdjointViewReturnType { typedef SelfAdjointView<Derived, UpLo> Type; }; 00249 template<unsigned int UpLo> struct ConstSelfAdjointViewReturnType { typedef const SelfAdjointView<const Derived, UpLo> Type; }; 00250 00251 template<unsigned int UpLo> typename SelfAdjointViewReturnType<UpLo>::Type selfadjointView(); 00252 template<unsigned int UpLo> typename ConstSelfAdjointViewReturnType<UpLo>::Type selfadjointView() const; 00253 00254 const SparseView<Derived> sparseView(const Scalar& m_reference = Scalar(0), 00255 const typename NumTraits<Scalar>::Real& m_epsilon = NumTraits<Scalar>::dummy_precision()) const; 00256 static const IdentityReturnType Identity (); 00257 static const IdentityReturnType Identity (Index rows, Index cols); 00258 static const BasisReturnType Unit (Index size, Index i); 00259 static const BasisReturnType Unit (Index i); 00260 static const BasisReturnType UnitX (); 00261 static const BasisReturnType UnitY (); 00262 static const BasisReturnType UnitZ (); 00263 static const BasisReturnType UnitW (); 00264 00265 const DiagonalWrapper<const Derived> asDiagonal () const; 00266 const PermutationWrapper<const Derived> asPermutation() const; 00267 00268 Derived& setIdentity(); 00269 Derived& setIdentity(Index rows, Index cols); 00270 00271 bool isIdentity (const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const; 00272 bool isDiagonal (const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const; 00273 00274 bool isUpperTriangular (const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const; 00275 bool isLowerTriangular (const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const; 00276 00277 template<typename OtherDerived> 00278 bool isOrthogonal (const MatrixBase<OtherDerived>& other, 00279 const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const; 00280 bool isUnitary (const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const; 00281 00282 /** \returns true if each coefficients of \c *this and \a other are all exactly equal. 00283 * \warning When using floating point scalar values you probably should rather use a 00284 * fuzzy comparison such as isApprox() 00285 * \sa isApprox(), operator!= */ 00286 template<typename OtherDerived> 00287 inline bool operator== (const MatrixBase<OtherDerived>& other) const 00288 { return cwiseEqual(other).all(); } 00289 00290 /** \returns true if at least one pair of coefficients of \c *this and \a other are not exactly equal to each other. 00291 * \warning When using floating point scalar values you probably should rather use a 00292 * fuzzy comparison such as isApprox() 00293 * \sa isApprox(), operator== */ 00294 template<typename OtherDerived> 00295 inline bool operator!= (const MatrixBase<OtherDerived>& other) const 00296 { return cwiseNotEqual(other).any(); } 00297 00298 NoAlias<Derived,Eigen::MatrixBase > noalias (); 00299 00300 inline const ForceAlignedAccess<Derived> forceAlignedAccess () const; 00301 inline ForceAlignedAccess<Derived> forceAlignedAccess (); 00302 template<bool Enable> inline typename internal::add_const_on_value_type<typename internal::conditional<Enable,ForceAlignedAccess<Derived>,Derived&>::type>::type forceAlignedAccessIf () const; 00303 template<bool Enable> inline typename internal::conditional<Enable,ForceAlignedAccess<Derived>,Derived&>::type forceAlignedAccessIf (); 00304 00305 Scalar trace () const; 00306 00307 /////////// Array module /////////// 00308 00309 template<int p> RealScalar lpNorm () const; 00310 00311 MatrixBase<Derived>& matrix() { return *this; } 00312 const MatrixBase<Derived>& matrix() const { return *this; } 00313 00314 /** \returns an \link Eigen::ArrayBase Array \endlink expression of this matrix 00315 * \sa ArrayBase::matrix() */ 00316 ArrayWrapper<Derived> array () { return derived(); } 00317 const ArrayWrapper<const Derived> array () const { return derived(); } 00318 00319 /////////// LU module /////////// 00320 00321 const FullPivLU<PlainObject> fullPivLu () const; 00322 const PartialPivLU<PlainObject> partialPivLu () const; 00323 00324 #if EIGEN2_SUPPORT_STAGE < STAGE20_RESOLVE_API_CONFLICTS 00325 const LU<PlainObject> lu () const; 00326 #endif 00327 00328 #ifdef EIGEN2_SUPPORT 00329 const LU<PlainObject> eigen2_lu() const; 00330 #endif 00331 00332 #if EIGEN2_SUPPORT_STAGE > STAGE20_RESOLVE_API_CONFLICTS 00333 const PartialPivLU<PlainObject> lu () const; 00334 #endif 00335 00336 #ifdef EIGEN2_SUPPORT 00337 template<typename ResultType> 00338 void computeInverse(MatrixBase<ResultType> *result) const { 00339 *result = this->inverse (); 00340 } 00341 #endif 00342 00343 const internal::inverse_impl<Derived> inverse () const; 00344 template<typename ResultType> 00345 void computeInverseAndDetWithCheck ( 00346 ResultType& inverse , 00347 typename ResultType::Scalar& determinant , 00348 bool& invertible, 00349 const RealScalar& absDeterminantThreshold = NumTraits<Scalar>::dummy_precision() 00350 ) const; 00351 template<typename ResultType> 00352 void computeInverseWithCheck ( 00353 ResultType& inverse, 00354 bool& invertible, 00355 const RealScalar& absDeterminantThreshold = NumTraits<Scalar>::dummy_precision() 00356 ) const; 00357 Scalar determinant () const; 00358 00359 /////////// Cholesky module /////////// 00360 00361 const LLT<PlainObject> llt () const; 00362 const LDLT<PlainObject> ldlt () const; 00363 00364 /////////// QR module /////////// 00365 00366 const HouseholderQR<PlainObject> householderQr () const; 00367 const ColPivHouseholderQR<PlainObject> colPivHouseholderQr () const; 00368 const FullPivHouseholderQR<PlainObject> fullPivHouseholderQr () const; 00369 00370 #ifdef EIGEN2_SUPPORT 00371 const QR<PlainObject> qr() const; 00372 #endif 00373 00374 EigenvaluesReturnType eigenvalues() const; 00375 RealScalar operatorNorm() const; 00376 00377 /////////// SVD module /////////// 00378 00379 JacobiSVD<PlainObject> jacobiSvd (unsigned int computationOptions = 0) const; 00380 00381 #ifdef EIGEN2_SUPPORT 00382 SVD<PlainObject> svd() const; 00383 #endif 00384 00385 /////////// Geometry module /////////// 00386 00387 #ifndef EIGEN_PARSED_BY_DOXYGEN 00388 /// \internal helper struct to form the return type of the cross product 00389 template<typename OtherDerived> struct cross_product_return_type { 00390 typedef typename internal::scalar_product_traits<typename internal::traits<Derived>::Scalar,typename internal::traits<OtherDerived>::Scalar>::ReturnType Scalar; 00391 typedef Matrix<Scalar,MatrixBase::RowsAtCompileTime,MatrixBase::ColsAtCompileTime> type; 00392 }; 00393 #endif // EIGEN_PARSED_BY_DOXYGEN 00394 template<typename OtherDerived> 00395 typename cross_product_return_type<OtherDerived>::type 00396 cross (const MatrixBase<OtherDerived>& other) const; 00397 template<typename OtherDerived> 00398 PlainObject cross3 (const MatrixBase<OtherDerived>& other) const; 00399 PlainObject unitOrthogonal (void) const; 00400 Matrix<Scalar,3,1> eulerAngles (Index a0, Index a1, Index a2) const; 00401 00402 #if EIGEN2_SUPPORT_STAGE > STAGE20_RESOLVE_API_CONFLICTS 00403 ScalarMultipleReturnType operator* (const UniformScaling<Scalar>& s) const; 00404 // put this as separate enum value to work around possible GCC 4.3 bug (?) 00405 enum { HomogeneousReturnTypeDirection = ColsAtCompileTime==1?Vertical:Horizontal }; 00406 typedef Homogeneous<Derived, HomogeneousReturnTypeDirection> HomogeneousReturnType; 00407 HomogeneousReturnType homogeneous () const; 00408 #endif 00409 00410 enum { 00411 SizeMinusOne = SizeAtCompileTime==Dynamic ? Dynamic : SizeAtCompileTime-1 00412 }; 00413 typedef Block<const Derived, 00414 internal::traits<Derived>::ColsAtCompileTime==1 ? SizeMinusOne : 1, 00415 internal::traits<Derived>::ColsAtCompileTime==1 ? 1 : SizeMinusOne> ConstStartMinusOne; 00416 typedef CwiseUnaryOp<internal::scalar_quotient1_op<typename internal::traits<Derived>::Scalar>, 00417 const ConstStartMinusOne > HNormalizedReturnType; 00418 00419 const HNormalizedReturnType hnormalized () const; 00420 00421 ////////// Householder module /////////// 00422 00423 void makeHouseholderInPlace(Scalar& tau, RealScalar& beta); 00424 template<typename EssentialPart> 00425 void makeHouseholder(EssentialPart& essential, 00426 Scalar& tau, RealScalar& beta) const; 00427 template<typename EssentialPart> 00428 void applyHouseholderOnTheLeft(const EssentialPart& essential, 00429 const Scalar& tau, 00430 Scalar* workspace); 00431 template<typename EssentialPart> 00432 void applyHouseholderOnTheRight(const EssentialPart& essential, 00433 const Scalar& tau, 00434 Scalar* workspace); 00435 00436 ///////// Jacobi module ///////// 00437 00438 template<typename OtherScalar> 00439 void applyOnTheLeft(Index p, Index q, const JacobiRotation<OtherScalar>& j); 00440 template<typename OtherScalar> 00441 void applyOnTheRight(Index p, Index q, const JacobiRotation<OtherScalar>& j); 00442 00443 ///////// SparseCore module ///////// 00444 00445 template<typename OtherDerived> 00446 EIGEN_STRONG_INLINE const typename SparseMatrixBase<OtherDerived>::template CwiseProductDenseReturnType<Derived>::Type 00447 cwiseProduct(const SparseMatrixBase<OtherDerived> &other) const 00448 { 00449 return other.cwiseProduct(derived()); 00450 } 00451 00452 ///////// MatrixFunctions module ///////// 00453 00454 typedef typename internal::stem_function<Scalar>::type StemFunction; 00455 const MatrixExponentialReturnValue<Derived> exp() const; 00456 const MatrixFunctionReturnValue<Derived> matrixFunction(StemFunction f) const; 00457 const MatrixFunctionReturnValue<Derived> cosh() const; 00458 const MatrixFunctionReturnValue<Derived> sinh() const; 00459 const MatrixFunctionReturnValue<Derived> cos() const; 00460 const MatrixFunctionReturnValue<Derived> sin() const; 00461 const MatrixSquareRootReturnValue<Derived> sqrt() const; 00462 const MatrixLogarithmReturnValue<Derived> log() const; 00463 const MatrixPowerReturnValue<Derived> pow(const RealScalar& p) const; 00464 00465 #ifdef EIGEN2_SUPPORT 00466 template<typename ProductDerived, typename Lhs, typename Rhs> 00467 Derived& operator+=(const Flagged<ProductBase<ProductDerived, Lhs,Rhs>, 0, 00468 EvalBeforeAssigningBit>& other); 00469 00470 template<typename ProductDerived, typename Lhs, typename Rhs> 00471 Derived& operator-=(const Flagged<ProductBase<ProductDerived, Lhs,Rhs>, 0, 00472 EvalBeforeAssigningBit>& other); 00473 00474 /** \deprecated because .lazy() is deprecated 00475 * Overloaded for cache friendly product evaluation */ 00476 template<typename OtherDerived> 00477 Derived& lazyAssign(const Flagged<OtherDerived, 0, EvalBeforeAssigningBit>& other) 00478 { return lazyAssign (other._expression()); } 00479 00480 template<unsigned int Added> 00481 const Flagged<Derived, Added, 0> marked() const; 00482 const Flagged<Derived, 0, EvalBeforeAssigningBit> lazy() const; 00483 00484 inline const Cwise<Derived> cwise() const; 00485 inline Cwise<Derived> cwise(); 00486 00487 VectorBlock<Derived> start(Index size); 00488 const VectorBlock<const Derived> start(Index size) const; 00489 VectorBlock<Derived> end(Index size); 00490 const VectorBlock<const Derived> end(Index size) const; 00491 template<int Size> VectorBlock<Derived,Size> start(); 00492 template<int Size> const VectorBlock<const Derived,Size> start() const; 00493 template<int Size> VectorBlock<Derived,Size> end(); 00494 template<int Size> const VectorBlock<const Derived,Size> end() const; 00495 00496 Minor<Derived> minor(Index row, Index col); 00497 const Minor<Derived> minor(Index row, Index col) const; 00498 #endif 00499 00500 protected: 00501 MatrixBase() : Base() {} 00502 00503 private: 00504 explicit MatrixBase(int); 00505 MatrixBase(int,int); 00506 template<typename OtherDerived> explicit MatrixBase(const MatrixBase<OtherDerived>&); 00507 protected: 00508 // mixing arrays and matrices is not legal 00509 template<typename OtherDerived> Derived& operator+=(const ArrayBase<OtherDerived>& ) 00510 {EIGEN_STATIC_ASSERT(std::ptrdiff_t(sizeof(typename OtherDerived::Scalar))==-1,YOU_CANNOT_MIX_ARRAYS_AND_MATRICES); return *this;} 00511 // mixing arrays and matrices is not legal 00512 template<typename OtherDerived> Derived& operator-=(const ArrayBase<OtherDerived>& ) 00513 {EIGEN_STATIC_ASSERT(std::ptrdiff_t(sizeof(typename OtherDerived::Scalar))==-1,YOU_CANNOT_MIX_ARRAYS_AND_MATRICES); return *this;} 00514 }; 00515 00516 00517 /*************************************************************************** 00518 * Implementation of matrix base methods 00519 ***************************************************************************/ 00520 00521 /** replaces \c *this by \c *this * \a other. 00522 * 00523 * \returns a reference to \c *this 00524 * 00525 * Example: \include MatrixBase_applyOnTheRight.cpp 00526 * Output: \verbinclude MatrixBase_applyOnTheRight.out 00527 */ 00528 template<typename Derived> 00529 template<typename OtherDerived> 00530 inline Derived& 00531 MatrixBase<Derived>::operator*=(const EigenBase<OtherDerived> &other) 00532 { 00533 other.derived ().applyThisOnTheRight(derived()); 00534 return derived(); 00535 } 00536 00537 /** replaces \c *this by \c *this * \a other. It is equivalent to MatrixBase::operator*=(). 00538 * 00539 * Example: \include MatrixBase_applyOnTheRight.cpp 00540 * Output: \verbinclude MatrixBase_applyOnTheRight.out 00541 */ 00542 template<typename Derived> 00543 template<typename OtherDerived> 00544 inline void MatrixBase<Derived>::applyOnTheRight(const EigenBase<OtherDerived> &other) 00545 { 00546 other.derived ().applyThisOnTheRight(derived()); 00547 } 00548 00549 /** replaces \c *this by \a other * \c *this. 00550 * 00551 * Example: \include MatrixBase_applyOnTheLeft.cpp 00552 * Output: \verbinclude MatrixBase_applyOnTheLeft.out 00553 */ 00554 template<typename Derived> 00555 template<typename OtherDerived> 00556 inline void MatrixBase<Derived>::applyOnTheLeft(const EigenBase<OtherDerived> &other) 00557 { 00558 other.derived ().applyThisOnTheLeft(derived()); 00559 } 00560 00561 } // end namespace Eigen 00562 00563 #endif // EIGEN_MATRIXBASE_H
Generated on Tue Jul 12 2022 17:46:58 by
