mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-25 01:41:43 +00:00
[wpimath] Upgrade to Eigen 3.3.9 (#2910)
It fixes some compilation errors with C++20.
This commit is contained in:
@@ -453,6 +453,24 @@ struct auto_diff_special_op<_DerType, false>
|
||||
void operator+() const;
|
||||
};
|
||||
|
||||
template<typename BinOp, typename A, typename B, typename RefType>
|
||||
void make_coherent_expression(CwiseBinaryOp<BinOp,A,B> xpr, const RefType &ref)
|
||||
{
|
||||
make_coherent(xpr.const_cast_derived().lhs(), ref);
|
||||
make_coherent(xpr.const_cast_derived().rhs(), ref);
|
||||
}
|
||||
|
||||
template<typename UnaryOp, typename A, typename RefType>
|
||||
void make_coherent_expression(const CwiseUnaryOp<UnaryOp,A> &xpr, const RefType &ref)
|
||||
{
|
||||
make_coherent(xpr.nestedExpression().const_cast_derived(), ref);
|
||||
}
|
||||
|
||||
// needed for compilation only
|
||||
template<typename UnaryOp, typename A, typename RefType>
|
||||
void make_coherent_expression(const CwiseNullaryOp<UnaryOp,A> &, const RefType &)
|
||||
{}
|
||||
|
||||
template<typename A_Scalar, int A_Rows, int A_Cols, int A_Options, int A_MaxRows, int A_MaxCols, typename B>
|
||||
struct make_coherent_impl<Matrix<A_Scalar, A_Rows, A_Cols, A_Options, A_MaxRows, A_MaxCols>, B> {
|
||||
typedef Matrix<A_Scalar, A_Rows, A_Cols, A_Options, A_MaxRows, A_MaxCols> A;
|
||||
@@ -462,6 +480,10 @@ struct make_coherent_impl<Matrix<A_Scalar, A_Rows, A_Cols, A_Options, A_MaxRows,
|
||||
a.resize(b.size());
|
||||
a.setZero();
|
||||
}
|
||||
else if (B::SizeAtCompileTime==Dynamic && a.size()!=0 && b.size()==0)
|
||||
{
|
||||
make_coherent_expression(b,a);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -474,13 +496,17 @@ struct make_coherent_impl<A, Matrix<B_Scalar, B_Rows, B_Cols, B_Options, B_MaxRo
|
||||
b.resize(a.size());
|
||||
b.setZero();
|
||||
}
|
||||
else if (A::SizeAtCompileTime==Dynamic && b.size()!=0 && a.size()==0)
|
||||
{
|
||||
make_coherent_expression(a,b);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template<typename A_Scalar, int A_Rows, int A_Cols, int A_Options, int A_MaxRows, int A_MaxCols,
|
||||
typename B_Scalar, int B_Rows, int B_Cols, int B_Options, int B_MaxRows, int B_MaxCols>
|
||||
struct make_coherent_impl<Matrix<A_Scalar, A_Rows, A_Cols, A_Options, A_MaxRows, A_MaxCols>,
|
||||
Matrix<B_Scalar, B_Rows, B_Cols, B_Options, B_MaxRows, B_MaxCols> > {
|
||||
Matrix<B_Scalar, B_Rows, B_Cols, B_Options, B_MaxRows, B_MaxCols> > {
|
||||
typedef Matrix<A_Scalar, A_Rows, A_Cols, A_Options, A_MaxRows, A_MaxCols> A;
|
||||
typedef Matrix<B_Scalar, B_Rows, B_Cols, B_Options, B_MaxRows, B_MaxCols> B;
|
||||
static void run(A& a, B& b) {
|
||||
|
||||
@@ -412,7 +412,7 @@ template<typename Derived> struct MatrixExponentialReturnValue
|
||||
inline void evalTo(ResultType& result) const
|
||||
{
|
||||
const typename internal::nested_eval<Derived, 10>::type tmp(m_src);
|
||||
internal::matrix_exp_compute(tmp, result, internal::is_exp_known_type<typename Derived::Scalar>());
|
||||
internal::matrix_exp_compute(tmp, result, internal::is_exp_known_type<typename Derived::RealScalar>());
|
||||
}
|
||||
|
||||
Index rows() const { return m_src.rows(); }
|
||||
|
||||
@@ -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