Filling sparse matrix by A(i, i)=... .Fast for small matrices, slow for large.Is there a better way to fill the matrix?
Tony <[email protected]> Sun, 24 Apr 2005 23:22:53 +1000
| Newsgroups | gmane.comp.lib.mtl.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi
I have a sparse matrix
#define N 10000
typedef matrix< Type,
rectangle<>,
compressed<>,
row_major >::type Matrix;
Matrix A(N,N);
and I am filling it up something like
for(i=0; i < N ; i++){
A(i,i) = ....
lots of other stuff in here setting up other elements of A
}
In my case I have quite a complex set of if statements in the loop
setting up the A matrix and I have a maximum of 12 non zero entries on
each row.
The code works fine for small matrix sizes, say N less than 50,000.
But when I set N larger than this the code runs very slowly. In my
case I would like to run the code with N=1500000. But I need to leave
the computer on for several days for A to be constructed.
Question:
Can I fill the elements of A in a faster way? I am wondering if if
would be faster adding a whole row at a time to A, but I don't know
how to do this, if this is a possibility can someone please show me
how to do this and/or any other ways I can speed up filling up the
elements of A
Thank you for your time
Tony
_______________________________________________
This list is archived at http://www.osl.iu.edu/MailArchives/mtl-devel/