/ home / blog
brain activity log

25.03.2006 Saturday - matrixes

Yesterday and today my fundamental problem was inverting a matrix and computing its determinant. I have written a nice template matrix class (I'll publish it on this site sooner or later).

Computing the inverse of a matrix is pretty straightforward. It can be done by Gauss elimination and has computational cost comparable to n^3 where n is the rank. Writing the Gauss elimination algo took a couple of hours yesterday night but afterwards I was able to invert a 1000x1000 matrix in matters of seconds (Athlon64 3500).

A huger problem is the one of computing the determinant. The Liebnitz formula is too complex to implement since it involves enumerating all the permutations of the matrix columns. Enumerations of n elements are n! and such complexity is obviously out of range.

Using the recursive determinant formula is also a heavy approach since it requires a lot of time and a really huge amounts of memory. You have to compute ALL the minors of the matrix... which is too much.

I've written down a hybrid method that uses a sort of Liebnitz approach with the first row and a recursive method for the minors. It's still too much. Computing a 20x20 determinant is not feasible in terms of time (it requires several hours) and it also eats a lot of memory since you need to hold 20x20 + 19x19 + 18x18 + 17x17 + ... + 1x1 matrixes in memory at once.

I've readed of the LU decomposition approach which should be comparable to the inversion in terms of complexity and memory usage. The idea is to decompose our matrix in a product of two matrices: L and U. L should be lower triangular and U upper triangular. Once such a decomposition is known the determinant of the matrix is det(L) * del(U) which are both products of the elements on the diagonal. There is an approach in that L has all 1 elements on the diagonal so det(L) is even 1 (no need to compute it at all).

The problem, now, is to find the LU decomposition. I still have to study better the algorithm. This will be a task for tomorrow tough. Tonight I'll also ask Valeria about it. She's a matematician so she probably will be able to give me some hints.



want more ?

... really ? :D

Browse around then.

You're viewing one post per page: you can view more, if you want.

The entries marked in red are the ones you're viewing now.

2007.09.18-06.07
2007.09.09-04.27
2007.08.26-02.23
2007.08.21-02.02
2007.08.12-20.15
2007.07.22-11.30
2007.07.21-10.00
2007.07.11-17.20
2007.06.10-02.57
2007.06.02-03.33
2007.05.30-20.07
2007.05.21-11.35
2007.04.14-21.53
2007.03.26-02.22
2007.03.23-10.12
2007.03.20-18.10
2007.03.16-01.10
2007.03.12-21.43
2007.03.12-03.57
2007.03.05-13.08
2007.02.25-22.21
2007.02.14-23.30
2007.01.02-02.55
2006.12.17-17.01
2006.11.26-20.26
2006.11.22-03.14
2006.11.21-01.30
2006.11.04-05.09
2006.09.16-04.18
2006.08.18-03.45
2006.08.14-17.58
2006.08.14-03.08
2006.08.02-20.38
2006.07.25-04.10
2006.07.25-03.14
2006.06.23-18.12
2006.06.02-13.25
2006.05.18-16.27
2006.05.18-14.30
2006.05.17-19.30
2006.04.29-19.30
2006.04.26-01.48
2006.04.22-13.06
2006.04.16-12.26
2006.04.11-03.10
2006.04.10-04.32
2006.04.08-14.59
2006.04.07-14.54
2006.04.06-09.00
2006.04.05-23.10
2006.04.05-11.00
2006.04.04
2006.04.03
2006.04.02
2006.04.01
2006.03.31
2006.03.27
2006.03.26
2006.03.25
2006.03.24
2006.03.23
2006.03.22
2006.03.20
2006.03.19
2006.03.17
2006.03.14
2006.03.07
2006.03.05
2006.02.23
2006.02.19
2006.02.13
2006.01.10
2005.12.29
2005.09.24
2005.09.21
2005.08.21
2005.08.18
2005.07.31
2005.07.04
2005.06.13
2005.04.10
2005.04.05
2004.12.18
2004.12.17
2004.12.16
2004.12.15
2004.12.14
2004.12.13
2004.12.12
2004.12.11
2004.12.10
2004.12.09
2001.06.02