Skip to content

Sparse matrix inverses in SR give wrong results on Sage 9.8 #35653

@pvir

Description

@pvir

Is there an existing issue for this?

  • I have searched the existing issues for a bug report that matches the one I want to file, without success.

Did you read the documentation and troubleshoot guide?

  • I have read the documentation and troubleshoot guide

Environment

- **OS**: Redhat / Mambaforge / conda-forge (`mamba install sage=9.8`)
- **Sage Version**: 9.8

Steps To Reproduce

sage: var('x')
x
sage: diagonal_matrix([x]).inverse()
[1]

which is not quite right. Inverses seem to be also more generally broken for sparse matrices:

sage: M = MatrixSpace(SR,2,2,sparse=True)
sage: M([[x,0],[0,x]]).inverse()
[1 0]
[0 1]
sage: M([[x,1],[0,x]]).inverse()
---------------------------------------------------------------------------
ZeroDivisionError                         Traceback (most recent call last)

Running sage -t . in src/sage/matrix also generates several errors, sage-matrix-test.log

I can also reproduce this on https://cocalc.com so it's probably not specific to this installation.

Expected Behavior

Correct results.

Actual Behavior

Matrix inverses give wrong results.

Additional Information

Sage 9.7 gives correct results, so this looks like a regression.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions