0

Is there a way to implement a QR decomposition like in Matlab? In particular, I am interested in the following command:

[C,R,P] = qr(S,B)

According to the description it "returns a permutation matrix P that is chosen to reduce fill-in in R. You can use C, R, and P to compute a least-squares solution to the sparse linear system SX = B with X = P(R\C)".

I need to run the Python equivalent of the MATLAB code [Q, R, E] = qr(X,0);

NC520
  • 346
  • 3
  • 13

1 Answers1

0

scipy.linalg.qr provides the functionality you're looking for when given the argument pivoting=True.

Seon
  • 3,332
  • 8
  • 27
  • I don't understand where to specify B. I need to run the Python equivalent of the MATLAB code [Q, R, E] = qr(X,0); – NC520 Nov 11 '22 at 11:08