Question

In Matlab, using the inv() function is often discouraged due to numerical instability (see description section in http://www.mathworks.com/help/matlab/ref/inv.html). It is suggested to replace an expression like:

inv(A)*B 

(where both A and B are matrices), with:

A\B

This becomes critical when the inverted matrix A is close to singular.

Is there a nice way to write this in numpy / scipy? (would solve() work?)

Was it helpful?

Solution

As mentioned in the comments, you need to use the left inverse.

This is described in this question.

To summarize (imitatio, aemulatio):

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top