/[escript]/trunk/paso/src/SparseMatrix_getTranspose.cpp
ViewVC logotype

Diff of /trunk/paso/src/SparseMatrix_getTranspose.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 4797 by caltinay, Mon Mar 24 05:42:42 2014 UTC revision 4803 by caltinay, Wed Mar 26 06:52:28 2014 UTC
# Line 32  namespace paso { Line 32  namespace paso {
32  SparseMatrix* SparseMatrix_getTranspose(const SparseMatrix* A)  SparseMatrix* SparseMatrix_getTranspose(const SparseMatrix* A)
33  {  {
34        
35     Paso_Pattern *ATpattern=NULL;     Pattern *ATpattern=NULL;
36     SparseMatrix *AT=NULL;     SparseMatrix *AT=NULL;
37        
38     const dim_t m=A->numCols;     const dim_t m=A->numCols;
# Line 52  SparseMatrix* SparseMatrix_getTranspose( Line 52  SparseMatrix* SparseMatrix_getTranspose(
52         }         }
53     }     }
54            
55     ATpattern=Paso_Pattern_fromIndexListArray(0,index_list,0,n,0);     ATpattern=Pattern_fromIndexListArray(0,index_list,0,n,0);
56     Paso_IndexListArray_free(index_list);     Paso_IndexListArray_free(index_list);
57     AT=SparseMatrix_alloc(A->type,ATpattern,col_block_size_A,row_block_size_A,FALSE);     AT=SparseMatrix_alloc(A->type,ATpattern,col_block_size_A,row_block_size_A,FALSE);
58     Paso_Pattern_free(ATpattern);     Pattern_free(ATpattern);
59    
60     if (  ( (A->type & MATRIX_FORMAT_DIAGONAL_BLOCK) && (block_size == 1 ) ) ||     if (  ( (A->type & MATRIX_FORMAT_DIAGONAL_BLOCK) && (block_size == 1 ) ) ||
61           ( (row_block_size_A == 1 ) && (col_block_size_A == 1)            )  ) {           ( (row_block_size_A == 1 ) && (col_block_size_A == 1)            )  ) {
# Line 68  SparseMatrix* SparseMatrix_getTranspose( Line 68  SparseMatrix* SparseMatrix_getTranspose(
68             where_p=(index_t*)bsearch(&i, start_p,             where_p=(index_t*)bsearch(&i, start_p,
69                       A->pattern->ptr[j + 1]-jptr_A,                       A->pattern->ptr[j + 1]-jptr_A,
70                       sizeof(index_t),                       sizeof(index_t),
71                       Paso_comparIndex);                       comparIndex);
72          if (! (where_p == NULL) ) { /* this should always be the case */          if (! (where_p == NULL) ) { /* this should always be the case */
73              jptr_A += (index_t)(where_p-start_p);              jptr_A += (index_t)(where_p-start_p);
74              AT->val[iptr_AT]=A->val[jptr_A];              AT->val[iptr_AT]=A->val[jptr_A];
# Line 86  SparseMatrix* SparseMatrix_getTranspose( Line 86  SparseMatrix* SparseMatrix_getTranspose(
86             where_p=(index_t*)bsearch(&i, start_p,             where_p=(index_t*)bsearch(&i, start_p,
87                       A->pattern->ptr[j + 1]-jptr_A,                       A->pattern->ptr[j + 1]-jptr_A,
88                       sizeof(index_t),                       sizeof(index_t),
89                       Paso_comparIndex);                       comparIndex);
90          if (! (where_p == NULL) ) { /* this should always be the case */          if (! (where_p == NULL) ) { /* this should always be the case */
91              jptr_A += (index_t)(where_p-start_p);              jptr_A += (index_t)(where_p-start_p);
92              for (ib=0; ib < block_size; ++ib )  AT->val[iptr_AT*block_size+ib]=A->val[jptr_A*block_size+ib];              for (ib=0; ib < block_size; ++ib )  AT->val[iptr_AT*block_size+ib]=A->val[jptr_A*block_size+ib];
# Line 103  SparseMatrix* SparseMatrix_getTranspose( Line 103  SparseMatrix* SparseMatrix_getTranspose(
103             where_p=(index_t*)bsearch(&i, start_p,             where_p=(index_t*)bsearch(&i, start_p,
104                         A->pattern->ptr[j + 1]-jptr_A,                         A->pattern->ptr[j + 1]-jptr_A,
105                         sizeof(index_t),                         sizeof(index_t),
106                         Paso_comparIndex);                         comparIndex);
107             if (! (where_p == NULL) ) { /* this should always be the case */             if (! (where_p == NULL) ) { /* this should always be the case */
108            jptr_A += (index_t)(where_p-start_p);            jptr_A += (index_t)(where_p-start_p);
109            for (irb =0 ; irb < row_block_size_A; ++irb) {            for (irb =0 ; irb < row_block_size_A; ++irb) {

Legend:
Removed from v.4797  
changed lines
  Added in v.4803

  ViewVC Help
Powered by ViewVC 1.1.26