Ask Your Question
2

Inverting matrix after Cholesky decomposition does not finish for "large" dimension

asked 2019-06-15 17:28:27 +0100

popoti9 gravatar image

I'm trying to invert the cholesky decomposition of a matrix. While this works for small a, for around a=~30, it no longer finishes.

From the _print_, I know that the problem is in the last line.

This seems a very odd behavior, as like matrix inversion would blow exponentially, which is not true, but even if it was it shouldn't go from taking 10s to finish to not finishing at all. Moreover, since the matrix N is triangular, shouldn't it even be faster to compute the inverse matrix?

I am very puzzled about this, sorry...

a = 30
M = random_matrix(ZZ, a, x = -a, y = a)
M = M.T * M
N = M.inverse().cholesky()
print "choleskied"
Ni = N.inverse()

Thanks for the help!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-06-20 00:15:01 +0100

popoti9 gravatar image

So, I found the problem.

In fact,

N.parent() == Full MatrixSpace of 30 by 30 dense matrices over Algebraic Real Field

since this has infinite precision, the computation takes forever.

This is solved, and the computation is almost instant (as expected), by using finite precision, i.e.

Ni = N.n().inverse()

Maybe this'll help someone.

Cheers! : )

edit flag offensive delete link more

Comments

I cannot accept my answer, unfortunately (not enough points)

popoti9 gravatar imagepopoti9 ( 2019-06-20 00:15:36 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2019-06-15 17:28:27 +0100

Seen: 367 times

Last updated: Jun 20 '19