id summary reporter owner description type status priority milestone component resolution keywords cc merged author reviewer upstream work_issues branch commit dependencies stopgaps
29226 Meta-ticket: issues with division of matrices, solve_left, solve_right gh-mwageringel "This ticket collects several issues related to the division operation of matrices.
• #29257 `__truediv__` does not work for matrices of different dimensions:
{{{
sage: set_random_seed(1)
sage: B, A = matrix.random(QQ, 2, 4), matrix.random(QQ, 4, 4)
sage: B * ~A; # works
sage: B / A # fails
...
TypeError: unsupported operand parent(s) for /: 'Full MatrixSpace of 2 by 4 dense matrices over Rational Field' an
d 'Full MatrixSpace of 4 by 4 dense matrices over Rational Field'
}}}
The corresponding `_backslash_` operation usually works.
• #29257 For two square matrices, the default `__truediv__` implementation `left * ~right` computes the inverse of a matrix. This is unsuitable for numerical computations at least. A better implementation would invoke `solve_left` for matrices and vectors (`_backslash_` already calls `solve_right`).
• #12406 `solve_left` and `solve_right` should use coercion to find compatible parents
• #12406 `solve_right` and `solve_left` over `RDF`/`CDF` only work for square matrices, even though generic matrices support non-square matrices:
{{{
sage: set_random_seed(0)
sage: A, B = matrix.random(QQ, 4, 3), matrix.random(QQ, 4, 2)
sage: A.solve_right(B); # works
sage: A.change_ring(RDF).solve_right(B.change_ring(RDF)) # fails
...
NotImplementedError: coefficient matrix of a system over RDF/CDF must be square, not 4 x 3
}}}
This could be solved by using `scipy.linalg.lstsq` to find a least-squares solution.
• #17405 `solve_right` and `solve_left` over `RDF`/`CDF` fail with matrix right hand side
• #13932 `solve_right` and `solve_left` fail with floating point matrices (due to exact checking of the solution)
• #28586 `solve_right` and `solve_left` fail for `matrix_modn_sparse`
• #29729 improve checking the result of `solve_right` for some inexact rings" task new major sage-9.6 linear algebra mjo N/A