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 may alias the base m_A (A = A.pow(p)), which the integer power and the Schur decomposition still read.
481 MatrixType power = MatrixType::Identity(rows(), cols());
482 computeIntPower(power, intpart);
483 if (p) computeFracPower(power, p);
484 res = power;
485 }
486}
487
488template <typename MatrixType>
489void MatrixPower<MatrixType>::split(RealScalar& p, RealScalar& intpart) {
490 using std::floor;
491 using std::pow;
492
493 intpart = floor(p);
494 p -= intpart;
495
496 // Perform Schur decomposition if it is not yet performed and the power is
497 // not an integer.
498 if (!m_conditionNumber && p) initialize();
499
500 // Choose the more stable of intpart = floor(p) and intpart = ceil(p).
501 if (p > RealScalar(0.5) && p > (1 - p) * pow(m_conditionNumber, p)) {
502 --p;
503 ++intpart;
504 }
505}
506
507template <typename MatrixType>
508void MatrixPower<MatrixType>::initialize() {
509 const ComplexSchur<MatrixType> schurOfA(m_A);
511 ComplexScalar eigenvalue;
512
513 m_fT.resizeLike(m_A);
514 m_T = schurOfA.matrixT();
515 m_U = schurOfA.matrixU();
516 m_conditionNumber = m_T.diagonal().array().abs().maxCoeff() / m_T.diagonal().array().abs().minCoeff();
517
518 // Move zero eigenvalues to the bottom right corner.
519 for (Index i = cols() - 1; i >= 0; --i) {
520 if (m_T.coeff(i, i) == RealScalar(0)) {
521 for (Index j = i + 1; j < m_rank; ++j) {
522 eigenvalue = m_T.coeff(j, j);
523 rot.makeGivens(m_T.coeff(j - 1, j), eigenvalue);
524 m_T.applyOnTheRight(j - 1, j, rot);
525 m_T.applyOnTheLeft(j - 1, j, rot.adjoint());
526 m_T.coeffRef(j - 1, j - 1) = eigenvalue;
527 m_T.coeffRef(j, j) = RealScalar(0);
528 m_U.applyOnTheRight(j - 1, j, rot);
529 }
530 --m_rank;
531 }
532 }
533
534 m_nulls = rows() - m_rank;
535 if (m_nulls) {
536 eigen_assert(m_T.bottomRightCorner(m_nulls, m_nulls).isZero() &&
537 "Base of matrix power should be invertible or with a semisimple zero eigenvalue.");
538 m_fT.bottomRows(m_nulls).fill(RealScalar(0));
539 }
540}
541
542template <typename MatrixType>
543template <typename ResultType>
544void MatrixPower<MatrixType>::computeIntPower(ResultType& res, RealScalar p) {
545 using std::abs;
546 using std::fmod;
547 RealScalar pp = abs(p);
548
549 if (p < 0)
550 m_tmp = m_A.inverse();
551 else
552 m_tmp = m_A;
553
554 while (true) {
555 if (fmod(pp, 2) >= 1) res = m_tmp * res;
556 pp /= 2;
557 if (pp < 1) break;
558 m_tmp *= m_tmp;
559 }
560}
561
562template <typename MatrixType>
563template <typename ResultType>
564void MatrixPower<MatrixType>::computeFracPower(ResultType& res, RealScalar p) {
565 Block<ComplexMatrix, Dynamic, Dynamic> blockTp(m_fT, 0, 0, m_rank, m_rank);
566 eigen_assert(m_conditionNumber);
567 eigen_assert(m_rank + m_nulls == rows());
568
569 MatrixPowerAtomic<ComplexMatrix>(m_T.topLeftCorner(m_rank, m_rank), p).compute(blockTp);
570 if (m_nulls && m_rank) {
571 // 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),
572 // 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)
573 // itself can overflow or underflow when the result does not.
574 using std::pow;
575 const RealScalar scale = pow(m_T.diagonal().head(m_rank).cwiseAbs().minCoeff(), 1 - p);
576 m_fT.topRightCorner(m_rank, m_nulls).noalias() =
577 m_T.topLeftCorner(m_rank, m_rank).template triangularView<Upper>().template solve<OnTheRight>(scale * blockTp) *
578 m_T.topRightCorner(m_rank, m_nulls);
579 m_fT.topRightCorner(m_rank, m_nulls) /= scale;
580 }
581 revertSchur(m_tmp, m_fT, m_U);
582 res = m_tmp * res;
583}
584
585template <typename MatrixType>
586template <int Rows, int Cols, int Options, int MaxRows, int MaxCols>
587inline void MatrixPower<MatrixType>::revertSchur(Matrix<ComplexScalar, Rows, Cols, Options, MaxRows, MaxCols>& res,
588 const ComplexMatrix& T, const ComplexMatrix& U) {
589 res.noalias() = U * (T.template triangularView<Upper>() * U.adjoint());
590}
591
592template <typename MatrixType>
593template <int Rows, int Cols, int Options, int MaxRows, int MaxCols>
594inline void MatrixPower<MatrixType>::revertSchur(Matrix<RealScalar, Rows, Cols, Options, MaxRows, MaxCols>& res,
595 const ComplexMatrix& T, const ComplexMatrix& U) {
596 res.noalias() = (U * (T.template triangularView<Upper>() * U.adjoint())).real();
597}
598
612template <typename Derived>
613class MatrixPowerReturnValue : public ReturnByValue<MatrixPowerReturnValue<Derived> > {
614 public:
615 using PlainObject = typename Derived::PlainObject;
616 using RealScalar = typename Derived::RealScalar;
617
624 MatrixPowerReturnValue(const Derived& A, RealScalar p) : m_A(A), m_p(p) {}
625
632 template <typename ResultType>
633 inline void evalTo(ResultType& result) const {
634 MatrixPower<PlainObject>(m_A.eval()).compute(result, m_p);
635 }
636
637 Index rows() const { return m_A.rows(); }
638 Index cols() const { return m_A.cols(); }
639
640 private:
641 const Derived& m_A;
642 const RealScalar m_p;
643};
644
658template <typename Derived>
659class MatrixComplexPowerReturnValue : public ReturnByValue<MatrixComplexPowerReturnValue<Derived> > {
660 public:
661 using PlainObject = typename Derived::PlainObject;
662 using ComplexScalar = internal::make_complex_t<typename Derived::Scalar>;
663
670 MatrixComplexPowerReturnValue(const Derived& A, const ComplexScalar& p) : m_A(A), m_p(p) {}
671
681 template <typename ResultType>
682 inline void evalTo(ResultType& result) const {
683 result = (m_p * m_A.log()).exp();
684 }
685
686 Index rows() const { return m_A.rows(); }
687 Index cols() const { return m_A.cols(); }
688
689 private:
690 const Derived& m_A;
691 const ComplexScalar m_p;
692};
693
694namespace internal {
695
696template <typename MatrixPowerType>
697struct traits<MatrixPowerParenthesesReturnValue<MatrixPowerType> > {
698 using ReturnType = typename MatrixPowerType::PlainObject;
699};
700
701template <typename Derived>
702struct traits<MatrixPowerReturnValue<Derived> > {
703 using ReturnType = typename Derived::PlainObject;
704};
705
706template <typename Derived>
707struct traits<MatrixComplexPowerReturnValue<Derived> > {
708 using ReturnType = typename Derived::PlainObject;
709};
710
711} // namespace internal
712
713template <typename Derived>
714const MatrixPowerReturnValue<Derived> MatrixBase<Derived>::pow(const RealScalar& p) const {
715 return MatrixPowerReturnValue<Derived>(derived(), p);
716}
717
718template <typename Derived>
719const MatrixComplexPowerReturnValue<Derived> MatrixBase<Derived>::pow(const internal::make_complex_t<Scalar>& p) const {
720 return MatrixComplexPowerReturnValue<Derived>(derived(), p);
721}
722
723} // namespace Eigen
724
725#endif // EIGEN_MATRIX_POWER
const MatrixComplexPowerReturnValue< Derived > pow(const internal::make_complex_t< Scalar > &p) const
Definition MatrixPower.h:719
Proxy for the matrix power of some matrix (expression).
Definition MatrixPower.h:659
MatrixComplexPowerReturnValue(const Derived &A, const ComplexScalar &p)
Constructor.
Definition MatrixPower.h:670
void evalTo(ResultType &result) const
Compute the matrix power.
Definition MatrixPower.h:682
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:613
MatrixPowerReturnValue(const Derived &A, RealScalar p)
Constructor.
Definition MatrixPower.h:624
void evalTo(ResultType &result) const
Compute the matrix power.
Definition MatrixPower.h:633
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.