Skip to content

Check sparse matrix construction: provide shape parameters explicitly #397

@Huite

Description

@Huite

#396 is as showcase where the face_face_connectivity is not constructed properly.

This is an interaction with the sparse matrix constructor which (reasonably) infers the shape of matrices based on the maximum row or column index. Obviously when this row or column index isn't presented to the constructor (e.g. because a face has no neighbors), the constructors omits the row. This is a somewhat insidious problem as it depends on (arbitrary) order of the elements. E.g. if we have a case of three faces, then the problem will not appear if the third face has no neighbors; the constructor will see e.g. row indices [0, 2] and if the correct size of 3.
However, when the last face has no neighbor, the row indices will contain [0, 1] and obviously the third face will be omitted -- there is no reason for the constructor to construct a final, third, empty row.

The fix for #396 addresses the problem for face_face_connectivity, but it's probably best to initialize every sparse matrix with its shape explicitly. This will guard against all of such issues (even if we can assume that the row or column indices will always contain the highest index).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions