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
@rasoolfa

Description

@rasoolfa

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.

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

      0