Matlab refers to a large matrix

This is the equation I'm trying to solve:

h = (X '* X) ^ - 1 * X' * y

where X is the matrix, and y is the vector ((X'X) ^ - 1 is the inverse of X-transposed times X). I encoded this in Matlab as:

h = (X'*X)\X'*y 

which I think is right. The problem is that X is around 10000x10000, and is trying to calculate that Matlab crashes back to even the most powerful computer I can find (16 cores, 24 GB of RAM). Is there a way to break this or a library designed for such large inversions?

Thanks.

+4
source share
4 answers

I generated a random matrix X of 10,000 by 10,000 and a random vector by 10,000 by 1.

I just broke my calculations step by step. (Code shown below)

  • Calculated the transposition and held it in the matrix K
  • Then I calculated the matrix A by multiplying K by X
  • Computed vector b by multiplying K by vector y
  • Finally, I used the backslash operator on A and b to solve

I had no problems calculating. This took some time, but breaking down the operations into the smallest groups helped prevent computer overload. However, this may be the composition of the matrix used (i.e., Sparse, decimal, etc.).

 X = randi(2000, [10000, 10000]); y = randi(2000, 10000, 1); K = X'; A = K*X; b = K*y; S = A\b; 
0
source

It looks like a pseudo-converse. Perhaps you are just looking

 h = X \ y; 
+1
source

If you have several machines at your disposal and you can remake your problem in the form h = X\y , as suggested by @Ben, then you can use distributed arrays. This demo shows how you can do this.

0
source

Jordan, your equation is the exact definition of the β€œMoore-Penrose Matrix Matrix".

Check out: http://mathworld.wolfram.com/Moore-PenroseMatrixInverse.html

Directly using h = X \ y; should help. Or check matlab pinv(X)*y

0
source

Source: https://habr.com/ru/post/1468855/


All Articles