Skip to content

SPQR: Fix build error, Index/StorageIndex mismatch.

What does this implement/fix?

This fixes a build error (Apple clang version 15.0.0 (clang-1500.1.0.2.5)) in SPQR::compute() with _MatrixType=SparseMatrix<double>.

Before this change, the call to SuiteSparseQR() passed a mix of StorageIndex and Index to function parameters of the same templated type (Int), which can apparently fail even if long and long long have the same underlying type.

Additional information

Note: This works in my project, but I'm having trouble building/running the Eigen SPQR tests locally, hope they're enabled in CI 😄

Abbreviated compiler diagnostic for reference:

In file included from /.../Eigen/SPQRSupport:36:
/.../Eigen/src/SPQRSupport/SuiteSparseQRSupport.h:146:14: error: no matching function for call to 'SuiteSparseQR'
    m_rank = SuiteSparseQR<Scalar>(m_ordering, pivotThreshold, col, &A, &m_cR, &m_E, &m_H, &m_HPinv, &m_HTau, &m_cc);
             ^~~~~~~~~~~~~~~~~~~~~
/.../CoMISo/NSolver/NewtonSolver.cc:879:20: note: in instantiation of member function 'Eigen::SPQR<Eigen::SparseMatrix<double>>::compute' requested here
      spqr_solver_.compute(_KKT);
                   ^
/opt/homebrew/include/SuiteSparseQR.hpp:501:55: note: candidate template ignored: deduced conflicting types for parameter 'Int' ('Index' (aka 'long') vs. 'StorageIndex' (aka 'long long'))
template <typename Entry, typename Int = int64_t> Int SuiteSparseQR
                                                      ^
/opt/homebrew/include/SuiteSparseQR.hpp:485:55: note: candidate function template not viable: requires 9 arguments, but 10 were provided
template <typename Entry, typename Int = int64_t> Int SuiteSparseQR

[...]
Edited by Martin Heistermann

Merge request reports

Loading