Open olekscode opened 2 years ago
There is this but it has to be improved:
PMMatrix >> mpInverse
"Moore Penrose Inverse. "
|f g|
self numberOfRows < self numberOfColumns
ifTrue:[ f := self transpose qrFactorizationWithPivoting.
g := f first.
f := f second inversePivotColumns: (f at:3) ]
ifFalse: [ f := self qrFactorizationWithPivoting.
g := (f second inversePivotColumns: (f at:3)) transpose.
f := f first transpose ].
^ g * ((f *self *g) inverse) *f
Great job! I know this might be difficult, but do we have a way to test it?
@olekscode @SergeStinckwich the tests for these (MP Inverse) fail because of QR Decomposition with pivoting. I am attempting to fix it with #288. Specifically, the Pivot has nils in it for some matrices and I focusing on why very closely.
https://en.wikipedia.org/wiki/Moore%E2%80%93Penrose_inverse
A simple (but slightly time-consuming) implementation can be based on SVD: