|
[Sponsors] |
Symmetric and asymmetric matrices have always the same size |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 9, 2018, 13:50 |
Symmetric and asymmetric matrices have always the same size
|
#1 |
Senior Member
Klaus
Join Date: Mar 2009
Posts: 265
Rep Power: 22 |
I am trying to analyze the matrix structure but my routine gives me the same size for both the symmetric p matrix and the asymmetric U matrix as if the latter was symmetric and of the same size as the p matrix.
The diagonal part is currently omitted. Code:
// allocate memory for row_NNZ[N+1], the number of nonzero values for each matrix row int * row_NNZ = (int *)calloc(N+1, sizeof(int)); // initialize row_NNZ with 0s for (int i=0; i<N+1; i++) row_NNZ[i] = 0; // count the nonzero values per row for lower and upper part Foam::UList<int>::const_iterator it_lower = matrix_.lduAddr().lowerAddr().begin(); Foam::UList<int>::const_iterator it_upper = matrix_.lduAddr().upperAddr().begin(); // compute NNZ per row for upper + lower part, excluding diagonal for a symmetric matrix for (int i=0; i<matrix_.upper().size(); i++) { row_NNZ[*it_lower + 1]++; row_NNZ[*it_upper + 1]++; it_lower++; it_upper++; } // check sum size of upper + lower part int i, sum=0; for (i=0; i<N+1; i++) { sum = sum + row_NNZ[i]; } How can I adjust it for the asymmetric matrices? Klaus |
|
May 13, 2018, 14:02 |
|
#2 |
Senior Member
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,905
Rep Power: 33 |
The asymmetric matrix is still symmetric IN ADDRESSING. The difference is that the symmetric matrix says that a_ij = a_ji and it only stores one.
Make sure you count both the upper and lower triangle. This is not the CR format. Good luck, Hrv
__________________
Hrvoje Jasak Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Asymmetric solution for bluff bodies symmetric tandem | bud_el_lodituma | Main CFD Forum | 7 | March 18, 2014 15:07 |
change symmetric lduMatrix into asymmetric | marek88 | OpenFOAM Programming & Development | 2 | August 24, 2011 09:02 |
Merits and Demerits of symmetric and asymmetric re | Mukkarum Husain | Main CFD Forum | 0 | January 7, 2009 08:46 |
asymmetric solution generated by symmetric problem | Twiti | CFX | 7 | October 16, 2004 19:12 |
Symmetric problem - Asymmetric prediction | Mark | Main CFD Forum | 14 | January 29, 2001 13:21 |