mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-05-02 08:44:12 +08:00
Added implicit integer conversion by using explicit integer type conversion. Adding assert to catch overflow.
This commit is contained in:
parent
f0a62c90bc
commit
9a04cd307c
@ -675,8 +675,11 @@ struct SparseLUMatrixUReturnType : internal::no_assignment_operator
|
|||||||
|
|
||||||
template<typename Dest> void solveInPlace(MatrixBase<Dest> &X) const
|
template<typename Dest> void solveInPlace(MatrixBase<Dest> &X) const
|
||||||
{
|
{
|
||||||
Index nrhs = X.cols();
|
/* Explicit type conversion as the Index type of MatrixBase<Dest> may be wider than Index */
|
||||||
Index n = X.rows();
|
eigen_assert(X.rows() <= NumTraits<Index>::highest());
|
||||||
|
eigen_assert(X.cols() <= NumTraits<Index>::highest());
|
||||||
|
Index nrhs = Index(X.cols());
|
||||||
|
Index n = Index(X.rows());
|
||||||
// Backward solve with U
|
// Backward solve with U
|
||||||
for (Index k = m_mapL.nsuper(); k >= 0; k--)
|
for (Index k = m_mapL.nsuper(); k >= 0; k--)
|
||||||
{
|
{
|
||||||
|
@ -233,8 +233,11 @@ template<typename Scalar, typename Index>
|
|||||||
template<typename Dest>
|
template<typename Dest>
|
||||||
void MappedSuperNodalMatrix<Scalar,Index>::solveInPlace( MatrixBase<Dest>&X) const
|
void MappedSuperNodalMatrix<Scalar,Index>::solveInPlace( MatrixBase<Dest>&X) const
|
||||||
{
|
{
|
||||||
Index n = X.rows();
|
/* Explicit type conversion as the Index type of MatrixBase<Dest> may be wider than Index */
|
||||||
Index nrhs = X.cols();
|
eigen_assert(X.rows() <= NumTraits<Index>::highest());
|
||||||
|
eigen_assert(X.cols() <= NumTraits<Index>::highest());
|
||||||
|
Index n = Index(X.rows());
|
||||||
|
Index nrhs = Index(X.cols());
|
||||||
const Scalar * Lval = valuePtr(); // Nonzero values
|
const Scalar * Lval = valuePtr(); // Nonzero values
|
||||||
Matrix<Scalar,Dynamic,Dynamic> work(n, nrhs); // working vector
|
Matrix<Scalar,Dynamic,Dynamic> work(n, nrhs); // working vector
|
||||||
work.setZero();
|
work.setZero();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user