سؤال

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?)

هل كانت مفيدة؟

المحلول

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

This is described in this question.

To summarize (imitatio, aemulatio):

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top