mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-07-30 16:52:01 +08:00
fix warning in EigenSolver::pseudoEigenvalueMatrix()
This commit is contained in:
parent
3ffb4e50df
commit
ba5183f98c
@ -319,17 +319,24 @@ template <typename MatrixType>
|
|||||||
MatrixType EigenSolver<MatrixType>::pseudoEigenvalueMatrix() const {
|
MatrixType EigenSolver<MatrixType>::pseudoEigenvalueMatrix() const {
|
||||||
eigen_assert(m_isInitialized && "EigenSolver is not initialized.");
|
eigen_assert(m_isInitialized && "EigenSolver is not initialized.");
|
||||||
const RealScalar precision = RealScalar(2) * NumTraits<RealScalar>::epsilon();
|
const RealScalar precision = RealScalar(2) * NumTraits<RealScalar>::epsilon();
|
||||||
Index n = m_eivalues.rows();
|
const Index n = m_eivalues.rows();
|
||||||
MatrixType matD = MatrixType::Zero(n, n);
|
MatrixType matD = MatrixType::Zero(n, n);
|
||||||
for (Index i = 0; i < n; ++i) {
|
Index i = 0;
|
||||||
if (internal::isMuchSmallerThan(numext::imag(m_eivalues.coeff(i)), numext::real(m_eivalues.coeff(i)), precision))
|
for (; i < n - 1; ++i) {
|
||||||
matD.coeffRef(i, i) = numext::real(m_eivalues.coeff(i));
|
RealScalar real = numext::real(m_eivalues.coeff(i));
|
||||||
else {
|
RealScalar imag = numext::imag(m_eivalues.coeff(i));
|
||||||
matD.template block<2, 2>(i, i) << numext::real(m_eivalues.coeff(i)), numext::imag(m_eivalues.coeff(i)),
|
matD.coeffRef(i, i) = real;
|
||||||
-numext::imag(m_eivalues.coeff(i)), numext::real(m_eivalues.coeff(i));
|
if (!internal::isMuchSmallerThan(imag, real, precision)) {
|
||||||
|
matD.coeffRef(i, i + 1) = imag;
|
||||||
|
matD.coeffRef(i + 1, i) = -imag;
|
||||||
|
matD.coeffRef(i + 1, i + 1) = real;
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (i == n - 1) {
|
||||||
|
matD.coeffRef(i, i) = numext::real(m_eivalues.coeff(i));
|
||||||
|
}
|
||||||
|
|
||||||
return matD;
|
return matD;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ struct TensorEvaluator<const TensorChippingOp<DimId, ArgType>, Device> {
|
|||||||
// Check if chipping is effectively inner or outer: products of dimensions
|
// Check if chipping is effectively inner or outer: products of dimensions
|
||||||
// before or after the chipped dimension is `1`.
|
// before or after the chipped dimension is `1`.
|
||||||
Index after_chipped_dim_product = 1;
|
Index after_chipped_dim_product = 1;
|
||||||
for (int i = static_cast<int>(m_dim.actualDim()) + 1; i < NumInputDims; ++i) {
|
for (int i = m_dim.actualDim() + 1; i < NumInputDims; ++i) {
|
||||||
after_chipped_dim_product *= input_dims[i];
|
after_chipped_dim_product *= input_dims[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user