diff options
author | Christoph Hertzberg <chtz@informatik.uni-bremen.de> | 2019-12-20 18:10:22 +0100 |
---|---|---|
committer | Christoph Hertzberg <chtz@informatik.uni-bremen.de> | 2019-12-20 18:10:22 +0100 |
commit | 1e9664b14737d016fabbdb72327aeda6a06bf623 (patch) | |
tree | 319dbbe12abf519c8962ab6fcb4d60d0b58662c9 /unsupported/Eigen/src | |
parent | d86544d6549078997f5986015f5a86c493cd5ee3 (diff) |
Bug #1796: Make matrix squareroot usable for Map and Ref types
Diffstat (limited to 'unsupported/Eigen/src')
-rw-r--r-- | unsupported/Eigen/src/MatrixFunctions/MatrixSquareRoot.h | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/unsupported/Eigen/src/MatrixFunctions/MatrixSquareRoot.h b/unsupported/Eigen/src/MatrixFunctions/MatrixSquareRoot.h index 34bf78913..e363e779d 100644 --- a/unsupported/Eigen/src/MatrixFunctions/MatrixSquareRoot.h +++ b/unsupported/Eigen/src/MatrixFunctions/MatrixSquareRoot.h @@ -253,18 +253,19 @@ struct matrix_sqrt_compute template <typename MatrixType> struct matrix_sqrt_compute<MatrixType, 0> { + typedef typename MatrixType::PlainObject PlainType; template <typename ResultType> static void run(const MatrixType &arg, ResultType &result) { eigen_assert(arg.rows() == arg.cols()); // Compute Schur decomposition of arg - const RealSchur<MatrixType> schurOfA(arg); - const MatrixType& T = schurOfA.matrixT(); - const MatrixType& U = schurOfA.matrixU(); + const RealSchur<PlainType> schurOfA(arg); + const PlainType& T = schurOfA.matrixT(); + const PlainType& U = schurOfA.matrixU(); // Compute square root of T - MatrixType sqrtT = MatrixType::Zero(arg.rows(), arg.cols()); + PlainType sqrtT = PlainType::Zero(arg.rows(), arg.cols()); matrix_sqrt_quasi_triangular(T, sqrtT); // Compute square root of arg @@ -278,18 +279,19 @@ struct matrix_sqrt_compute<MatrixType, 0> template <typename MatrixType> struct matrix_sqrt_compute<MatrixType, 1> { + typedef typename MatrixType::PlainObject PlainType; template <typename ResultType> static void run(const MatrixType &arg, ResultType &result) { eigen_assert(arg.rows() == arg.cols()); // Compute Schur decomposition of arg - const ComplexSchur<MatrixType> schurOfA(arg); - const MatrixType& T = schurOfA.matrixT(); - const MatrixType& U = schurOfA.matrixU(); + const ComplexSchur<PlainType> schurOfA(arg); + const PlainType& T = schurOfA.matrixT(); + const PlainType& U = schurOfA.matrixU(); // Compute square root of T - MatrixType sqrtT; + PlainType sqrtT; matrix_sqrt_triangular(T, sqrtT); // Compute square root of arg |