11#ifndef EIGEN_MATRIXBASE_H
12#define EIGEN_MATRIXBASE_H
52#ifndef EIGEN_PARSED_BY_DOXYGEN
54 typedef typename internal::traits<Derived>::StorageKind StorageKind;
55 typedef typename internal::traits<Derived>::StorageIndex
StorageIndex;
56 typedef typename internal::traits<Derived>::Scalar
Scalar;
57 typedef typename internal::packet_traits<Scalar>::type PacketScalar;
58 typedef typename NumTraits<Scalar>::Real RealScalar;
60 typedef DenseBase<Derived> Base;
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;
71 using Base::const_cast_derived;
77 using Base::lazyAssign;
79 using Base::operator+=;
80 using Base::operator-=;
81 using Base::operator*=;
82 using Base::operator/=;
84 typedef typename Base::CoeffReturnType CoeffReturnType;
85 typedef typename Base::ConstTransposeReturnType ConstTransposeReturnType;
86 typedef typename Base::RowXpr RowXpr;
87 typedef typename Base::ColXpr ColXpr;
92#ifndef EIGEN_PARSED_BY_DOXYGEN
103 typedef typename Base::PlainObject PlainObject;
105#ifndef EIGEN_PARSED_BY_DOXYGEN
107 typedef CwiseNullaryOp<internal::scalar_constant_op<Scalar>,PlainObject> ConstantReturnType;
109 typedef typename internal::conditional<NumTraits<Scalar>::IsComplex,
110 CwiseUnaryOp<internal::scalar_conjugate_op<Scalar>, ConstTransposeReturnType>,
111 ConstTransposeReturnType
112 >::type AdjointReturnType;
114 typedef Matrix<std::complex<RealScalar>, internal::traits<Derived>::ColsAtCompileTime, 1,
ColMajor> EigenvaluesReturnType;
116 typedef CwiseNullaryOp<internal::scalar_identity_op<Scalar>,PlainObject> IdentityReturnType;
118 typedef Block<const CwiseNullaryOp<internal::scalar_identity_op<Scalar>, SquareMatrixType>,
119 internal::traits<Derived>::RowsAtCompileTime,
120 internal::traits<Derived>::ColsAtCompileTime> BasisReturnType;
123#define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::MatrixBase
124#define EIGEN_DOC_UNARY_ADDONS(X,Y)
125# include "../plugins/CommonCwiseUnaryOps.h"
126# include "../plugins/CommonCwiseBinaryOps.h"
127# include "../plugins/MatrixCwiseUnaryOps.h"
128# include "../plugins/MatrixCwiseBinaryOps.h"
129# ifdef EIGEN_MATRIXBASE_PLUGIN
130# include EIGEN_MATRIXBASE_PLUGIN
132#undef EIGEN_CURRENT_STORAGE_BASE_CLASS
133#undef EIGEN_DOC_UNARY_ADDONS
138 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
144 template <
typename OtherDerived>
145 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
146 Derived&
operator=(
const DenseBase<OtherDerived>& other);
148 template <
typename OtherDerived>
150 Derived&
operator=(
const EigenBase<OtherDerived>& other);
152 template<
typename OtherDerived>
154 Derived&
operator=(
const ReturnByValue<OtherDerived>& other);
156 template<
typename OtherDerived>
157 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
158 Derived&
operator+=(
const MatrixBase<OtherDerived>& other);
159 template<
typename OtherDerived>
160 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
161 Derived&
operator-=(
const MatrixBase<OtherDerived>& other);
164 template<
typename OtherDerived>
166 const Product<Derived,OtherDerived,LazyProduct>
167 operator*(
const MatrixBase<OtherDerived> &other)
const
171 template<
typename OtherDerived>
172 const Product<Derived,OtherDerived>
173 operator*(
const MatrixBase<OtherDerived> &other)
const;
177 template<
typename OtherDerived>
179 const Product<Derived,OtherDerived,LazyProduct>
180 lazyProduct(
const MatrixBase<OtherDerived> &other)
const;
182 template<
typename OtherDerived>
185 template<
typename OtherDerived>
188 template<
typename OtherDerived>
191 template<
typename DiagonalDerived>
193 const Product<Derived, DiagonalDerived, LazyProduct>
196 template<
typename OtherDerived>
198 typename ScalarBinaryOpTraits<typename internal::traits<Derived>::Scalar,
typename internal::traits<OtherDerived>::Scalar>::ReturnType
199 dot(
const MatrixBase<OtherDerived>& other)
const;
202 EIGEN_DEVICE_FUNC RealScalar
norm()
const;
206 EIGEN_DEVICE_FUNC
const PlainObject
normalized()
const;
211 EIGEN_DEVICE_FUNC
const AdjointReturnType
adjoint()
const;
214 typedef Diagonal<Derived> DiagonalReturnType;
218 typedef typename internal::add_const<Diagonal<const Derived> >::type ConstDiagonalReturnType;
220 ConstDiagonalReturnType
diagonal()
const;
222 template<
int Index>
struct DiagonalIndexReturnType {
typedef Diagonal<Derived,Index> Type; };
223 template<
int Index>
struct ConstDiagonalIndexReturnType {
typedef const Diagonal<const Derived,Index> Type; };
227 typename DiagonalIndexReturnType<Index>::Type
diagonal();
231 typename ConstDiagonalIndexReturnType<Index>::Type
diagonal()
const;
233 typedef Diagonal<Derived,DynamicIndex> DiagonalDynamicIndexReturnType;
234 typedef typename internal::add_const<Diagonal<const Derived,DynamicIndex> >::type ConstDiagonalDynamicIndexReturnType;
237 DiagonalDynamicIndexReturnType
diagonal(Index index);
239 ConstDiagonalDynamicIndexReturnType
diagonal(Index index)
const;
241 template<
unsigned int Mode>
struct TriangularViewReturnType {
typedef TriangularView<Derived, Mode> Type; };
242 template<
unsigned int Mode>
struct ConstTriangularViewReturnType {
typedef const TriangularView<const Derived, Mode> Type; };
244 template<
unsigned int Mode>
246 typename TriangularViewReturnType<Mode>::Type triangularView();
247 template<
unsigned int Mode>
249 typename ConstTriangularViewReturnType<Mode>::Type triangularView()
const;
251 template<
unsigned int UpLo>
struct SelfAdjointViewReturnType {
typedef SelfAdjointView<Derived, UpLo> Type; };
252 template<
unsigned int UpLo>
struct ConstSelfAdjointViewReturnType {
typedef const SelfAdjointView<const Derived, UpLo> Type; };
254 template<
unsigned int UpLo>
256 typename SelfAdjointViewReturnType<UpLo>::Type selfadjointView();
257 template<
unsigned int UpLo>
259 typename ConstSelfAdjointViewReturnType<UpLo>::Type selfadjointView()
const;
261 const SparseView<Derived> sparseView(
const Scalar& m_reference =
Scalar(0),
262 const typename NumTraits<Scalar>::Real& m_epsilon = NumTraits<Scalar>::dummy_precision())
const;
263 EIGEN_DEVICE_FUNC
static const IdentityReturnType
Identity();
264 EIGEN_DEVICE_FUNC
static const IdentityReturnType
Identity(Index
rows, Index
cols);
265 EIGEN_DEVICE_FUNC
static const BasisReturnType
Unit(Index
size, Index i);
266 EIGEN_DEVICE_FUNC
static const BasisReturnType
Unit(Index i);
267 EIGEN_DEVICE_FUNC
static const BasisReturnType
UnitX();
268 EIGEN_DEVICE_FUNC
static const BasisReturnType
UnitY();
269 EIGEN_DEVICE_FUNC
static const BasisReturnType
UnitZ();
270 EIGEN_DEVICE_FUNC
static const BasisReturnType
UnitW();
273 const DiagonalWrapper<const Derived>
asDiagonal()
const;
274 const PermutationWrapper<const Derived> asPermutation()
const;
281 bool isIdentity(
const RealScalar& prec = NumTraits<Scalar>::dummy_precision())
const;
282 bool isDiagonal(
const RealScalar& prec = NumTraits<Scalar>::dummy_precision())
const;
284 bool isUpperTriangular(
const RealScalar& prec = NumTraits<Scalar>::dummy_precision())
const;
285 bool isLowerTriangular(
const RealScalar& prec = NumTraits<Scalar>::dummy_precision())
const;
287 template<
typename OtherDerived>
288 bool isOrthogonal(
const MatrixBase<OtherDerived>& other,
289 const RealScalar& prec = NumTraits<Scalar>::dummy_precision())
const;
290 bool isUnitary(
const RealScalar& prec = NumTraits<Scalar>::dummy_precision())
const;
296 template<
typename OtherDerived>
297 inline bool operator==(
const MatrixBase<OtherDerived>& other)
const
298 {
return cwiseEqual(other).all(); }
304 template<
typename OtherDerived>
305 inline bool operator!=(
const MatrixBase<OtherDerived>& other)
const
306 {
return cwiseNotEqual(other).any(); }
308 NoAlias<Derived,Eigen::MatrixBase >
noalias();
314 template<
bool Enable>
inline const Derived& forceAlignedAccessIf()
const {
return derived(); }
315 template<
bool Enable>
inline Derived& forceAlignedAccessIf() {
return derived(); }
317 EIGEN_DEVICE_FUNC Scalar
trace()
const;
319 template<
int p> EIGEN_DEVICE_FUNC RealScalar
lpNorm()
const;
321 EIGEN_DEVICE_FUNC MatrixBase<Derived>& matrix() {
return *
this; }
322 EIGEN_DEVICE_FUNC
const MatrixBase<Derived>& matrix()
const {
return *
this; }
326 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ArrayWrapper<Derived>
array() {
return ArrayWrapper<Derived>(
derived()); }
329 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
const ArrayWrapper<const Derived>
array()
const {
return ArrayWrapper<const Derived>(
derived()); }
333 inline const FullPivLU<PlainObject>
fullPivLu()
const;
334 inline const PartialPivLU<PlainObject>
partialPivLu()
const;
336 inline const PartialPivLU<PlainObject>
lu()
const;
338 inline const Inverse<Derived>
inverse()
const;
340 template<
typename ResultType>
347 template<
typename ResultType>
357 inline const LLT<PlainObject>
llt()
const;
358 inline const LDLT<PlainObject>
ldlt()
const;
362 inline const HouseholderQR<PlainObject>
householderQr()
const;
374 inline JacobiSVD<PlainObject>
jacobiSvd(
unsigned int computationOptions = 0)
const;
375 inline BDCSVD<PlainObject>
bdcSvd(
unsigned int computationOptions = 0)
const;
379 #ifndef EIGEN_PARSED_BY_DOXYGEN
381 template<
typename OtherDerived>
struct cross_product_return_type {
382 typedef typename ScalarBinaryOpTraits<typename internal::traits<Derived>::Scalar,
typename internal::traits<OtherDerived>::Scalar>::ReturnType Scalar;
383 typedef Matrix<Scalar,MatrixBase::RowsAtCompileTime,MatrixBase::ColsAtCompileTime> type;
386 template<
typename OtherDerived>
388#ifndef EIGEN_PARSED_BY_DOXYGEN
389 inline typename cross_product_return_type<OtherDerived>::type
393 cross(
const MatrixBase<OtherDerived>& other)
const;
395 template<
typename OtherDerived>
397 inline PlainObject
cross3(
const MatrixBase<OtherDerived>& other)
const;
403 inline Matrix<Scalar,3,1>
eulerAngles(Index a0, Index a1, Index a2)
const;
408 typedef Homogeneous<Derived, HomogeneousReturnTypeDirection> HomogeneousReturnType;
415 typedef Block<
const Derived,
416 internal::traits<Derived>::ColsAtCompileTime==1 ? SizeMinusOne : 1,
417 internal::traits<Derived>::ColsAtCompileTime==1 ? 1 : SizeMinusOne> ConstStartMinusOne;
418 typedef EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(ConstStartMinusOne,Scalar,quotient) HNormalizedReturnType;
420 inline const HNormalizedReturnType
hnormalized()
const;
425 template<
typename EssentialPart>
427 Scalar& tau, RealScalar& beta)
const;
428 template<
typename EssentialPart>
432 template<
typename EssentialPart>
439 template<
typename OtherScalar>
440 void applyOnTheLeft(Index p, Index q,
const JacobiRotation<OtherScalar>& j);
441 template<
typename OtherScalar>
442 void applyOnTheRight(Index p, Index q,
const JacobiRotation<OtherScalar>& j);
446 template<
typename OtherDerived>
447 EIGEN_STRONG_INLINE
const typename SparseMatrixBase<OtherDerived>::template CwiseProductDenseReturnType<Derived>::Type
448 cwiseProduct(
const SparseMatrixBase<OtherDerived> &other)
const
450 return other.cwiseProduct(
derived());
455 typedef typename internal::stem_function<Scalar>::type StemFunction;
456 const MatrixExponentialReturnValue<Derived> exp()
const;
457 const MatrixFunctionReturnValue<Derived> matrixFunction(StemFunction f)
const;
458 const MatrixFunctionReturnValue<Derived> cosh()
const;
459 const MatrixFunctionReturnValue<Derived> sinh()
const;
460 const MatrixFunctionReturnValue<Derived> cos()
const;
461 const MatrixFunctionReturnValue<Derived> sin()
const;
462 const MatrixSquareRootReturnValue<Derived> sqrt()
const;
463 const MatrixLogarithmReturnValue<Derived> log()
const;
464 const MatrixPowerReturnValue<Derived> pow(
const RealScalar& p)
const;
465 const MatrixComplexPowerReturnValue<Derived> pow(
const std::complex<RealScalar>& p)
const;
468 EIGEN_DEVICE_FUNC MatrixBase() : Base() {}
471 EIGEN_DEVICE_FUNC
explicit MatrixBase(
int);
472 EIGEN_DEVICE_FUNC MatrixBase(
int,
int);
473 template<
typename OtherDerived> EIGEN_DEVICE_FUNC
explicit MatrixBase(
const MatrixBase<OtherDerived>&);
476 template<
typename OtherDerived> Derived&
operator+=(
const ArrayBase<OtherDerived>& )
477 {EIGEN_STATIC_ASSERT(std::ptrdiff_t(
sizeof(
typename OtherDerived::Scalar))==-1,YOU_CANNOT_MIX_ARRAYS_AND_MATRICES);
return *
this;}
479 template<
typename OtherDerived> Derived&
operator-=(
const ArrayBase<OtherDerived>& )
480 {EIGEN_STATIC_ASSERT(std::ptrdiff_t(
sizeof(
typename OtherDerived::Scalar))==-1,YOU_CANNOT_MIX_ARRAYS_AND_MATRICES);
return *
this;}
495template<
typename Derived>
496template<
typename OtherDerived>
500 other.derived().applyThisOnTheRight(
derived());
509template<
typename Derived>
510template<
typename OtherDerived>
513 other.derived().applyThisOnTheRight(
derived());
521template<
typename Derived>
522template<
typename OtherDerived>
525 other.derived().applyThisOnTheLeft(
derived());
Base class for all dense matrices, vectors, and arrays.
Definition DenseBase.h:47
@ SizeAtCompileTime
Definition DenseBase.h:113
@ ColsAtCompileTime
Definition DenseBase.h:106
@ RowsAtCompileTime
Definition DenseBase.h:100
internal::traits< Derived >::StorageIndex StorageIndex
The type used to store indices.
Definition DenseBase.h:63
internal::traits< Derived >::Scalar Scalar
Definition DenseBase.h:66
Index cols() const
Definition EigenBase.h:61
Derived & derived()
Definition EigenBase.h:44
Index rows() const
Definition EigenBase.h:58
Index size() const
Definition EigenBase.h:65
Base class for all dense matrices, vectors, and expressions.
Definition MatrixBase.h:50
static const BasisReturnType UnitY()
Definition CwiseNullaryOp.h:841
bool operator!=(const MatrixBase< OtherDerived > &other) const
Definition MatrixBase.h:305
void stableNormalize()
Definition Dot.h:185
const LDLT< PlainObject > ldlt() const
Definition LDLT.h:662
RealScalar operatorNorm() const
Computes the L2 operator norm.
Definition MatrixBaseEigenvalues.h:122
Derived & operator-=(const MatrixBase< OtherDerived > &other)
Definition CwiseBinaryOp.h:161
void computeInverseWithCheck(ResultType &inverse, bool &invertible, const RealScalar &absDeterminantThreshold=NumTraits< Scalar >::dummy_precision()) const
Definition InverseImpl.h:401
void makeHouseholder(EssentialPart &essential, Scalar &tau, RealScalar &beta) const
Definition Householder.h:65
const DiagonalWrapper< const Derived > asDiagonal() const
Definition DiagonalMatrix.h:277
Derived & setIdentity()
Definition CwiseNullaryOp.h:774
bool isLowerTriangular(const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition TriangularMatrix.h:667
const FullPivLU< PlainObject > fullPivLu() const
Definition FullPivLU.h:884
NoAlias< Derived, Eigen::MatrixBase > noalias()
Definition NoAlias.h:101
EigenvaluesReturnType eigenvalues() const
Computes the eigenvalues of a matrix.
Definition MatrixBaseEigenvalues.h:67
Derived & operator=(const MatrixBase &other)
Definition Assign.h:55
Derived & operator*=(const EigenBase< OtherDerived > &other)
Definition MatrixBase.h:498
const PlainObject stableNormalized() const
Definition Dot.h:161
void applyOnTheLeft(const EigenBase< OtherDerived > &other)
Definition MatrixBase.h:523
void applyOnTheRight(const EigenBase< OtherDerived > &other)
Definition MatrixBase.h:511
RealScalar blueNorm() const
Definition StableNorm.h:201
bool isIdentity(const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition CwiseNullaryOp.h:717
void adjointInPlace()
Definition Transpose.h:315
Scalar trace() const
Definition Redux.h:498
RealScalar hypotNorm() const
Definition StableNorm.h:213
JacobiSVD< PlainObject > jacobiSvd(unsigned int computationOptions=0) const
Definition JacobiSVD.h:793
const PlainObject normalized() const
Definition Dot.h:118
const PartialPivLU< PlainObject > partialPivLu() const
Definition PartialPivLU.h:589
RealScalar stableNorm() const
Definition StableNorm.h:157
ArrayWrapper< Derived > array()
Definition MatrixBase.h:326
RealScalar lpNorm() const
Definition Dot.h:261
const Inverse< Derived > inverse() const
Definition InverseImpl.h:335
Scalar determinant() const
Definition Determinant.h:92
ScalarBinaryOpTraits< typenameinternal::traits< Derived >::Scalar, typenameinternal::traits< OtherDerived >::Scalar >::ReturnType dot(const MatrixBase< OtherDerived > &other) const
Definition Dot.h:68
void computeInverseAndDetWithCheck(ResultType &inverse, typename ResultType::Scalar &determinant, bool &invertible, const RealScalar &absDeterminantThreshold=NumTraits< Scalar >::dummy_precision()) const
Definition InverseImpl.h:362
bool operator==(const MatrixBase< OtherDerived > &other) const
Definition MatrixBase.h:297
const FullPivHouseholderQR< PlainObject > fullPivHouseholderQr() const
Definition FullPivHouseholderQR.h:669
static const BasisReturnType UnitX()
Definition CwiseNullaryOp.h:831
bool isUnitary(const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition Dot.h:296
void applyHouseholderOnTheLeft(const EssentialPart &essential, const Scalar &tau, Scalar *workspace)
Definition Householder.h:113
const LLT< PlainObject > llt() const
Definition LLT.h:516
bool isDiagonal(const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition DiagonalMatrix.h:291
Derived & operator+=(const MatrixBase< OtherDerived > &other)
Definition CwiseBinaryOp.h:174
static const IdentityReturnType Identity()
Definition CwiseNullaryOp.h:700
const HouseholderQR< PlainObject > householderQr() const
Definition HouseholderQR.h:402
const ArrayWrapper< const Derived > array() const
Definition MatrixBase.h:329
static const BasisReturnType UnitZ()
Definition CwiseNullaryOp.h:851
bool isUpperTriangular(const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition TriangularMatrix.h:642
void applyHouseholderOnTheRight(const EssentialPart &essential, const Scalar &tau, Scalar *workspace)
Definition Householder.h:150
Index diagonalSize() const
Definition MatrixBase.h:101
RealScalar squaredNorm() const
Definition Dot.h:90
static const BasisReturnType Unit(Index size, Index i)
Definition CwiseNullaryOp.h:803
void normalize()
Definition Dot.h:139
const Derived & forceAlignedAccess() const
Definition MatrixBase.h:312
RealScalar norm() const
Definition Dot.h:102
const ColPivHouseholderQR< PlainObject > colPivHouseholderQr() const
Definition ColPivHouseholderQR.h:646
const Product< Derived, OtherDerived, LazyProduct > lazyProduct(const MatrixBase< OtherDerived > &other) const
Definition GeneralProduct.h:413
BDCSVD< PlainObject > bdcSvd(unsigned int computationOptions=0) const
Definition BDCSVD.h:1222
const Product< Derived, OtherDerived > operator*(const MatrixBase< OtherDerived > &other) const
Definition GeneralProduct.h:369
const CompleteOrthogonalDecomposition< PlainObject > completeOrthogonalDecomposition() const
Definition CompleteOrthogonalDecomposition.h:556
void makeHouseholderInPlace(Scalar &tau, RealScalar &beta)
Definition Householder.h:42
bool isOrthogonal(const MatrixBase< OtherDerived > &other, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition Dot.h:277
static const BasisReturnType UnitW()
Definition CwiseNullaryOp.h:861
const AdjointReturnType adjoint() const
Definition Transpose.h:210
const PartialPivLU< PlainObject > lu() const
Definition PartialPivLU.h:604
Derived & forceAlignedAccess()
Definition MatrixBase.h:313
DiagonalReturnType diagonal()
Definition Diagonal.h:188
The matrix class, also used for vectors and row-vectors.
Definition Matrix.h:180
PlainObject cross(const MatrixBase< OtherDerived > &other) const
Definition OrthoMethods.h:34
Matrix< Scalar, 3, 1 > eulerAngles(Index a0, Index a1, Index a2) const
Definition EulerAngles.h:37
PlainObject unitOrthogonal(void) const
Definition OrthoMethods.h:226
PlainObject cross3(const MatrixBase< OtherDerived > &other) const
Definition OrthoMethods.h:82
const HNormalizedReturnType hnormalized() const
homogeneous normalization
Definition Homogeneous.h:172
HomogeneousReturnType homogeneous() const
Definition Homogeneous.h:130
@ ColMajor
Definition Constants.h:320
@ Horizontal
Definition Constants.h:268
@ Vertical
Definition Constants.h:265
const unsigned int RowMajorBit
Definition Constants.h:61
Namespace containing all symbols from the Eigen library.
Definition Core:287
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:33
const int Dynamic
Definition Constants.h:21
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition NumTraits.h:151