Eigen  5.0.1
 
Loading...
Searching...
No Matches
MatrixBase.h
1// This file is part of Eigen, a lightweight C++ template library
2// for linear algebra.
3//
4// Copyright (C) 2006-2009 Benoit Jacob <jacob.benoit.1@gmail.com>
5// Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
6//
7// This Source Code Form is subject to the terms of the Mozilla
8// Public License v. 2.0. If a copy of the MPL was not distributed
9// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
10// SPDX-License-Identifier: MPL-2.0
11
12#ifndef EIGEN_MATRIXBASE_H
13#define EIGEN_MATRIXBASE_H
14
15// IWYU pragma: private
16#include "./InternalHeaderCheck.h"
17
18namespace Eigen {
19
46 *
47 * This class can be extended with the help of the plugin mechanism described on the page
48 * \ref TopicCustomizing_Plugins by defining the preprocessor symbol \c EIGEN_MATRIXBASE_PLUGIN.
49 *
50 * \sa \blank \ref TopicClassHierarchy
51 */
52template <typename Derived>
53class MatrixBase : public DenseBase<Derived> {
54 public:
55#ifndef EIGEN_PARSED_BY_DOXYGEN
56 using StorageBaseType = MatrixBase;
57 using StorageKind = typename internal::traits<Derived>::StorageKind;
58 using StorageIndex = typename internal::traits<Derived>::StorageIndex;
59 using Scalar = typename internal::traits<Derived>::Scalar;
60 using PacketScalar = typename internal::packet_traits<Scalar>::type;
61 using RealScalar = typename NumTraits<Scalar>::Real;
62
63 using Base = DenseBase<Derived>;
64 using Base::ColsAtCompileTime;
65 using Base::Flags;
66 using Base::IsVectorAtCompileTime;
67 using Base::MaxColsAtCompileTime;
68 using Base::MaxRowsAtCompileTime;
69 using Base::MaxSizeAtCompileTime;
70 using Base::RowsAtCompileTime;
71 using Base::SizeAtCompileTime;
73 using Base::coeff;
74 using Base::coeffRef;
75 using Base::cols;
76 using Base::const_cast_derived;
77 using Base::derived;
78 using Base::eval;
79 using Base::lazyAssign;
80 using Base::rows;
81 using Base::size;
82 using Base::operator-;
83 using Base::operator+=;
84 using Base::operator-=;
85 using Base::operator*=;
86 using Base::operator/=;
87
88 using CoeffReturnType = typename Base::CoeffReturnType;
89 using ConstTransposeReturnType = typename Base::ConstTransposeReturnType;
90 using RowXpr = typename Base::RowXpr;
91 using ColXpr = typename Base::ColXpr;
92#endif // not EIGEN_PARSED_BY_DOXYGEN
94#ifndef EIGEN_PARSED_BY_DOXYGEN
96 using SquareMatrixType = Matrix<Scalar, internal::max_size_prefer_dynamic(RowsAtCompileTime, ColsAtCompileTime),
97 internal::max_size_prefer_dynamic(RowsAtCompileTime, ColsAtCompileTime)>;
98#endif // not EIGEN_PARSED_BY_DOXYGEN
99
100 /** \returns the size of the main diagonal, which is min(rows(),cols()).
101 * \sa rows(), cols(), SizeAtCompileTime. */
102 EIGEN_DEVICE_FUNC constexpr Index diagonalSize() const { return (numext::mini)(rows(), cols()); }
103
104 using PlainObject = typename Base::PlainObject;
105
106#ifndef EIGEN_PARSED_BY_DOXYGEN
107 /** \internal Represents a matrix with all coefficients equal to one another*/
108 using ConstantReturnType = CwiseNullaryOp<internal::scalar_constant_op<Scalar>, PlainObject>;
110 using AdjointReturnType =
111 std::conditional_t<NumTraits<Scalar>::IsComplex,
113 ConstTransposeReturnType>;
115 using EigenvaluesReturnType =
116 Matrix<internal::make_complex_t<Scalar>, internal::traits<Derived>::ColsAtCompileTime, 1, ColMajor>;
118 using IdentityReturnType = CwiseNullaryOp<internal::scalar_identity_op<Scalar>, PlainObject>;
120 using BasisReturnType =
122 internal::traits<Derived>::RowsAtCompileTime, internal::traits<Derived>::ColsAtCompileTime>;
123#endif // not EIGEN_PARSED_BY_DOXYGEN
124
125#define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::MatrixBase
126#define EIGEN_DOC_UNARY_ADDONS(X, Y)
127#include "../plugins/CommonCwiseBinaryOps.inc"
128#include "../plugins/MatrixCwiseUnaryOps.inc"
129#include "../plugins/MatrixCwiseBinaryOps.inc"
130#ifdef EIGEN_MATRIXBASE_PLUGIN
131#include EIGEN_MATRIXBASE_PLUGIN
132#endif
133#undef EIGEN_CURRENT_STORAGE_BASE_CLASS
134#undef EIGEN_DOC_UNARY_ADDONS
135
137
139 EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Derived& operator=(const MatrixBase& other);
140
141 // We cannot inherit here via Base::operator= since it is causing
142 // trouble with MSVC.
143
144 template <typename OtherDerived>
145 EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Derived& operator=(const DenseBase<OtherDerived>& other);
146
147 template <typename OtherDerived>
148 EIGEN_DEVICE_FUNC constexpr Derived& operator=(const EigenBase<OtherDerived>& other);
149
150 template <typename OtherDerived>
151 EIGEN_DEVICE_FUNC constexpr Derived& operator=(const ReturnByValue<OtherDerived>& other);
152
153 template <typename OtherDerived>
154 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator+=(const MatrixBase<OtherDerived>& other);
155 template <typename OtherDerived>
156 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator-=(const MatrixBase<OtherDerived>& other);
157
158 template <typename OtherDerived>
159 EIGEN_DEVICE_FUNC const Product<Derived, OtherDerived> operator*(const MatrixBase<OtherDerived>& other) const;
161 template <typename OtherDerived>
163 const MatrixBase<OtherDerived>& other) const;
164
165 template <typename OtherDerived>
166 Derived& operator*=(const EigenBase<OtherDerived>& other);
167
168 template <typename OtherDerived>
170
171 template <typename OtherDerived>
173
174 template <typename DiagonalDerived>
177
178 template <typename SkewDerived>
180 const SkewSymmetricBase<SkewDerived>& skew) const;
181
182 template <typename OtherDerived>
183 EIGEN_DEVICE_FUNC constexpr typename ScalarBinaryOpTraits<typename internal::traits<Derived>::Scalar,
184 typename internal::traits<OtherDerived>::Scalar>::ReturnType
185 dot(const MatrixBase<OtherDerived>& other) const;
186
187 EIGEN_DEVICE_FUNC constexpr RealScalar squaredNorm() const;
188 EIGEN_DEVICE_FUNC RealScalar norm() const;
189 RealScalar stableNorm() const;
190 RealScalar blueNorm() const;
191 RealScalar hypotNorm() const;
192 EIGEN_DEVICE_FUNC const PlainObject normalized() const;
193 EIGEN_DEVICE_FUNC const PlainObject stableNormalized() const;
194 EIGEN_DEVICE_FUNC void normalize();
195 EIGEN_DEVICE_FUNC void stableNormalize();
196
197 EIGEN_DEVICE_FUNC constexpr const AdjointReturnType adjoint() const;
198 EIGEN_DEVICE_FUNC void adjointInPlace();
199
200 using DiagonalReturnType = Diagonal<Derived>;
201 EIGEN_DEVICE_FUNC constexpr DiagonalReturnType diagonal();
202
203 using ConstDiagonalReturnType = Diagonal<const Derived>;
204 EIGEN_DEVICE_FUNC constexpr const ConstDiagonalReturnType diagonal() const;
205
206 template <int Index>
207 EIGEN_DEVICE_FUNC constexpr Diagonal<Derived, Index> diagonal();
208
209 template <int Index>
210 EIGEN_DEVICE_FUNC constexpr const Diagonal<const Derived, Index> diagonal() const;
211
212 EIGEN_DEVICE_FUNC constexpr Diagonal<Derived, DynamicIndex> diagonal(Index index);
213 EIGEN_DEVICE_FUNC constexpr const Diagonal<const Derived, DynamicIndex> diagonal(Index index) const;
215 template <unsigned int Mode>
216 struct TriangularViewReturnType {
218 };
219 template <unsigned int Mode>
220 struct ConstTriangularViewReturnType {
221 using Type = const TriangularView<const Derived, Mode>;
222 };
223
224 template <unsigned int Mode>
225 EIGEN_DEVICE_FUNC constexpr typename TriangularViewReturnType<Mode>::Type triangularView();
226 template <unsigned int Mode>
227 EIGEN_DEVICE_FUNC constexpr typename ConstTriangularViewReturnType<Mode>::Type triangularView() const;
228
229 template <unsigned int UpLo>
230 struct SelfAdjointViewReturnType {
232 };
233 template <unsigned int UpLo>
234 struct ConstSelfAdjointViewReturnType {
235 using Type = const SelfAdjointView<const Derived, UpLo>;
236 };
237
238 template <unsigned int UpLo>
239 EIGEN_DEVICE_FUNC constexpr typename SelfAdjointViewReturnType<UpLo>::Type selfadjointView();
240 template <unsigned int UpLo>
241 EIGEN_DEVICE_FUNC constexpr typename ConstSelfAdjointViewReturnType<UpLo>::Type selfadjointView() const;
242
244 const Scalar& m_reference = Scalar(0),
245 const typename NumTraits<Scalar>::Real& m_epsilon = NumTraits<Scalar>::dummy_precision()) const;
246 EIGEN_DEVICE_FUNC static const IdentityReturnType Identity();
247 EIGEN_DEVICE_FUNC static const IdentityReturnType Identity(Index rows, Index cols);
248 EIGEN_DEVICE_FUNC static const BasisReturnType Unit(Index size, Index i);
249 EIGEN_DEVICE_FUNC static const BasisReturnType Unit(Index i);
250 EIGEN_DEVICE_FUNC static const BasisReturnType UnitX();
251 EIGEN_DEVICE_FUNC static const BasisReturnType UnitY();
252 EIGEN_DEVICE_FUNC static const BasisReturnType UnitZ();
253 EIGEN_DEVICE_FUNC static const BasisReturnType UnitW();
254
255 EIGEN_DEVICE_FUNC constexpr const DiagonalWrapper<const Derived> asDiagonal() const;
256 const PermutationWrapper<const Derived> asPermutation() const;
257 EIGEN_DEVICE_FUNC constexpr const SkewSymmetricWrapper<const Derived> asSkewSymmetric() const;
258
259 EIGEN_DEVICE_FUNC Derived& setIdentity();
260 EIGEN_DEVICE_FUNC Derived& setIdentity(Index rows, Index cols);
261 EIGEN_DEVICE_FUNC Derived& setUnit(Index i);
262 EIGEN_DEVICE_FUNC Derived& setUnit(Index newSize, Index i);
263
264 bool isIdentity(const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const;
265 bool isDiagonal(const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const;
266
267 bool isUpperTriangular(const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const;
268 bool isLowerTriangular(const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const;
269
270 bool isSkewSymmetric(const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const;
271
272 template <typename OtherDerived>
273 bool isOrthogonal(const MatrixBase<OtherDerived>& other,
274 const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const;
275 bool isUnitary(const RealScalar& prec = NumTraits<Scalar>::dummy_precision()) const;
276
277 /* diagonalView */
278 template <int DiagIndex_ = 0>
280
281 template <int DiagIndex_ = 0>
283
284 EIGEN_DEVICE_FUNC constexpr DiagonalWrapper<Diagonal<Derived, DynamicIndex>> diagonalView(Index index);
285
286 EIGEN_DEVICE_FUNC constexpr DiagonalWrapper<Diagonal<const Derived, DynamicIndex>> diagonalView(Index index) const;
287
292 template <typename OtherDerived>
293 EIGEN_DEVICE_FUNC inline bool operator==(const MatrixBase<OtherDerived>& other) const {
294 return (this->rows() == other.rows()) && (this->cols() == other.cols()) && cwiseEqual(other).all();
295 }
296
301 template <typename OtherDerived>
302 EIGEN_DEVICE_FUNC inline bool operator!=(const MatrixBase<OtherDerived>& other) const {
303 return !(*this == other);
304 }
305
307
308 // TODO forceAlignedAccess is temporarily disabled
309 // Need to find a nicer workaround.
310 constexpr const Derived& forceAlignedAccess() const { return derived(); }
311 constexpr Derived& forceAlignedAccess() { return derived(); }
312 template <bool Enable>
313 constexpr const Derived& forceAlignedAccessIf() const {
314 return derived();
315 }
316 template <bool Enable>
317 constexpr Derived& forceAlignedAccessIf() {
318 return derived();
319 }
320
321 EIGEN_DEVICE_FUNC Scalar trace() const;
322
323 template <int p>
324 EIGEN_DEVICE_FUNC RealScalar lpNorm() const;
325
326 EIGEN_DEVICE_FUNC constexpr MatrixBase<Derived>& matrix() { return *this; }
327 EIGEN_DEVICE_FUNC constexpr const MatrixBase<Derived>& matrix() const { return *this; }
328
331 EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE ArrayWrapper<Derived> array() {
332 return ArrayWrapper<Derived>(derived());
333 }
334
336 EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE const ArrayWrapper<const Derived> array() const {
337 return ArrayWrapper<const Derived>(derived());
338 }
339
341
342 template <typename PermutationIndex = DefaultPermutationIndex>
343 inline FullPivLU<PlainObject, PermutationIndex> fullPivLu() const;
344 template <typename PermutationIndex = DefaultPermutationIndex>
345 inline PartialPivLU<PlainObject, PermutationIndex> partialPivLu() const;
346
347 template <typename PermutationIndex = DefaultPermutationIndex>
349
350 EIGEN_DEVICE_FUNC inline Inverse<Derived> inverse() const;
351
352 template <typename ResultType>
354 ResultType& inverse, typename ResultType::Scalar& determinant, bool& invertible,
355 const RealScalar& absDeterminantThreshold = NumTraits<Scalar>::dummy_precision()) const;
356
357 template <typename ResultType>
359 ResultType& inverse, bool& invertible,
360 const RealScalar& absDeterminantThreshold = NumTraits<Scalar>::dummy_precision()) const;
361
362 EIGEN_DEVICE_FUNC Scalar determinant() const;
363
365
366 inline LLT<PlainObject> llt() const;
367 inline LDLT<PlainObject> ldlt() const;
369
371
373 template <typename PermutationIndex = DefaultPermutationIndex>
374 inline ColPivHouseholderQR<PlainObject, PermutationIndex> colPivHouseholderQr() const;
375 template <typename PermutationIndex = DefaultPermutationIndex>
376 inline FullPivHouseholderQR<PlainObject, PermutationIndex> fullPivHouseholderQr() const;
377 template <typename PermutationIndex = DefaultPermutationIndex>
378 inline RandColPivHouseholderQR<PlainObject, PermutationIndex> randColPivHouseholderQr() const;
379 template <typename PermutationIndex = DefaultPermutationIndex>
380 inline CompleteOrthogonalDecomposition<PlainObject, PermutationIndex> completeOrthogonalDecomposition() const;
381 template <typename PermutationIndex = DefaultPermutationIndex>
382 inline RandCompleteOrthogonalDecomposition<PlainObject, PermutationIndex> randCompleteOrthogonalDecomposition() const;
383
385
386 inline EigenvaluesReturnType eigenvalues() const;
387 inline RealScalar operatorNorm() const;
388
390
391 template <int Options = 0>
392 inline JacobiSVD<PlainObject, Options> jacobiSvd() const;
393 template <int Options = 0>
394 EIGEN_DEPRECATED_WITH_REASON("Options should be specified using method's template parameter.")
395 inline JacobiSVD<PlainObject, Options> jacobiSvd(unsigned int computationOptions) const;
396
397 template <int Options = 0>
398 inline BDCSVD<PlainObject, Options> bdcSvd() const;
399 template <int Options = 0>
400 EIGEN_DEPRECATED_WITH_REASON("Options should be specified using method's template parameter.")
401 inline BDCSVD<PlainObject, Options> bdcSvd(unsigned int computationOptions) const;
402
404
405 template <typename OtherDerived>
406 EIGEN_DEVICE_FUNC inline typename internal::cross_impl<Derived, OtherDerived>::return_type cross(
407 const MatrixBase<OtherDerived>& other) const;
408
409 template <typename OtherDerived>
410 EIGEN_DEVICE_FUNC inline PlainObject cross3(const MatrixBase<OtherDerived>& other) const;
411
412 EIGEN_DEVICE_FUNC inline PlainObject unitOrthogonal(void) const;
413
414 EIGEN_DEPRECATED_WITH_REASON("Use .canonicalEulerAngles() instead.")
415 EIGEN_DEVICE_FUNC inline Matrix<Scalar, 3, 1> eulerAngles(Index a0, Index a1, Index a2) const;
416
417 EIGEN_DEVICE_FUNC inline Matrix<Scalar, 3, 1> canonicalEulerAngles(Index a0, Index a1, Index a2) const;
418
419 enum {
420 HomogeneousReturnTypeDirection =
422 ? ((internal::traits<Derived>::Flags & RowMajorBit) == RowMajorBit ? Horizontal : Vertical)
424 : Horizontal
425 };
426 using HomogeneousReturnType = Homogeneous<Derived, HomogeneousReturnTypeDirection>;
427 EIGEN_DEVICE_FUNC inline HomogeneousReturnType homogeneous() const;
428
429 enum { SizeMinusOne = SizeAtCompileTime == Dynamic ? Dynamic : SizeAtCompileTime - 1 };
430 using ConstStartMinusOne = Block<const Derived, internal::traits<Derived>::ColsAtCompileTime == 1 ? SizeMinusOne : 1,
431 internal::traits<Derived>::ColsAtCompileTime == 1 ? 1 : SizeMinusOne>;
432 using HNormalizedReturnType = EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(ConstStartMinusOne, Scalar,
433 internal::scalar_quotient_op);
434 EIGEN_DEVICE_FUNC inline const HNormalizedReturnType hnormalized() const;
435
437
438 EIGEN_DEVICE_FUNC void makeHouseholderInPlace(Scalar& tau, RealScalar& beta);
439 template <typename EssentialPart>
440 EIGEN_DEVICE_FUNC void makeHouseholder(EssentialPart& essential, Scalar& tau, RealScalar& beta) const;
441 template <typename EssentialPart>
442 EIGEN_DEVICE_FUNC void applyHouseholderOnTheLeft(const EssentialPart& essential, const Scalar& tau,
443 Scalar* workspace);
444 template <typename EssentialPart>
445 EIGEN_DEVICE_FUNC void applyHouseholderOnTheRight(const EssentialPart& essential, const Scalar& tau,
446 Scalar* workspace);
447
449
450 template <typename OtherScalar>
451 EIGEN_DEVICE_FUNC void applyOnTheLeft(Index p, Index q, const JacobiRotation<OtherScalar>& j);
452 template <typename OtherScalar>
453 EIGEN_DEVICE_FUNC void applyOnTheRight(Index p, Index q, const JacobiRotation<OtherScalar>& j);
454
456
457 template <typename OtherDerived>
458 EIGEN_STRONG_INLINE const typename SparseMatrixBase<OtherDerived>::template CwiseProductDenseReturnType<Derived>::Type
459 cwiseProduct(const SparseMatrixBase<OtherDerived>& other) const {
460 return other.cwiseProduct(derived());
461 }
462
464
465 using StemFunction = typename internal::stem_function<Scalar>::type;
466#define EIGEN_MATRIX_FUNCTION(ReturnType, Name, Description) \
467 \
470 const ReturnType<Derived> Name() const;
471#define EIGEN_MATRIX_FUNCTION_1(ReturnType, Name, Description, Argument) \
472 \
475 const ReturnType<Derived> Name(Argument) const;
477 EIGEN_MATRIX_FUNCTION(MatrixExponentialReturnValue, exp, exponential)
480 const MatrixFunctionReturnValue<Derived> matrixFunction(StemFunction f) const;
481 EIGEN_MATRIX_FUNCTION(MatrixFunctionReturnValue, cosh, hyperbolic cosine)
482 EIGEN_MATRIX_FUNCTION(MatrixFunctionReturnValue, sinh, hyperbolic sine)
483 EIGEN_MATRIX_FUNCTION(MatrixFunctionReturnValue, atanh, inverse hyperbolic tangent)
484 EIGEN_MATRIX_FUNCTION(MatrixFunctionReturnValue, acosh, inverse hyperbolic cosine)
485 EIGEN_MATRIX_FUNCTION(MatrixFunctionReturnValue, asinh, inverse hyperbolic sine)
486 EIGEN_MATRIX_FUNCTION(MatrixFunctionReturnValue, cos, cosine)
487 EIGEN_MATRIX_FUNCTION(MatrixFunctionReturnValue, sin, sine)
488 EIGEN_MATRIX_FUNCTION(MatrixSquareRootReturnValue, sqrt, square root)
489 EIGEN_MATRIX_FUNCTION(MatrixLogarithmReturnValue, log, logarithm)
490 EIGEN_MATRIX_FUNCTION_1(MatrixPowerReturnValue, pow, power to \c p, const RealScalar& p)
491 EIGEN_MATRIX_FUNCTION_1(MatrixComplexPowerReturnValue, pow, power to \c p, const internal::make_complex_t<Scalar>& p)
492
493 protected:
494 EIGEN_DEFAULT_COPY_CONSTRUCTOR(MatrixBase)
495 EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(MatrixBase)
496
497 private:
498 EIGEN_DEVICE_FUNC explicit MatrixBase(int);
499 EIGEN_DEVICE_FUNC MatrixBase(int, int);
500 template <typename OtherDerived>
501 EIGEN_DEVICE_FUNC explicit MatrixBase(const MatrixBase<OtherDerived>&);
502
503 protected:
504 // mixing arrays and matrices is not legal
505 template <typename OtherDerived>
506 Derived& operator+=(const ArrayBase<OtherDerived>&) {
507 EIGEN_STATIC_ASSERT(std::ptrdiff_t(sizeof(typename OtherDerived::Scalar)) == -1,
508 YOU_CANNOT_MIX_ARRAYS_AND_MATRICES);
509 return *this;
510 }
511 // mixing arrays and matrices is not legal
512 template <typename OtherDerived>
513 Derived& operator-=(const ArrayBase<OtherDerived>&) {
514 EIGEN_STATIC_ASSERT(std::ptrdiff_t(sizeof(typename OtherDerived::Scalar)) == -1,
515 YOU_CANNOT_MIX_ARRAYS_AND_MATRICES);
516 return *this;
517 }
518};
519
520/***************************************************************************
521 * Implementation of matrix base methods
522 ***************************************************************************/
523
529 * Output: \verbinclude MatrixBase_applyOnTheRight.out
530 */
531template <typename Derived>
532template <typename OtherDerived>
533inline Derived& MatrixBase<Derived>::operator*=(const EigenBase<OtherDerived>& other) {
534 other.derived().applyThisOnTheRight(derived());
535 return derived();
536}
537
542 * Output: \verbinclude MatrixBase_applyOnTheRight.out
543 */
544template <typename Derived>
545template <typename OtherDerived>
547 other.derived().applyThisOnTheRight(derived());
548}
549
553 * Output: \verbinclude MatrixBase_applyOnTheLeft.out
554 */
555template <typename Derived>
556template <typename OtherDerived>
558 other.derived().applyThisOnTheLeft(derived());
559}
560
561} // end namespace Eigen
562
563#endif // EIGEN_MATRIXBASE_H
Base class for all 1D and 2D array, and related expressions.
Definition ArrayBase.h:45
Expression of a mathematical vector or matrix as an array object.
Definition ArrayWrapper.h:44
class Bidiagonal Divide and Conquer SVD
Definition BDCSVD.h:76
Expression of a fixed-size or dynamic-size block.
Definition Block.h:111
Bunch-Kaufman factorization of a symmetric / Hermitian indefinite matrix.
Definition BunchKaufman.h:75
Householder rank-revealing QR decomposition of a matrix with column-pivoting.
Definition ColPivHouseholderQR.h:56
Complete orthogonal decomposition (COD) of a matrix.
Definition CompleteOrthogonalDecomposition.h:420
Generic expression of a matrix where all coefficients are defined by a functor.
Definition CwiseNullaryOp.h:65
Generic expression where a coefficient-wise unary operator is applied to an expression.
Definition CwiseUnaryOp.h:55
typename internal::traits< Derived >::StorageIndex StorageIndex
The type used to store indices.
Definition DenseBase.h:60
@ SizeAtCompileTime
Definition DenseBase.h:109
@ ColsAtCompileTime
Definition DenseBase.h:103
@ RowsAtCompileTime
Definition DenseBase.h:97
constexpr DenseBase()=default
typename internal::traits< Derived >::Scalar Scalar
Definition DenseBase.h:63
Base class for diagonal matrices and expressions.
Definition DiagonalMatrix.h:34
Expression of a diagonal matrix.
Definition DiagonalMatrix.h:400
Expression of a diagonal/subdiagonal/superdiagonal in a matrix.
Definition Diagonal.h:78
Householder rank-revealing QR decomposition of a matrix with full pivoting.
Definition FullPivHouseholderQR.h:66
LU decomposition of a matrix with complete pivoting, and related features.
Definition FullPivLU.h:70
Expression of one (or a set of) homogeneous vector(s)
Definition Homogeneous.h:63
Householder QR decomposition of a matrix.
Definition HouseholderQR.h:77
Expression of the inverse of another expression.
Definition Inverse.h:44
Rotation given by a cosine-sine pair.
Definition Jacobi.h:39
Two-sided Jacobi SVD decomposition of a rectangular matrix.
Definition JacobiSVD.h:613
Robust Cholesky decomposition of a matrix with pivoting.
Definition LDLT.h:67
Standard Cholesky decomposition (LL^T) of a matrix and associated features.
Definition LLT.h:85
Base class for all dense matrices, vectors, and expressions.
Definition MatrixBase.h:53
static const BasisReturnType UnitY()
Definition CwiseNullaryOp.h:880
bool operator!=(const MatrixBase< OtherDerived > &other) const
Definition MatrixBase.h:302
constexpr DiagonalWrapper< Diagonal< Derived, DiagIndex_ > > diagonalView()
Definition DiagonalMatrix.h:467
LDLT< PlainObject > ldlt() const
Definition LDLT.h:760
void stableNormalize()
Definition Dot.h:438
RealScalar operatorNorm() const
Computes the L2 operator norm.
Definition MatrixBaseEigenvalues.h:112
const MatrixFunctionReturnValue< MatrixWrapper< ExpressionType > > matrixFunction(StemFunction f) const
void computeInverseWithCheck(ResultType &inverse, bool &invertible, const RealScalar &absDeterminantThreshold=NumTraits< Scalar >::dummy_precision()) const
Definition InverseImpl.h:345
void makeHouseholder(EssentialPart &essential, Scalar &tau, RealScalar &beta) const
Definition Householder.h:139
HouseholderQR< PlainObject > householderQr() const
Definition HouseholderQR.h:594
const MatrixLogarithmReturnValue< MatrixWrapper< ExpressionType > > log() const
const Product< Derived, SkewDerived, LazyProduct > operator*(const SkewSymmetricBase< SkewDerived > &skew) const
Definition SkewSymmetricMatrix3.h:398
constexpr DiagonalWrapper< Diagonal< const Derived, DynamicIndex > > diagonalView(Index index) const
Definition DiagonalMatrix.h:497
Derived & setIdentity()
Definition CwiseNullaryOp.h:812
bool isLowerTriangular(const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition TriangularMatrix.h:797
const MatrixFunctionReturnValue< MatrixWrapper< ExpressionType > > asinh() const
constexpr ScalarBinaryOpTraits< typenameinternal::traits< Derived >::Scalar, typenameinternal::traits< OtherDerived >::Scalar >::ReturnType dot(const MatrixBase< OtherDerived > &other) const
Definition Dot.h:299
NoAlias< Derived, Eigen::MatrixBase > noalias()
Definition NoAlias.h:97
EigenvaluesReturnType eigenvalues() const
Computes the eigenvalues of a matrix.
Definition MatrixBaseEigenvalues.h:64
const Product< Derived, DiagonalDerived, LazyProduct > operator*(const DiagonalBase< DiagonalDerived > &diagonal) const
Definition DiagonalProduct.h:24
Derived & operator*=(const EigenBase< OtherDerived > &other)
Definition MatrixBase.h:529
const PlainObject stableNormalized() const
Definition Dot.h:380
void applyOnTheLeft(const EigenBase< OtherDerived > &other)
Definition MatrixBase.h:553
constexpr const CwiseBinaryOp< internal::scalar_product_op< Derived ::Scalar, OtherDerived ::Scalar >, const Derived, const OtherDerived > cwiseProduct(const Eigen::MatrixBase< OtherDerived > &other) const
Definition MatrixBase.h:25
const MatrixExponentialReturnValue< MatrixWrapper< ExpressionType > > exp() const
const MatrixFunctionReturnValue< MatrixWrapper< ExpressionType > > cosh() const
Inverse< Derived > inverse() const
Definition InverseImpl.h:280
void applyOnTheRight(const EigenBase< OtherDerived > &other)
Definition MatrixBase.h:542
LLT< PlainObject > llt() const
Definition LLT.h:663
RealScalar blueNorm() const
Definition StableNorm.h:320
bool isIdentity(const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition CwiseNullaryOp.h:769
constexpr Diagonal< Derived, DynamicIndex > diagonal(Index index)
Definition Diagonal.h:193
void adjointInPlace()
Definition Transpose.h:355
Scalar trace() const
Definition Redux.h:863
RealScalar hypotNorm() const
Definition StableNorm.h:330
constexpr const Diagonal< const Derived, DynamicIndex > diagonal(Index index) const
Definition Diagonal.h:199
const PlainObject normalized() const
Definition Dot.h:339
RealScalar stableNorm() const
Definition StableNorm.h:303
RealScalar lpNorm() const
Definition Dot.h:534
const MatrixFunctionReturnValue< MatrixWrapper< ExpressionType > > atanh() const
constexpr const AdjointReturnType adjoint() const
Definition Transpose.h:200
void computeInverseAndDetWithCheck(ResultType &inverse, typename ResultType::Scalar &determinant, bool &invertible, const RealScalar &absDeterminantThreshold=NumTraits< Scalar >::dummy_precision()) const
Definition InverseImpl.h:308
constexpr DiagonalWrapper< Diagonal< Derived, DynamicIndex > > diagonalView(Index index)
Definition DiagonalMatrix.h:487
bool operator==(const MatrixBase< OtherDerived > &other) const
Definition MatrixBase.h:293
const MatrixFunctionReturnValue< MatrixWrapper< ExpressionType > > sin() const
static const BasisReturnType UnitX()
Definition CwiseNullaryOp.h:868
bool isUnitary(const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition Dot.h:566
constexpr Derived & operator=(const MatrixBase &other)
Definition Assign.h:54
void applyHouseholderOnTheLeft(const EssentialPart &essential, const Scalar &tau, Scalar *workspace)
Definition Householder.h:366
Derived & setUnit(Index newSize, Index i)
Resizes to the given newSize, and writes the i-th unit (basis) vector into *this.
Definition CwiseNullaryOp.h:935
bool isDiagonal(const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition DiagonalMatrix.h:441
Derived & setIdentity(Index rows, Index cols)
Resizes to the given size, and writes the identity expression (not necessarily square) into *this.
Definition CwiseNullaryOp.h:827
static const IdentityReturnType Identity()
Definition CwiseNullaryOp.h:754
constexpr RealScalar squaredNorm() const
Definition Dot.h:313
const MatrixPowerReturnValue< MatrixWrapper< ExpressionType > > pow(const RealScalar &p) const
constexpr const SkewSymmetricWrapper< const Derived > asSkewSymmetric() const
Definition SkewSymmetricMatrix3.h:381
static const BasisReturnType Unit(Index i)
Definition CwiseNullaryOp.h:854
void applyOnTheRight(Index p, Index q, const JacobiRotation< OtherScalar > &j)
Definition Jacobi.h:358
const MatrixSquareRootReturnValue< MatrixWrapper< ExpressionType > > sqrt() const
const MatrixFunctionReturnValue< MatrixWrapper< ExpressionType > > sinh() const
constexpr ArrayWrapper< Derived > array()
Definition MatrixBase.h:331
bool isSkewSymmetric(const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition SkewSymmetricMatrix3.h:389
static const BasisReturnType UnitZ()
Definition CwiseNullaryOp.h:892
bool isUpperTriangular(const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition TriangularMatrix.h:775
constexpr Index diagonalSize() const
Definition MatrixBase.h:102
constexpr const ConstDiagonalReturnType diagonal() const
Definition Diagonal.h:176
constexpr DiagonalWrapper< Diagonal< const Derived, DiagIndex_ > > diagonalView() const
Definition DiagonalMatrix.h:477
void applyHouseholderOnTheRight(const EssentialPart &essential, const Scalar &tau, Scalar *workspace)
Definition Householder.h:393
constexpr const ArrayWrapper< const Derived > array() const
Definition MatrixBase.h:336
constexpr const DiagonalWrapper< const Derived > asDiagonal() const
Definition DiagonalMatrix.h:428
const MatrixFunctionReturnValue< MatrixWrapper< ExpressionType > > cos() const
static const BasisReturnType Unit(Index size, Index i)
Definition CwiseNullaryOp.h:839
Derived & setUnit(Index i)
Set the coefficients of *this to the i-th unit (basis) vector.
Definition CwiseNullaryOp.h:917
const MatrixFunctionReturnValue< MatrixWrapper< ExpressionType > > acosh() const
static const IdentityReturnType Identity(Index rows, Index cols)
Definition CwiseNullaryOp.h:738
void normalize()
Definition Dot.h:360
BunchKaufman< PlainObject > bunchKaufman() const
Definition BunchKaufman.h:1117
RealScalar norm() const
Definition Dot.h:325
const Product< Derived, OtherDerived, LazyProduct > lazyProduct(const MatrixBase< OtherDerived > &other) const
Definition GeneralProduct.h:603
const Product< Derived, OtherDerived > operator*(const MatrixBase< OtherDerived > &other) const
Definition GeneralProduct.h:561
void applyOnTheLeft(Index p, Index q, const JacobiRotation< OtherScalar > &j)
Definition Jacobi.h:343
constexpr const CwiseBinaryEqualReturnType< OtherDerived > cwiseEqual(const Eigen::MatrixBase< OtherDerived > &other) const
Definition MatrixBase.h:61
void makeHouseholderInPlace(Scalar &tau, RealScalar &beta)
Definition Householder.h:116
bool isOrthogonal(const MatrixBase< OtherDerived > &other, const RealScalar &prec=NumTraits< Scalar >::dummy_precision()) const
Definition Dot.h:548
static const BasisReturnType UnitW()
Definition CwiseNullaryOp.h:904
The matrix class, also used for vectors and row-vectors.
Definition Matrix.h:188
Pseudo expression providing an operator = assuming no aliasing.
Definition NoAlias.h:35
LU decomposition of a matrix with partial pivoting, and related features.
Definition PartialPivLU.h:67
Class to view a vector of integers as a permutation matrix.
Definition PermutationMatrix.h:512
Expression of the product of two arbitrary matrices or vectors.
Definition Product.h:203
Randomized blocked Householder rank-revealing QR with column pivoting.
Definition RandColPivHouseholderQR.h:134
Complete orthogonal decomposition (COD) of a matrix, backed by RandColPivHouseholderQR.
Definition CompleteOrthogonalDecomposition.h:488
Expression of a selfadjoint matrix from a triangular part of a dense matrix.
Definition SelfAdjointView.h:54
Base class for skew symmetric matrices and expressions.
Definition SkewSymmetricMatrix3.h:36
Expression of a skew symmetric matrix.
Definition SkewSymmetricMatrix3.h:357
Base class of any sparse matrices or sparse expressions.
Definition SparseMatrixBase.h:31
constexpr const CwiseBinaryOp< internal::scalar_product_op< Derived ::Scalar, OtherDerived ::Scalar >, const Derived, const OtherDerived > cwiseProduct(const Eigen::SparseMatrixBase< OtherDerived > &other) const
Definition SparseMatrixBase.h:25
Expression of a dense or sparse matrix with zero or too small values removed.
Definition SparseView.h:46
Expression of a triangular part in a matrix.
Definition TriangularMatrix.h:426
Matrix< Scalar, 3, 1 > eulerAngles(Index a0, Index a1, Index a2) const
PlainObject cross3(const MatrixBase< OtherDerived > &other) const
internal::cross_impl< MatrixWrapper< ExpressionType >, OtherDerived >::return_type cross(const MatrixBase< OtherDerived > &other) const
const HNormalizedReturnType hnormalized() const
homogeneous normalization
Definition Homogeneous.h:165
HomogeneousReturnType homogeneous() const
Definition Homogeneous.h:125
Matrix< Scalar, 3, 1 > canonicalEulerAngles(Index a0, Index a1, Index a2) const
const SparseView< Derived > sparseView(const Scalar &m_reference=Scalar(0), const typename NumTraits< Scalar >::Real &m_epsilon=NumTraits< Scalar >::dummy_precision()) const
Definition SparseView.h:201
@ ColMajor
Definition Constants.h:319
@ Horizontal
Definition Constants.h:270
@ Vertical
Definition Constants.h:267
constexpr unsigned int RowMajorBit
Definition Constants.h:71
Definition EigenBase.h:34
constexpr Derived & derived()
Definition EigenBase.h:50
Determines whether the given binary operation of two numeric types is allowed and what the scalar ret...
Definition XprHelper.h:1062