1
$\begingroup$

I have a matrix

P = randn(45875x65536 );
Pi = pinv (P);

I tried to run this code in matlab, but it takes long time

is it possible to split the matrix into smaller matrices then calculate the pseudo inverse?

any suggestion to reduce the time ?

$\endgroup$
  • 1
    $\begingroup$ your first line of code isn't valid Matlab... $\endgroup$ – Marcus Müller Nov 6 '18 at 9:58
  • 1
    $\begingroup$ also, chances are that if you're trying to find an inverse to a $45875\times 65536$ matrix within a signal processing context, you might be doing something over the top. In which context are you planning to use Pi? $\endgroup$ – Marcus Müller Nov 6 '18 at 10:00
  • 1
    $\begingroup$ By the way, that matrix is more 24 GB worth of numbers; I'm actually happy for you that your computer is able to construct that 3 billion-numbers matrix at all. I'm now almost certain you're trying to do something absurd. $\endgroup$ – Marcus Müller Nov 6 '18 at 10:02
1
$\begingroup$

Long story very short: No.

If that was possible, Matlab would likely be doing it already; in any case, the Matlab docs for pinv say that the singular value decomposition method is used; that might not be the fastest method, but it's relatively stable for many cases of P, so it's pretty much desirable unless you know exceptionally well what you're doing or your P has special structure (in which case you'd probably not want to use the Moore-Penrose Pseudoinverse in the first place, maybe?).

Longer story: typically, you multiply your Pi onto something to get the inverse operation to P executed.

To cite Matlab documentation itself:

You can replace most uses of pinv applied to a vector b, as in pinv(A)*b, with lsqminnorm(A,b) to get the minimum-norm least-squares solution of a system of linear equations. lsqminnorm is generally more efficient than pinv, and it also supports sparse matrices.

But whether you can do that depends on the actual reason you're using the Moore-Penrose Pseudoinverse; not all uses are just replaceable with something else.

$\endgroup$
  • $\begingroup$ slight objection to Matlab would be doing it already... Depending on the version (that I'm using a very old one 6.0) sometimes (very occasionally) it doesn't. Just an example: Prony fuction is quite slow compared to hand calculation (especially for large signals). don't know the reason, havent looked at its m file. $\endgroup$ – Fat32 Nov 6 '18 at 9:37
  • $\begingroup$ @Fat32 fair point; I'll weaken my claim, there. $\endgroup$ – Marcus Müller Nov 6 '18 at 9:41
1
$\begingroup$

You could try using a QR decomposition.

https://en.wikipedia.org/wiki/QR_decomposition#Using_for_solution_to_linear_inverse_problems

matlab has a qrupdate routine that works with sparse matrices as well.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.