Skip to content

[BUG]: If indicies of scipy.csc_matrix are not sorted conversion to Eigen::SparseMatrix Fails in debug mode. #5819

Description

@IwM341

Required prerequisites

What version (or hash if on master) of pybind11 are you using?

2.13.6

Problem description

scipy sparse matrix could have unsorted indicies. Conversion to Eigen type leads assertion:
eigen_assert( (m_outerIndex[outer+1]-m_outerIndex[outer]==0 || m_data.index(m_data.size()-1)<inner) && "Invalid ordered insertion (invalid inner index)");
However, if you call sort_indicies() before cast conversion would be correct.

Reproducible example code


Is this a regression? Put the last known working version here if it is.

Not a regression

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    triageNew bug, unverified

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions