11#ifndef EIGEN_MATRIXBASE_H
12#define EIGEN_MATRIXBASE_H
48template<
typename Derived>
class MatrixBase
52#ifndef EIGEN_PARSED_BY_DOXYGEN
53 typedef MatrixBase StorageBaseType;
54 typedef typename internal::traits<Derived>::StorageKind StorageKind;
55 typedef typename internal::traits<Derived>::Index
Index;
56 typedef typename internal::traits<Derived>::Scalar Scalar;
57 typedef typename internal::packet_traits<Scalar>::type PacketScalar;
58 typedef typename NumTraits<Scalar>::Real RealScalar;
61 using Base::RowsAtCompileTime;
62 using Base::ColsAtCompileTime;
63 using Base::SizeAtCompileTime;
64 using Base::MaxRowsAtCompileTime;
65 using Base::MaxColsAtCompileTime;
66 using Base::MaxSizeAtCompileTime;
67 using Base::IsVectorAtCompileTime;
69 using Base::CoeffReadCost;
72 using Base::const_cast_derived;
78 using Base::lazyAssign;
80 using Base::operator+=;
81 using Base::operator-=;
82 using Base::operator*=;
83 using Base::operator/=;
85 typedef typename Base::CoeffReturnType CoeffReturnType;
86 typedef typename Base::ConstTransposeReturnType ConstTransposeReturnType;
87 typedef typename Base::RowXpr RowXpr;
88 typedef typename Base::ColXpr ColXpr;
93#ifndef EIGEN_PARSED_BY_DOXYGEN
110 internal::traits<Derived>::RowsAtCompileTime,
111 internal::traits<Derived>::ColsAtCompileTime,
113 internal::traits<Derived>::MaxRowsAtCompileTime,
114 internal::traits<Derived>::MaxColsAtCompileTime
117#ifndef EIGEN_PARSED_BY_DOXYGEN
121 typedef typename internal::conditional<NumTraits<Scalar>::IsComplex,
123 ConstTransposeReturnType
124 >::type AdjointReturnType;
131 internal::traits<Derived>::RowsAtCompileTime,
132 internal::traits<Derived>::ColsAtCompileTime> BasisReturnType;
135#define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::MatrixBase
136# include "../plugins/CommonCwiseUnaryOps.h"
137# include "../plugins/CommonCwiseBinaryOps.h"
138# include "../plugins/MatrixCwiseUnaryOps.h"
139# include "../plugins/MatrixCwiseBinaryOps.h"
140# ifdef EIGEN_MATRIXBASE_PLUGIN
141# include EIGEN_MATRIXBASE_PLUGIN
143#undef EIGEN_CURRENT_STORAGE_BASE_CLASS
148 Derived&
operator=(
const MatrixBase& other);
153 template <
typename OtherDerived>
156 template <
typename OtherDerived>
159 template<
typename OtherDerived>
160 Derived&
operator=(
const ReturnByValue<OtherDerived>& other);
162#ifndef EIGEN_PARSED_BY_DOXYGEN
163 template<
typename ProductDerived,
typename Lhs,
typename Rhs>
164 Derived& lazyAssign(
const ProductBase<ProductDerived, Lhs,Rhs>& other);
167 template<
typename OtherDerived>
168 Derived&
operator+=(
const MatrixBase<OtherDerived>& other);
169 template<
typename OtherDerived>
172 template<
typename OtherDerived>
173 const typename ProductReturnType<Derived,OtherDerived>::Type
174 operator*(
const MatrixBase<OtherDerived> &other)
const;
176 template<
typename OtherDerived>
177 const typename LazyProductReturnType<Derived,OtherDerived>::Type
178 lazyProduct(
const MatrixBase<OtherDerived> &other)
const;
180 template<
typename OtherDerived>
183 template<
typename OtherDerived>
186 template<
typename OtherDerived>
189 template<
typename DiagonalDerived>
190 const DiagonalProduct<Derived, DiagonalDerived, OnTheRight>
193 template<
typename OtherDerived>
194 typename internal::scalar_product_traits<typename internal::traits<Derived>::Scalar,
typename internal::traits<OtherDerived>::Scalar>::ReturnType
195 dot(
const MatrixBase<OtherDerived>& other)
const;
197 #ifdef EIGEN2_SUPPORT
198 template<
typename OtherDerived>
199 Scalar eigen2_dot(
const MatrixBase<OtherDerived>& other)
const;
210 const AdjointReturnType
adjoint()
const;
216 const ConstDiagonalReturnType
diagonal()
const;
221 template<
int Index>
typename DiagonalIndexReturnType<Index>::Type
diagonal();
222 template<
int Index>
typename ConstDiagonalIndexReturnType<Index>::Type
diagonal()
const;
226 #if (defined _MSC_VER) && (_MSC_VER >= 1500)
227 typename MatrixBase::template DiagonalIndexReturnType<Dynamic>::Type
diagonal(
Index index);
228 typename MatrixBase::template ConstDiagonalIndexReturnType<Dynamic>::Type
diagonal(
Index index)
const;
230 typename DiagonalIndexReturnType<Dynamic>::Type
diagonal(
Index index);
231 typename ConstDiagonalIndexReturnType<Dynamic>::Type
diagonal(
Index index)
const;
234 #ifdef EIGEN2_SUPPORT
235 template<
unsigned int Mode>
typename internal::eigen2_part_return_type<Derived, Mode>::type part();
236 template<
unsigned int Mode>
const typename internal::eigen2_part_return_type<Derived, Mode>::type part()
const;
240 template<
template<
typename T,
int N>
class U>
246 template<
unsigned int Mode>
struct ConstTriangularViewReturnType {
typedef const TriangularView<const Derived, Mode> Type; };
248 template<
unsigned int Mode>
typename TriangularViewReturnType<Mode>::Type triangularView();
249 template<
unsigned int Mode>
typename ConstTriangularViewReturnType<Mode>::Type triangularView()
const;
254 template<
unsigned int UpLo>
typename SelfAdjointViewReturnType<UpLo>::Type selfadjointView();
255 template<
unsigned int UpLo>
typename ConstSelfAdjointViewReturnType<UpLo>::Type selfadjointView()
const;
257 const SparseView<Derived> sparseView(
const Scalar& m_reference = Scalar(0),
258 typename NumTraits<Scalar>::Real m_epsilon = NumTraits<Scalar>::dummy_precision())
const;
259 static const IdentityReturnType
Identity();
262 static const BasisReturnType
Unit(
Index i);
263 static const BasisReturnType
UnitX();
264 static const BasisReturnType
UnitY();
265 static const BasisReturnType
UnitZ();
266 static const BasisReturnType
UnitW();
274 bool isIdentity(RealScalar prec = NumTraits<Scalar>::dummy_precision())
const;
275 bool isDiagonal(RealScalar prec = NumTraits<Scalar>::dummy_precision())
const;
277 bool isUpperTriangular(RealScalar prec = NumTraits<Scalar>::dummy_precision())
const;
278 bool isLowerTriangular(RealScalar prec = NumTraits<Scalar>::dummy_precision())
const;
280 template<
typename OtherDerived>
281 bool isOrthogonal(
const MatrixBase<OtherDerived>& other,
282 RealScalar prec = NumTraits<Scalar>::dummy_precision())
const;
283 bool isUnitary(RealScalar prec = NumTraits<Scalar>::dummy_precision())
const;
289 template<
typename OtherDerived>
290 inline bool operator==(
const MatrixBase<OtherDerived>& other)
const
297 template<
typename OtherDerived>
298 inline bool operator!=(
const MatrixBase<OtherDerived>& other)
const
299 {
return cwiseNotEqual(other).any(); }
305 template<
bool Enable>
inline typename internal::add_const_on_value_type<typename internal::conditional<Enable,ForceAlignedAccess<Derived>,Derived&>::type>::type
forceAlignedAccessIf()
const;
306 template<
bool Enable>
inline typename internal::conditional<Enable,ForceAlignedAccess<Derived>,Derived&>::type
forceAlignedAccessIf();
312 template<
int p> RealScalar lpNorm()
const;
314 MatrixBase<Derived>& matrix() {
return *
this; }
319 ArrayWrapper<Derived>
array() {
return derived(); }
320 const ArrayWrapper<const Derived>
array()
const {
return derived(); }
324 const FullPivLU<PlainObject>
fullPivLu()
const;
327 #if EIGEN2_SUPPORT_STAGE < STAGE20_RESOLVE_API_CONFLICTS
328 const LU<PlainObject>
lu()
const;
331 #ifdef EIGEN2_SUPPORT
332 const LU<PlainObject> eigen2_lu()
const;
335 #if EIGEN2_SUPPORT_STAGE > STAGE20_RESOLVE_API_CONFLICTS
339 #ifdef EIGEN2_SUPPORT
340 template<
typename ResultType>
341 void computeInverse(MatrixBase<ResultType> *result)
const {
346 const internal::inverse_impl<Derived>
inverse()
const;
347 template<
typename ResultType>
352 const RealScalar& absDeterminantThreshold = NumTraits<Scalar>::dummy_precision()
354 template<
typename ResultType>
358 const RealScalar& absDeterminantThreshold = NumTraits<Scalar>::dummy_precision()
373 #ifdef EIGEN2_SUPPORT
374 const QR<PlainObject> qr()
const;
384 #ifdef EIGEN2_SUPPORT
385 SVD<PlainObject> svd()
const;
390 #ifndef EIGEN_PARSED_BY_DOXYGEN
392 template<
typename OtherDerived>
struct cross_product_return_type {
393 typedef typename internal::scalar_product_traits<typename internal::traits<Derived>::Scalar,
typename internal::traits<OtherDerived>::Scalar>::ReturnType Scalar;
397 template<
typename OtherDerived>
398 typename cross_product_return_type<OtherDerived>::type
399 cross(
const MatrixBase<OtherDerived>& other)
const;
400 template<
typename OtherDerived>
405 #if EIGEN2_SUPPORT_STAGE > STAGE20_RESOLVE_API_CONFLICTS
406 ScalarMultipleReturnType
operator*(
const UniformScaling<Scalar>& s)
const;
416 typedef Block<
const Derived,
417 internal::traits<Derived>::ColsAtCompileTime==1 ? SizeMinusOne : 1,
418 internal::traits<Derived>::ColsAtCompileTime==1 ? 1 : SizeMinusOne> ConstStartMinusOne;
420 const ConstStartMinusOne > HNormalizedReturnType;
427 template<
typename EssentialPart>
429 Scalar& tau, RealScalar& beta)
const;
430 template<
typename EssentialPart>
434 template<
typename EssentialPart>
441 template<
typename OtherScalar>
443 template<
typename OtherScalar>
448 typedef typename internal::stem_function<Scalar>::type StemFunction;
459 template<
typename ProductDerived,
typename Lhs,
typename Rhs>
460 Derived&
operator+=(
const Flagged<ProductBase<ProductDerived, Lhs,Rhs>, 0,
463 template<
typename ProductDerived,
typename Lhs,
typename Rhs>
464 Derived&
operator-=(
const Flagged<ProductBase<ProductDerived, Lhs,Rhs>, 0,
469 template<
typename OtherDerived>
470 Derived& lazyAssign(
const Flagged<OtherDerived, 0, EvalBeforeAssigningBit>& other)
471 {
return lazyAssign(other._expression()); }
473 template<
unsigned int Added>
474 const Flagged<Derived, Added, 0> marked()
const;
475 const Flagged<Derived, 0, EvalBeforeAssigningBit> lazy()
const;
477 inline const Cwise<Derived> cwise()
const;
478 inline Cwise<Derived> cwise();
489 Minor<Derived> minor(Index row, Index col);
490 const Minor<Derived> minor(Index row, Index col)
const;
497 explicit MatrixBase(
int);
499 template<
typename OtherDerived>
explicit MatrixBase(
const MatrixBase<OtherDerived>&);
502 template<
typename OtherDerived> Derived&
operator+=(
const ArrayBase<OtherDerived>& )
503 {EIGEN_STATIC_ASSERT(std::ptrdiff_t(
sizeof(
typename OtherDerived::Scalar))==-1,YOU_CANNOT_MIX_ARRAYS_AND_MATRICES);
return *
this;}
505 template<
typename OtherDerived> Derived&
operator-=(
const ArrayBase<OtherDerived>& )
506 {EIGEN_STATIC_ASSERT(std::ptrdiff_t(
sizeof(
typename OtherDerived::Scalar))==-1,YOU_CANNOT_MIX_ARRAYS_AND_MATRICES);
return *
this;}
Expression of a fixed-size or dynamic-size block.
Definition Block.h:99
Householder rank-revealing QR decomposition of a matrix with column-pivoting.
Definition ColPivHouseholderQR.h:38
Generic expression of a matrix where all coefficients are defined by a functor.
Definition CwiseNullaryOp.h:51
Generic expression where a coefficient-wise unary operator is applied to an expression.
Definition CwiseUnaryOp.h:61
DenseBase()
Definition DenseBase.h:513
internal::traits< MatrixWrapper< ExpressionType > >::Index Index
Definition DenseBase.h:51
@ RowsAtCompileTime
Definition DenseBase.h:92
@ SizeAtCompileTime
Definition DenseBase.h:105
@ ColsAtCompileTime
Definition DenseBase.h:98
Expression of a diagonal matrix.
Definition DiagonalMatrix.h:245
Expression of a diagonal/subdiagonal/superdiagonal in a matrix.
Definition Diagonal.h:66
Enforce aligned packet loads and stores regardless of what is requested.
Definition ForceAlignedAccess.h:36
Householder rank-revealing QR decomposition of a matrix with full pivoting.
Definition FullPivHouseholderQR.h:50
Expression of one (or a set of) homogeneous vector(s)
Definition Homogeneous.h:63
Householder QR decomposition of a matrix.
Definition HouseholderQR.h:43
Rotation given by a cosine-sine pair.
Definition Jacobi.h:35
Two-sided Jacobi SVD decomposition of a rectangular matrix.
Definition JacobiSVD.h:479
Robust Cholesky decomposition of a matrix with pivoting.
Definition LDLT.h:46
Standard Cholesky decomposition (LL^T) of a matrix and associated features.
Definition LLT.h:51
Base class for all dense matrices, vectors, and expressions.
Definition MatrixBase.h:50
static const IdentityReturnType Identity()
Definition CwiseNullaryOp.h:700
const PlainObject normalized() const
Definition Dot.h:138
const PartialPivLU< PlainObject > partialPivLu() const
Definition PartialPivLU.h:474
const LazyProductReturnType< Derived, OtherDerived >::Type lazyProduct(const MatrixBase< OtherDerived > &other) const
Definition GeneralProduct.h:590
static const BasisReturnType UnitZ()
Definition CwiseNullaryOp.h:849
void applyHouseholderOnTheRight(const EssentialPart &essential, const Scalar &tau, Scalar *workspace)
Definition Householder.h:146
const ScalarMultipleReturnType operator*(const Scalar &scalar) const
Definition MatrixBase.h:50
internal::add_const_on_value_type< typenameinternal::conditional< Enable, ForceAlignedAccess< Derived >, Derived & >::type >::type forceAlignedAccessIf() const
Definition ForceAlignedAccess.h:128
void computeInverseWithCheck(ResultType &inverse, bool &invertible, const RealScalar &absDeterminantThreshold=NumTraits< Scalar >::dummy_precision()) const
Definition Inverse.h:382
Derived & operator-=(const MatrixBase< OtherDerived > &other)
Definition CwiseBinaryOp.h:206
const HNormalizedReturnType hnormalized() const
Definition Homogeneous.h:158
const DiagonalWrapper< const Derived > asDiagonal() const
Definition DiagonalMatrix.h:273
bool isDiagonal(RealScalar prec=NumTraits< Scalar >::dummy_precision()) const
Definition DiagonalMatrix.h:287
bool operator==(const MatrixBase< OtherDerived > &other) const
Definition MatrixBase.h:279
HomogeneousReturnType homogeneous() const
Definition Homogeneous.h:127
ArrayWrapper< Derived > array()
Definition MatrixBase.h:308
static const BasisReturnType UnitW()
Definition CwiseNullaryOp.h:859
static const BasisReturnType UnitX()
Definition CwiseNullaryOp.h:829
void applyHouseholderOnTheLeft(const EssentialPart &essential, const Scalar &tau, Scalar *workspace)
Definition Householder.h:109
const internal::inverse_impl< Derived > inverse() const
Definition Inverse.h:316
PlainObject unitOrthogonal(void) const
Definition OrthoMethods.h:210
void applyOnTheRight(const EigenBase< OtherDerived > &other)
Definition EigenBase.h:145
EigenvaluesReturnType eigenvalues() const
Computes the eigenvalues of a matrix.
Definition MatrixBaseEigenvalues.h:67
const LLT< PlainObject > llt() const
Definition LLT.h:471
Derived & operator+=(const MatrixBase< OtherDerived > &other)
Definition CwiseBinaryOp.h:220
const ColPivHouseholderQR< PlainObject > colPivHouseholderQr() const
Definition ColPivHouseholderQR.h:519
bool isOrthogonal(const MatrixBase< OtherDerived > &other, RealScalar prec=NumTraits< Scalar >::dummy_precision()) const
Definition Dot.h:226
RealScalar squaredNorm() const
Definition Dot.h:113
const FullPivHouseholderQR< PlainObject > fullPivHouseholderQr() const
Definition FullPivHouseholderQR.h:588
RealScalar stableNorm() const
Definition StableNorm.h:45
RealScalar norm() const
Definition Dot.h:125
JacobiSVD< PlainObject > jacobiSvd(unsigned int computationOptions=0) const
Definition JacobiSVD.h:856
bool operator!=(const MatrixBase< OtherDerived > &other) const
Definition MatrixBase.h:287
RealScalar hypotNorm() const
Definition StableNorm.h:170
void applyOnTheLeft(const EigenBase< OtherDerived > &other)
Definition EigenBase.h:153
Scalar trace() const
Definition Redux.h:399
bool isUnitary(RealScalar prec=NumTraits< Scalar >::dummy_precision()) const
Definition Dot.h:245
Scalar determinant() const
const CwiseUnaryOp< std::binder1st< std::equal_to< Scalar > >, const Derived > cwiseEqual(const Scalar &s) const
Definition MatrixBase.h:64
void makeHouseholder(EssentialPart &essential, Scalar &tau, RealScalar &beta) const
Definition Householder.h:65
bool isIdentity(RealScalar prec=NumTraits< Scalar >::dummy_precision()) const
Definition CwiseNullaryOp.h:717
void computeInverseAndDetWithCheck(ResultType &inverse, typename ResultType::Scalar &determinant, bool &invertible, const RealScalar &absDeterminantThreshold=NumTraits< Scalar >::dummy_precision()) const
Definition Inverse.h:343
void adjointInPlace()
Definition Transpose.h:319
void makeHouseholderInPlace(Scalar &tau, RealScalar &beta)
Definition Householder.h:42
internal::scalar_product_traits< typenameinternal::traits< Derived >::Scalar, typenameinternal::traits< OtherDerived >::Scalar >::ReturnType dot(const MatrixBase< OtherDerived > &other) const
Definition Dot.h:63
static const BasisReturnType UnitY()
Definition CwiseNullaryOp.h:839
Matrix< typename internal::traits< MatrixWrapper< ExpressionType > >::Scalar, internal::traits< MatrixWrapper< ExpressionType > >::RowsAtCompileTime, internal::traits< MatrixWrapper< ExpressionType > >::ColsAtCompileTime, AutoAlign|(internal::traits< MatrixWrapper< ExpressionType > >::Flags &RowMajorBit ? RowMajor :ColMajor), internal::traits< MatrixWrapper< ExpressionType > >::MaxRowsAtCompileTime, internal::traits< MatrixWrapper< ExpressionType > >::MaxColsAtCompileTime > PlainObject
Definition MatrixBase.h:115
Derived & operator*=(const EigenBase< OtherDerived > &other)
Definition EigenBase.h:136
RealScalar operatorNorm() const
Computes the L2 operator norm.
Definition MatrixBaseEigenvalues.h:122
void normalize()
Definition Dot.h:153
const FullPivLU< PlainObject > fullPivLu() const
Definition FullPivLU.h:729
const LDLT< PlainObject > ldlt() const
Definition LDLT.h:592
PlainObject cross3(const MatrixBase< OtherDerived > &other) const
Definition OrthoMethods.h:74
const PartialPivLU< PlainObject > lu() const
Definition PartialPivLU.h:490
Index diagonalSize() const
Definition MatrixBase.h:101
const EIGEN_CWISE_PRODUCT_RETURN_TYPE(Derived, OtherDerived) cwiseProduct(const Eigen Derived & operator=(const DenseBase< OtherDerived > &other)
RealScalar blueNorm() const
Definition StableNorm.h:75
const HouseholderQR< PlainObject > householderQr() const
Definition HouseholderQR.h:336
NoAlias< Derived, Eigen::MatrixBase > noalias()
Definition NoAlias.h:118
DiagonalReturnType diagonal()
static const BasisReturnType Unit(Index size, Index i)
Definition CwiseNullaryOp.h:801
const AdjointReturnType adjoint() const
Definition Transpose.h:237
Derived & setIdentity()
Definition CwiseNullaryOp.h:772
bool isLowerTriangular(RealScalar prec=NumTraits< Scalar >::dummy_precision()) const
Definition TriangularMatrix.h:807
bool isUpperTriangular(RealScalar prec=NumTraits< Scalar >::dummy_precision()) const
Definition TriangularMatrix.h:782
const ForceAlignedAccess< Derived > forceAlignedAccess() const
Definition ForceAlignedAccess.h:107
The matrix class, also used for vectors and row-vectors.
Definition Matrix.h:129
Pseudo expression providing an operator = assuming no aliasing.
Definition NoAlias.h:32
LU decomposition of a matrix with partial pivoting, and related features.
Definition PartialPivLU.h:48
Class to view a vector of integers as a permutation matrix.
Definition PermutationMatrix.h:484
Expression of a selfadjoint matrix from a triangular part of a dense matrix.
Definition SelfAdjointView.h:55
Base class for triangular part in a matrix.
Definition TriangularMatrix.h:160
Expression of a fixed-size or dynamic-size sub-vector.
Definition VectorBlock.h:61
Matrix< Scalar, 3, 1 > eulerAngles(Index a0, Index a1, Index a2) const
Definition EulerAngles.h:33
@ RowMajor
Definition Constants.h:259
@ ColMajor
Definition Constants.h:257
@ Vertical
Definition Constants.h:204
@ Horizontal
Definition Constants.h:207
const unsigned int RowMajorBit
Definition Constants.h:48
const unsigned int EvalBeforeAssigningBit
Definition Constants.h:58
Definition EigenBase.h:27