8000 Singular matrix inverse does't throw an error · Issue #6178 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

Singular matrix inverse does't throw an error #6178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rasoolfa opened this issue Aug 7, 2015 · 1 comment
Closed

Singular matrix inverse does't throw an error #6178

rasoolfa opened this issue Aug 7, 2015 · 1 comment

Comments

@rasoolfa
Copy link
rasoolfa commented Aug 7, 2015

Hi,
Here is an example of inv that doesn't throw an error when dealing with singular matrix and return wrong results.

import numpy as np
import scipy as si
A=np.array([[1,2,3],[4,5,6],[7,8,9]])
b=np.array([15,15,15])
print np.dot(np.linalg.inv(A),b)
array([-32., 48., -24.] ## wrong result
np.linalg.solve(A,b) # the result of np.dot(np.linalg.inv(A),b) should be same as this.
array([-39., 63., -24.]) # correct result

It is necessary to say that scipy throws an error though.
np.dot(si.linalg.inv(A),b)

My numpy version is '1.9.2' and python 2.7.6.

@rasoolfa rasoolfa changed the title Singular matrix inverse does't throw error Singular matrix inverse does't throw an error Aug 7, 2015
@mattip
Copy link
Member
mattip commented Jan 21, 2019

A=np.array([[1,2,3],[4,5,6],[7,8,9]]); np.linalg.inv(A) now raises. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
0