16 Sep 22:45
Math.Matrix revisited
From: Felip Alàez Nadal <uu.nix.uu <at> gmail.com>
Subject: Math.Matrix revisited
Newsgroups: gmane.comp.lang.pike.user
Date: 2008-09-16 20:47:39 GMT
Subject: Math.Matrix revisited
Newsgroups: gmane.comp.lang.pike.user
Date: 2008-09-16 20:47:39 GMT
Hello:
I send a "patch" which adds the lu decomposition method to the Math.Matrix object. I don't know how to send patches, then I send the entire matrix_code.h file from src/modules/Math/matrix_code.h. I've verified that compiles with Pike 7.8 from the repository. At the moment, It's not usable because It shows lots of debug information, but maybe It would be good to have It at the repository. Maybe tomorrow If I've time I'll send another patch without debug information.
The lu decomposition is used to solve linear equations systems. It decomposes a matrix , named A, like P x L x U = A , where P is a permutation matrix, L is a lower-diagonal matrix and U is an upper-diagonal matrix. The method doesn't needs any argument and It returns an array with 4 elements : ({ L , U , P , signum }) , where signum is an integer which contains the sign of the permutation. Now I want to implement solving linear equations systems into the Math.Matrix object.
I've noticed something strange within the Math.Matrix object. Instead of using a 2D array, you use a vector (1D array) and then, to acces the (i,j) element you compute it as i * size_of_a_rows + j. This maybe saves some memory , but It's slower accessing the array elements. Maybe I can reimplement the class using 2D arrays if you want.
Well, I'll send any improvement that I do. Bye!
--
Felip Alàez Nadal
I send a "patch" which adds the lu decomposition method to the Math.Matrix object. I don't know how to send patches, then I send the entire matrix_code.h file from src/modules/Math/matrix_code.h. I've verified that compiles with Pike 7.8 from the repository. At the moment, It's not usable because It shows lots of debug information, but maybe It would be good to have It at the repository. Maybe tomorrow If I've time I'll send another patch without debug information.
The lu decomposition is used to solve linear equations systems. It decomposes a matrix , named A, like P x L x U = A , where P is a permutation matrix, L is a lower-diagonal matrix and U is an upper-diagonal matrix. The method doesn't needs any argument and It returns an array with 4 elements : ({ L , U , P , signum }) , where signum is an integer which contains the sign of the permutation. Now I want to implement solving linear equations systems into the Math.Matrix object.
I've noticed something strange within the Math.Matrix object. Instead of using a 2D array, you use a vector (1D array) and then, to acces the (i,j) element you compute it as i * size_of_a_rows + j. This maybe saves some memory , but It's slower accessing the array elements. Maybe I can reimplement the class using 2D arrays if you want.
Well, I'll send any improvement that I do. Bye!
--
Felip Alàez Nadal
RSS Feed