Eigen-Contrib  5.0.1-dev+master
 
Loading...
Searching...
No Matches
MatrixPower.h
1// This file is part of Eigen, a lightweight C++ template library
2// for linear algebra.
3//
4// Copyright (C) 2012, 2013 Chen-Pang He <jdh8@ms63.hinet.net>
5//
6// This Source Code Form is subject to the terms of the Mozilla
7// Public License v. 2.0. If a copy of the MPL was not distributed
8// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9// SPDX-License-Identifier: MPL-2.0
10
11#ifndef EIGEN_MATRIX_POWER
12#define EIGEN_MATRIX_POWER
13
14// IWYU pragma: private
15#include "./InternalHeaderCheck.h"
16
17namespace Eigen {
18
19template <typename MatrixType>
20class MatrixPower;
21
35/* TODO: This class is only used by MatrixPower, so it should be nested
36 * into MatrixPower, like MatrixPower::ReturnValue. However, my
37 * compiler complained about unused template parameter in the
38 * following declaration in namespace internal.
39 *
40 * template<typename MatrixType>
41 * struct traits<MatrixPower<MatrixType>::ReturnValue>;
42 */
43template <typename MatrixType>
44class MatrixPowerParenthesesReturnValue : public ReturnByValue<MatrixPowerParenthesesReturnValue<MatrixType> > {
45 public:
46 using RealScalar = typename MatrixType::RealScalar;
47
54 MatrixPowerParenthesesReturnValue(MatrixPower<MatrixType>& pow, RealScalar p) : m_pow(pow), m_p(p) {}
55
61 template <typename ResultType>
62 inline void evalTo(ResultType& result) const {
63 m_pow.compute(result, m_p);
64 }
65
66 Index rows() const { return m_pow.rows(); }
67 Index cols() const { return m_pow.cols(); }
68
69 private:
70 MatrixPower<MatrixType>& m_pow;
71 const RealScalar m_p;
72};
73
89template <typename MatrixType>
90class MatrixPowerAtomic {
91 private:
92 enum { RowsAtCompileTime = MatrixType::RowsAtCompileTime, MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime };
93 using Scalar = typename MatrixType::Scalar;
94 using RealScalar = typename MatrixType::RealScalar;
95 using ComplexScalar = internal::make_complex_t<Scalar>;
96 using ResultType = Block<MatrixType, Dynamic, Dynamic>;
97
98 const MatrixType& m_A;
99 RealScalar m_p;
100
101 void computePade(int degree, const MatrixType& IminusT, ResultType& res) const;
102 void compute2x2(ResultType& res, RealScalar p) const;
103 void computeBig(ResultType& res) const;
104 static int getPadeDegree(float normIminusT);
105 static int getPadeDegree(double normIminusT);
106 static int getPadeDegree(long double normIminusT);
107 static ComplexScalar computeSuperDiag(const ComplexScalar&, const ComplexScalar&, RealScalar p);
108 static RealScalar computeSuperDiag(RealScalar, RealScalar, RealScalar p);
109
110 public:
111 MatrixPowerAtomic(const MatrixPowerAtomic&) = delete;
112 MatrixPowerAtomic& operator=(const MatrixPowerAtomic&) = delete;
113
125 MatrixPowerAtomic(const MatrixType& T, RealScalar p);
126
133 void compute(ResultType& res) const;
134};
135
136template <typename MatrixType>
137MatrixPowerAtomic<MatrixType>::MatrixPowerAtomic(const MatrixType& T, RealScalar p) : m_A(T), m_p(p) {
138 EIGEN_INTERNAL_ASSERT_SQUARE(T);
139 eigen_assert(p > -1 && p < 1);
140}
141
142template <typename MatrixType>
143void MatrixPowerAtomic<MatrixType>::compute(ResultType& res) const {
144 using std::pow;
145 switch (m_A.rows()) {
146 case 0:
147 break;
148 case 1:
149 res(0, 0) = pow(m_A(0, 0), m_p);
150 break;
151 case 2:
152 compute2x2(res, m_p);
153 res.coeffRef(1, 0) = Scalar(0);
154 break;
155 default:
156 computeBig(res);
157 }
158}
159
160template <typename MatrixType>
161void MatrixPowerAtomic<MatrixType>::computePade(int degree, const MatrixType& IminusT, ResultType& res) const {
162 int i = 2 * degree;
163 res = (m_p - RealScalar(degree)) / RealScalar(2 * i - 2) * IminusT;
164
165 for (--i; i; --i) {
166 res = (MatrixType::Identity(IminusT.rows(), IminusT.cols()) + res)
167 .template triangularView<Upper>()
168 .solve((i == 1 ? -m_p
169 : i & 1 ? (-m_p - RealScalar(i / 2)) / RealScalar(2 * i)
170 : (m_p - RealScalar(i / 2)) / RealScalar(2 * i - 2)) *
171 IminusT)
172 .eval();
173 }
174 res += MatrixType::Identity(IminusT.rows(), IminusT.cols());
175}
176
177// This function assumes that res has the correct size (see bug 614)
178template <typename MatrixType>
179void MatrixPowerAtomic<MatrixType>::compute2x2(ResultType& res, RealScalar p) const {
180 using std::abs;
181 using std::pow;
182 res.coeffRef(0, 0) = pow(m_A.coeff(0, 0), p);
183
184 for (Index i = 1; i < m_A.cols(); ++i) {
185 res.coeffRef(i, i) = pow(m_A.coeff(i, i), p);
186 Scalar a = m_A.coeff(i - 1, i - 1);
187 Scalar b = m_A.coeff(i, i);
188 Scalar diff = b - a;
189 // Use the derivative formula when eigenvalues are nearly equal to avoid
190 // catastrophic cancellation in the difference quotient.
191 if (abs(diff) <= RealScalar(2) * (std::numeric_limits<RealScalar>::epsilon)() * (std::max)(abs(a), abs(b)))
192 res.coeffRef(i - 1, i) = p * pow(b, p - 1);
193 else if (2 * abs(a) < abs(b) || 2 * abs(b) < abs(a))
194 res.coeffRef(i - 1, i) = (res.coeff(i, i) - res.coeff(i - 1, i - 1)) / diff;
195 else
196 res.coeffRef(i - 1, i) = computeSuperDiag(b, a, p);
197 res.coeffRef(i - 1, i) *= m_A.coeff(i - 1, i);
198 }
199}
200
201template <typename MatrixType>
202void MatrixPowerAtomic<MatrixType>::computeBig(ResultType& res) const {
203 using std::ldexp;
204 const int digits = std::numeric_limits<RealScalar>::digits;
205 const RealScalar maxNormForPade =
206 RealScalar(digits <= 24 ? 4.3386528e-1L // single precision
207 : digits <= 53 ? 2.789358995219730e-1L // double precision
208 : digits <= 64 ? 2.4471944416607995472e-1L // extended precision
209 : digits <= 106 ? 1.1016843812851143391275867258512e-1L // double-double
210 : 9.134603732914548552537150753385375e-2L); // quadruple precision
211 MatrixType IminusT, sqrtT, T = m_A.template triangularView<Upper>();
212 RealScalar normIminusT;
213 int degree, degree2, numberOfSquareRoots = 0;
214 bool hasExtraSquareRoot = false;
215
216 for (Index i = 0; i < m_A.cols(); ++i) eigen_assert(m_A(i, i) != RealScalar(0));
217
218 while (true) {
219 // A nonfinite entry is a fixed point of the square roots, which can also create one: R(i,j) divides by
220 // R(i,i) + R(j,j), which can be tiny, or zero for the roots i and -i of -1+0i and -1-0i.
221 if (!T.allFinite()) {
222 res.setConstant(Scalar(NumTraits<RealScalar>::quiet_NaN()));
223 return;
224 }
225 IminusT = MatrixType::Identity(m_A.rows(), m_A.cols()) - T;
226 normIminusT = IminusT.cwiseAbs().colwise().sum().maxCoeff();
227 if (normIminusT < maxNormForPade) {
228 degree = getPadeDegree(normIminusT);
229 degree2 = getPadeDegree(normIminusT / 2);
230 if (degree - degree2 <= 1 || hasExtraSquareRoot) break;
231 hasExtraSquareRoot = true;
232 }
233 matrix_sqrt_triangular(T, sqrtT);
234 T = sqrtT.template triangularView<Upper>();
235 ++numberOfSquareRoots;
236 }
237 computePade(degree, IminusT, res);
238
239 for (; numberOfSquareRoots; --numberOfSquareRoots) {
240 compute2x2(res, ldexp(m_p, -numberOfSquareRoots));
241 res = res.template triangularView<Upper>() * res;
242 }
243 compute2x2(res, m_p);
244}
245
246template <typename MatrixType>
247inline int MatrixPowerAtomic<MatrixType>::getPadeDegree(float normIminusT) {
248 const float maxNormForPade[] = {2.8064004e-1f /* degree = 3 */, 4.3386528e-1f};
249 int degree = 3;
250 for (; degree <= 4; ++degree)
251 if (normIminusT <= maxNormForPade[degree - 3]) break;
252 return degree;
253}
254
255template <typename MatrixType>
256inline int MatrixPowerAtomic<MatrixType>::getPadeDegree(double normIminusT) {
257 const double maxNormForPade[] = {1.884160592658218e-2 /* degree = 3 */, 6.038881904059573e-2, 1.239917516308172e-1,
258 1.999045567181744e-1, 2.789358995219730e-1};
259 int degree = 3;
260 for (; degree <= 7; ++degree)
261 if (normIminusT <= maxNormForPade[degree - 3]) break;
262 return degree;
263}
264
265template <typename MatrixType>
266inline int MatrixPowerAtomic<MatrixType>::getPadeDegree(long double normIminusT) {
267#if LDBL_MANT_DIG == 53
268 const int maxPadeDegree = 7;
269 const double maxNormForPade[] = {1.884160592658218e-2L /* degree = 3 */, 6.038881904059573e-2L, 1.239917516308172e-1L,
270 1.999045567181744e-1L, 2.789358995219730e-1L};
271#elif LDBL_MANT_DIG <= 64
272 const int maxPadeDegree = 8;
273 const long double maxNormForPade[] = {6.3854693117491799460e-3L /* degree = 3 */,
274 2.6394893435456973676e-2L,
275 6.4216043030404063729e-2L,
276 1.1701165502926694307e-1L,
277 1.7904284231268670284e-1L,
278 2.4471944416607995472e-1L};
279#elif LDBL_MANT_DIG <= 106
280 const int maxPadeDegree = 10;
281 const double maxNormForPade[] = {1.0007161601787493236741409687186e-4L /* degree = 3 */,
282 1.0007161601787493236741409687186e-3L,
283 4.7069769360887572939882574746264e-3L,
284 1.3220386624169159689406653101695e-2L,
285 2.8063482381631737920612944054906e-2L,
286 4.9625993951953473052385361085058e-2L,
287 7.7367040706027886224557538328171e-2L,
288 1.1016843812851143391275867258512e-1L};
289#else
290 const int maxPadeDegree = 10;
291 const double maxNormForPade[] = {5.524506147036624377378713555116378e-5L /* degree = 3 */,
292 6.640600568157479679823602193345995e-4L,
293 3.227716520106894279249709728084626e-3L,
294 9.619593944683432960546978734646284e-3L,
295 2.134595382433742403911124458161147e-2L,
296 3.908166513900489428442993794761185e-2L,
297 6.266780814639442865832535460550138e-2L,
298 9.134603732914548552537150753385375e-2L};
299#endif
300 int degree = 3;
301 for (; degree <= maxPadeDegree; ++degree)
302 if (normIminusT <= static_cast<long double>(maxNormForPade[degree - 3])) break;
303 return degree;
304}
305
306template <typename MatrixType>
307inline typename MatrixPowerAtomic<MatrixType>::ComplexScalar MatrixPowerAtomic<MatrixType>::computeSuperDiag(
308 const ComplexScalar& curr, const ComplexScalar& prev, RealScalar p) {
309 using std::ceil;
310 using std::exp;
311 using std::log;
312 using std::sinh;
313
314 ComplexScalar logCurr = log(curr);
315 ComplexScalar logPrev = log(prev);
316 RealScalar unwindingNumber =
317 ceil((numext::imag(logCurr - logPrev) - RealScalar(EIGEN_PI)) / RealScalar(2 * EIGEN_PI));
318 ComplexScalar w =
319 numext::log1p((curr - prev) / prev) / RealScalar(2) + ComplexScalar(0, RealScalar(EIGEN_PI) * unwindingNumber);
320 return RealScalar(2) * exp(RealScalar(0.5) * p * (logCurr + logPrev)) * sinh(p * w) / (curr - prev);
321}
322
323template <typename MatrixType>
324inline typename MatrixPowerAtomic<MatrixType>::RealScalar MatrixPowerAtomic<MatrixType>::computeSuperDiag(
325 RealScalar curr, RealScalar prev, RealScalar p) {
326 using std::exp;
327 using std::log;
328 using std::sinh;
329
330 RealScalar w = numext::log1p((curr - prev) / prev) / RealScalar(2);
331 return 2 * exp(p * (log(curr) + log(prev)) / 2) * sinh(p * w) / (curr - prev);
332}
333
353template <typename MatrixType>
354class MatrixPower {
355 private:
356 using Scalar = typename MatrixType::Scalar;
357 using RealScalar = typename MatrixType::RealScalar;
358
359 public:
360 MatrixPower(const MatrixPower&) = delete;
361 MatrixPower& operator=(const MatrixPower&) = delete;
362
371 explicit MatrixPower(const MatrixType& A) : m_A(A), m_conditionNumber(0), m_rank(A.cols()), m_nulls(0) {
372 EIGEN_INTERNAL_ASSERT_SQUARE(A);
373 }
374
385
393 template <typename ResultType>
394 void compute(ResultType& res, RealScalar p);
395
396 Index rows() const { return m_A.rows(); }
397 Index cols() const { return m_A.cols(); }
398
399 private:
400 using ComplexScalar = internal::make_complex_t<Scalar>;
401 using ComplexMatrix =
402 Matrix<ComplexScalar, Dynamic, Dynamic, 0, MatrixType::RowsAtCompileTime, MatrixType::ColsAtCompileTime>;
403
405 typename MatrixType::Nested m_A;
406
408 MatrixType m_tmp;
409
411 ComplexMatrix m_T, m_U;
412
414 ComplexMatrix m_fT;
415
422 RealScalar m_conditionNumber;
423
425 Index m_rank;
426
428 Index m_nulls;
429
439 void split(RealScalar& p, RealScalar& intpart);
440
442 void initialize();
443
444 template <typename ResultType>
445 void computeIntPower(ResultType& res, RealScalar p);
446
447 template <typename ResultType>
448 void computeFracPower(ResultType& res, RealScalar p);
449
450 template <int Rows, int Cols, int Options, int MaxRows, int MaxCols>
451 static void revertSchur(Matrix<ComplexScalar, Rows, Cols, Options, MaxRows, MaxCols>& res, const ComplexMatrix& T,
452 const ComplexMatrix& U);
453
454 template <int Rows, int Cols, int Options, int MaxRows, int MaxCols>
455 static void revertSchur(Matrix<RealScalar, Rows, Cols, Options, MaxRows, MaxCols>& res, const ComplexMatrix& T,
456 const ComplexMatrix& U);
457};
458
459template <typename MatrixType>
460template <typename ResultType>
461void MatrixPower<MatrixType>::compute(ResultType& res, RealScalar p) {
462 using std::pow;
463 switch (cols()) {
464 case 0:
465 res.resize(0, 0);
466 break;
467 case 1:
468 res.resize(1, 1);
469 res(0, 0) = pow(m_A.coeff(0, 0), p);
470 break;
471 default:
472 // The binary powering in computeIntPower() never terminates for a nonfinite exponent.
473 if (!(numext::isfinite)(p)) {
474 res = MatrixType::Constant(rows(), cols(), Scalar(NumTraits<RealScalar>::quiet_NaN()));
475 break;
476 }
477 RealScalar intpart;
478 split(p, intpart);
479
480 res = MatrixType::Identity(rows(), cols());
481 computeIntPower(res, intpart);
482 if (p) computeFracPower(res, p);
483 }
484}
485
486template <typename MatrixType>
487void MatrixPower<MatrixType>::split(RealScalar& p, RealScalar& intpart) {
488 using std::floor;
489 using std::pow;
490
491 intpart = floor(p);
492 p -= intpart;
493
494 // Perform Schur decomposition if it is not yet performed and the power is
495 // not an integer.
496 if (!m_conditionNumber && p) initialize();
497
498 // Choose the more stable of intpart = floor(p) and intpart = ceil(p).
499 if (p > RealScalar(0.5) && p > (1 - p) * pow(m_conditionNumber, p)) {
500 --p;
501 ++intpart;
502 }
503}
504
505template <typename MatrixType>
506void MatrixPower<MatrixType>::initialize() {
507 const ComplexSchur<MatrixType> schurOfA(m_A);
509 ComplexScalar eigenvalue;
510
511 m_fT.resizeLike(m_A);
512 m_T = schurOfA.matrixT();
513 m_U = schurOfA.matrixU();
514 m_conditionNumber = m_T.diagonal().array().abs().maxCoeff() / m_T.diagonal().array().abs().minCoeff();
515
516 // Move zero eigenvalues to the bottom right corner.
517 for (Index i = cols() - 1; i >= 0; --i) {
518 if (m_T.coeff(i, i) == RealScalar(0)) {
519 for (Index j = i + 1; j < m_rank; ++j) {
520 eigenvalue = m_T.coeff(j, j);
521 rot.makeGivens(m_T.coeff(j - 1, j), eigenvalue);
522 m_T.applyOnTheRight(j - 1, j, rot);
523 m_T.applyOnTheLeft(j - 1, j, rot.adjoint());
524 m_T.coeffRef(j - 1, j - 1) = eigenvalue;
525 m_T.coeffRef(j, j) = RealScalar(0);
526 m_U.applyOnTheRight(j - 1, j, rot);
527 }
528 --m_rank;
529 }
530 }
531
532 m_nulls = rows() - m_rank;
533 if (m_nulls) {
534 eigen_assert(m_T.bottomRightCorner(m_nulls, m_nulls).isZero() &&
535 "Base of matrix power should be invertible or with a semisimple zero eigenvalue.");
536 m_fT.bottomRows(m_nulls).fill(RealScalar(0));
537 }
538}
539
540template <typename MatrixType>
541template <typename ResultType>
542void MatrixPower<MatrixType>::computeIntPower(ResultType& res, RealScalar p) {
543 using std::abs;
544 using std::fmod;
545 RealScalar pp = abs(p);
546
547 if (p < 0)
548 m_tmp = m_A.inverse();
549 else
550 m_tmp = m_A;
551
552 while (true) {
553 if (fmod(pp, 2) >= 1) res = m_tmp * res;
554 pp /= 2;
555 if (pp < 1) break;
556 m_tmp *= m_tmp;
557 }
558}
559
560template <typename MatrixType>
561template <typename ResultType>
562void MatrixPower<MatrixType>::computeFracPower(ResultType& res, RealScalar p) {
563 Block<ComplexMatrix, Dynamic, Dynamic> blockTp(m_fT, 0, 0, m_rank, m_rank);
564 eigen_assert(m_conditionNumber);
565 eigen_assert(m_rank + m_nulls == rows());
566
567 MatrixPowerAtomic<ComplexMatrix>(m_T.topLeftCorner(m_rank, m_rank), p).compute(blockTp);
568 if (m_nulls && m_rank) {
569 // T^p = [T11^p, T11^(p-1) T12; 0, 0]. With s = min |diag(T11)|, form (s^(1-p) T11^p) T11^(-1) = (T11 / s)^(p-1),
570 // which does not depend on the scale of T, multiply by T12, and divide by s^(1-p) last: T11^p T12 or T11^(p-1)
571 // itself can overflow or underflow when the result does not.
572 using std::pow;
573 const RealScalar scale = pow(m_T.diagonal().head(m_rank).cwiseAbs().minCoeff(), 1 - p);
574 m_fT.topRightCorner(m_rank, m_nulls).noalias() =
575 m_T.topLeftCorner(m_rank, m_rank).template triangularView<Upper>().template solve<OnTheRight>(scale * blockTp) *
576 m_T.topRightCorner(m_rank, m_nulls);
577 m_fT.topRightCorner(m_rank, m_nulls) /= scale;
578 }
579 revertSchur(m_tmp, m_fT, m_U);
580 res = m_tmp * res;
581}
582
583template <typename MatrixType>
584template <int Rows, int Cols, int Options, int MaxRows, int MaxCols>
585inline void MatrixPower<MatrixType>::revertSchur(Matrix<ComplexScalar, Rows, Cols, Options, MaxRows, MaxCols>& res,
586 const ComplexMatrix& T, const ComplexMatrix& U) {
587 res.noalias() = U * (T.template triangularView<Upper>() * U.adjoint());
588}
589
590template <typename MatrixType>
591template <int Rows, int Cols, int Options, int MaxRows, int MaxCols>
592inline void MatrixPower<MatrixType>::revertSchur(Matrix<RealScalar, Rows, Cols, Options, MaxRows, MaxCols>& res,
593 const ComplexMatrix& T, const ComplexMatrix& U) {
594 res.noalias() = (U * (T.template triangularView<Upper>() * U.adjoint())).real();
595}
596
610template <typename Derived>
611class MatrixPowerReturnValue : public ReturnByValue<MatrixPowerReturnValue<Derived> > {
612 public:
613 using PlainObject = typename Derived::PlainObject;
614 using RealScalar = typename Derived::RealScalar;
615
622 MatrixPowerReturnValue(const Derived& A, RealScalar p) : m_A(A), m_p(p) {}
623
630 template <typename ResultType>
631 inline void evalTo(ResultType& result) const {
632 MatrixPower<PlainObject>(m_A.eval()).compute(result, m_p);
633 }
634
635 Index rows() const { return m_A.rows(); }
636 Index cols() const { return m_A.cols(); }
637
638 private:
639 const Derived& m_A;
640 const RealScalar m_p;
641};
642
656template <typename Derived>
657class MatrixComplexPowerReturnValue : public ReturnByValue<MatrixComplexPowerReturnValue<Derived> > {
658 public:
659 using PlainObject = typename Derived::PlainObject;
660 using ComplexScalar = internal::make_complex_t<typename Derived::Scalar>;
661
668 MatrixComplexPowerReturnValue(const Derived& A, const ComplexScalar& p) : m_A(A), m_p(p) {}
669
679 template <typename ResultType>
680 inline void evalTo(ResultType& result) const {
681 result = (m_p * m_A.log()).exp();
682 }
683
684 Index rows() const { return m_A.rows(); }
685 Index cols() const { return m_A.cols(); }
686
687 private:
688 const Derived& m_A;
689 const ComplexScalar m_p;
690};
691
692namespace internal {
693
694template <typename MatrixPowerType>
695struct traits<MatrixPowerParenthesesReturnValue<MatrixPowerType> > {
696 using ReturnType = typename MatrixPowerType::PlainObject;
697};
698
699template <typename Derived>
700struct traits<MatrixPowerReturnValue<Derived> > {
701 using ReturnType = typename Derived::PlainObject;
702};
703
704template <typename Derived>
705struct traits<MatrixComplexPowerReturnValue<Derived> > {
706 using ReturnType = typename Derived::PlainObject;
707};
708
709} // namespace internal
710
711template <typename Derived>
712const MatrixPowerReturnValue<Derived> MatrixBase<Derived>::pow(const RealScalar& p) const {
713 return MatrixPowerReturnValue<Derived>(derived(), p);
714}
715
716template <typename Derived>
717const MatrixComplexPowerReturnValue<Derived> MatrixBase<Derived>::pow(const internal::make_complex_t<Scalar>& p) const {
718 return MatrixComplexPowerReturnValue<Derived>(derived(), p);
719}
720
721} // namespace Eigen
722
723#endif // EIGEN_MATRIX_POWER
const MatrixComplexPowerReturnValue< Derived > pow(const internal::make_complex_t< Scalar > &p) const
Definition MatrixPower.h:717
Proxy for the matrix power of some matrix (expression).
Definition MatrixPower.h:657
MatrixComplexPowerReturnValue(const Derived &A, const ComplexScalar &p)
Constructor.
Definition MatrixPower.h:668
void evalTo(ResultType &result) const
Compute the matrix power.
Definition MatrixPower.h:680
Class for computing matrix powers.
Definition MatrixPower.h:90
void compute(ResultType &res) const
Compute the matrix power.
Definition MatrixPower.h:143
Proxy for the matrix power of some matrix.
Definition MatrixPower.h:44
MatrixPowerParenthesesReturnValue(MatrixPower< MatrixType > &pow, RealScalar p)
Constructor.
Definition MatrixPower.h:54
void evalTo(ResultType &result) const
Compute the matrix power.
Definition MatrixPower.h:62
Proxy for the matrix power of some matrix (expression).
Definition MatrixPower.h:611
MatrixPowerReturnValue(const Derived &A, RealScalar p)
Constructor.
Definition MatrixPower.h:622
void evalTo(ResultType &result) const
Compute the matrix power.
Definition MatrixPower.h:631
Class for computing matrix powers.
Definition MatrixPower.h:354
MatrixPower(const MatrixType &A)
Constructor.
Definition MatrixPower.h:371
const MatrixPowerParenthesesReturnValue< MatrixType > operator()(RealScalar p)
Returns the matrix power.
Definition MatrixPower.h:382
void compute(ResultType &res, RealScalar p)
Compute the matrix power.
Definition MatrixPower.h:461
void matrix_sqrt_triangular(const MatrixType &arg, ResultType &result)
Compute matrix square root of triangular matrix.
Definition MatrixSquareRoot.h:194
Namespace containing all symbols from the Eigen library.