I was playing with my diode test circuit again and found that one of the
underlying issues is the simple row permutation algorithm I used in the
LU decomposition class. The matrix is so sparse that it really is a
problem. =( There probably is a textbook solution but I"m too lazy to go
into my library in the other room right now. =P

Here's the permutation algorithm from matrix.cpp:

                // do row permutations;
                if(k >= max_k) {
                        double max = std::abs(m_mat->at(k,k));
                        unsigned int row = k;
                        for(unsigned int j = k + 1; j < n; j++) {
                                double val = std::abs(m_mat->at(j,k));
                                if(val > max) {
                                        max = val;
                                        row = j;
                                }
                        }

                        if(row != k) swapRows(k,row);
                }


It doesn't work because one of the diagonal entries ended up being zero.
=( (see cell 9H on the spreadsheet).

The code would work if it were smart enough to know that it should have
swapped row 3 and row 8... (see attached).

If we can fix this, we can remove the expensive assertion checks from
the code which will make it really fly!!!

-- 
New president: Here we go again...
Chemistry.com: A total rip-off.
Powers are not rights.

Attachment: badPermute.ods
Description: application/vnd.oasis.opendocument.spreadsheet

------------------------------------------------------------------------------
_______________________________________________
Ktechlab-devel mailing list
Ktechlab-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ktechlab-devel

Reply via email to