mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Bug #1796: Make matrix squareroot usable for Map and Ref types
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user