/[escript]/trunk/paso/src/SparseMatrix_nullifyRowsAndCols.c
ViewVC logotype

Diff of /trunk/paso/src/SparseMatrix_nullifyRowsAndCols.c

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

temp_trunk_copy/paso/src/SparseMatrix_nullifyRowsAndCols.c revision 1384 by phornby, Fri Jan 11 02:29:38 2008 UTC trunk/paso/src/SparseMatrix_nullifyRowsAndCols.c revision 2548 by jfenwick, Mon Jul 20 06:20:06 2009 UTC
# Line 1  Line 1 
1    
 /* $Id: SparseMatrix_nullifyRowsAndCols.c 1306 2007-09-18 05:51:09Z ksteube $ */  
   
2  /*******************************************************  /*******************************************************
3   *  *
4   *           Copyright 2003-2007 by ACceSS MNRF  * Copyright (c) 2003-2009 by University of Queensland
5   *       Copyright 2007 by University of Queensland  * Earth Systems Science Computational Center (ESSCC)
6   *  * http://www.uq.edu.au/esscc
7   *                http://esscc.uq.edu.au  *
8   *        Primary Business: Queensland, Australia  * Primary Business: Queensland, Australia
9   *  Licensed under the Open Software License version 3.0  * Licensed under the Open Software License version 3.0
10   *     http://www.opensource.org/licenses/osl-3.0.php  * http://www.opensource.org/licenses/osl-3.0.php
11   *  *
12   *******************************************************/  *******************************************************/
13    
14    
15  /**************************************************************/  /**************************************************************/
16    
# Line 27  Line 26 
26    
27  /**************************************************************/  /**************************************************************/
28    
 /* Copyrights by ACcESS Australia 2003, 2007 */  
29  /* Author: gross@access.edu.au */  /* Author: gross@access.edu.au */
30    
31  /**************************************************************/  /**************************************************************/
# Line 40  void Paso_SparseMatrix_nullifyRowsAndCol Line 38  void Paso_SparseMatrix_nullifyRowsAndCol
38    index_t irow, iptr, icol;    index_t irow, iptr, icol;
39    #pragma omp parallel for private(irow, iptr,icol) schedule(static)    #pragma omp parallel for private(irow, iptr,icol) schedule(static)
40    for (icol=0;icol< A->pattern->numOutput;icol++) {    for (icol=0;icol< A->pattern->numOutput;icol++) {
41         #pragma ivdep
42       for (iptr=A->pattern->ptr[icol]-index_offset;iptr<A->pattern->ptr[icol+1]-index_offset; iptr++) {       for (iptr=A->pattern->ptr[icol]-index_offset;iptr<A->pattern->ptr[icol+1]-index_offset; iptr++) {
43        irow=A->pattern->index[iptr]-index_offset;        irow=A->pattern->index[iptr]-index_offset;
44        if (mask_col[icol]>0. || mask_row[irow]>0. ) {        if (mask_col[icol]>0. || mask_row[irow]>0. ) {
# Line 58  void Paso_SparseMatrix_nullifyRowsAndCol Line 57  void Paso_SparseMatrix_nullifyRowsAndCol
57    #pragma omp parallel for private(irow, iptr,icol) schedule(static)    #pragma omp parallel for private(irow, iptr,icol) schedule(static)
58    for (irow=0;irow< A->pattern->numOutput;irow++) {    for (irow=0;irow< A->pattern->numOutput;irow++) {
59        /* TODO: test mask_row here amd not inside every loop */        /* TODO: test mask_row here amd not inside every loop */
60          #pragma ivdep
61        for (iptr=A->pattern->ptr[irow]-index_offset;iptr<A->pattern->ptr[irow+1]-index_offset; iptr++) {        for (iptr=A->pattern->ptr[irow]-index_offset;iptr<A->pattern->ptr[irow+1]-index_offset; iptr++) {
62          icol=A->pattern->index[iptr]-index_offset;          icol=A->pattern->index[iptr]-index_offset;
63          if (mask_col[icol]>0. || mask_row[irow]>0. ) {          if (mask_col[icol]>0. || mask_row[irow]>0. ) {
# Line 72  void Paso_SparseMatrix_nullifyRowsAndCol Line 72  void Paso_SparseMatrix_nullifyRowsAndCol
72  }  }
73  void Paso_SparseMatrix_nullifyRowsAndCols_CSC(Paso_SparseMatrix* A, double* mask_row, double* mask_col, double main_diagonal_value) {  void Paso_SparseMatrix_nullifyRowsAndCols_CSC(Paso_SparseMatrix* A, double* mask_row, double* mask_col, double main_diagonal_value) {
74    index_t index_offset=(A->type & MATRIX_FORMAT_OFFSET1 ? 1:0);    index_t index_offset=(A->type & MATRIX_FORMAT_OFFSET1 ? 1:0);
75    index_t ir,icol,iptr,icb,irb,irow,ic,l;    index_t icol,iptr,icb,irb,irow,ic,l;
76    #pragma omp parallel for private(l,irow, iptr,icol,ic,irb,icb) schedule(static)    #pragma omp parallel for private(l,irow, iptr,icol,ic,irb,icb) schedule(static)
77    for (ic=0;ic< A->pattern->numOutput;ic++) {    for (ic=0;ic< A->pattern->numOutput;ic++) {
78      for (iptr=A->pattern->ptr[ic]-index_offset;iptr<A->pattern->ptr[ic+1]-index_offset; iptr++) {      for (iptr=A->pattern->ptr[ic]-index_offset;iptr<A->pattern->ptr[ic+1]-index_offset; iptr++) {
79        for (irb=0;irb< A->row_block_size;irb++) {        for (irb=0;irb< A->row_block_size;irb++) {
80          irow=irb+A->row_block_size*(A->pattern->index[iptr]-index_offset);          irow=irb+A->row_block_size*(A->pattern->index[iptr]-index_offset);
81                #pragma ivdep
82          for (icb=0;icb< A->col_block_size;icb++) {          for (icb=0;icb< A->col_block_size;icb++) {
83            icol=icb+A->col_block_size*ic;            icol=icb+A->col_block_size*ic;
84            if (mask_col[icol]>0. || mask_row[irow]>0. ) {            if (mask_col[icol]>0. || mask_row[irow]>0. ) {
# Line 95  void Paso_SparseMatrix_nullifyRowsAndCol Line 96  void Paso_SparseMatrix_nullifyRowsAndCol
96  }  }
97  void Paso_SparseMatrix_nullifyRowsAndCols_CSR(Paso_SparseMatrix* A, double* mask_row, double* mask_col, double main_diagonal_value) {  void Paso_SparseMatrix_nullifyRowsAndCols_CSR(Paso_SparseMatrix* A, double* mask_row, double* mask_col, double main_diagonal_value) {
98    index_t index_offset=(A->type & MATRIX_FORMAT_OFFSET1 ? 1:0);    index_t index_offset=(A->type & MATRIX_FORMAT_OFFSET1 ? 1:0);
99    index_t ir,icol,iptr,icb,irb,irow,ic,l;    index_t ir,icol,iptr,icb,irb,irow,l;
100    #pragma omp parallel for private(l,irow, iptr,icol,ir,irb,icb) schedule(static)    #pragma omp parallel for private(l,irow, iptr,icol,ir,irb,icb) schedule(static)
101    for (ir=0;ir< A->pattern->numOutput;ir++) {    for (ir=0;ir< A->pattern->numOutput;ir++) {
102      for (iptr=A->pattern->ptr[ir]-index_offset;iptr<A->pattern->ptr[ir+1]-index_offset; iptr++) {      for (iptr=A->pattern->ptr[ir]-index_offset;iptr<A->pattern->ptr[ir+1]-index_offset; iptr++) {
103        for (irb=0;irb< A->row_block_size;irb++) {        for (irb=0;irb< A->row_block_size;irb++) {
104          irow=irb+A->row_block_size*ir;          irow=irb+A->row_block_size*ir;
105                #pragma ivdep
106          for (icb=0;icb< A->col_block_size;icb++) {          for (icb=0;icb< A->col_block_size;icb++) {
107            icol=icb+A->col_block_size*(A->pattern->index[iptr]-index_offset);            icol=icb+A->col_block_size*(A->pattern->index[iptr]-index_offset);
108            if (mask_col[icol]>0. || mask_row[irow]>0. ) {            if (mask_col[icol]>0. || mask_row[irow]>0. ) {
# Line 122  void Paso_SparseMatrix_nullifyRows_CSR_B Line 124  void Paso_SparseMatrix_nullifyRows_CSR_B
124    #pragma omp parallel for private(irow, iptr,icol) schedule(static)    #pragma omp parallel for private(irow, iptr,icol) schedule(static)
125    for (irow=0;irow< A->pattern->numOutput;irow++) {    for (irow=0;irow< A->pattern->numOutput;irow++) {
126        if (mask_row[irow]>0.) {        if (mask_row[irow]>0.) {
127             #pragma ivdep
128           for (iptr=A->pattern->ptr[irow]-index_offset;iptr<A->pattern->ptr[irow+1]-index_offset; iptr++) {           for (iptr=A->pattern->ptr[irow]-index_offset;iptr<A->pattern->ptr[irow+1]-index_offset; iptr++) {
129             icol=A->pattern->index[iptr]-index_offset;             icol=A->pattern->index[iptr]-index_offset;
130             if (irow==icol) {             if (irow==icol) {
# Line 135  void Paso_SparseMatrix_nullifyRows_CSR_B Line 138  void Paso_SparseMatrix_nullifyRows_CSR_B
138  }  }
139  void Paso_SparseMatrix_nullifyRows_CSR(Paso_SparseMatrix* A, double* mask_row, double main_diagonal_value) {  void Paso_SparseMatrix_nullifyRows_CSR(Paso_SparseMatrix* A, double* mask_row, double main_diagonal_value) {
140    index_t index_offset=(A->type & MATRIX_FORMAT_OFFSET1 ? 1:0);    index_t index_offset=(A->type & MATRIX_FORMAT_OFFSET1 ? 1:0);
141    index_t ir,icol,iptr,icb,irb,irow,ic,l;    index_t ir,icol,iptr,icb,irb,irow,l;
142    #pragma omp parallel for private(l,irow, iptr,icol,ir,irb,icb) schedule(static)    #pragma omp parallel for private(l,irow, iptr,icol,ir,irb,icb) schedule(static)
143    for (ir=0;ir< A->pattern->numOutput;ir++) {    for (ir=0;ir< A->pattern->numOutput;ir++) {
144      for (iptr=A->pattern->ptr[ir]-index_offset;iptr<A->pattern->ptr[ir+1]-index_offset; iptr++) {      for (iptr=A->pattern->ptr[ir]-index_offset;iptr<A->pattern->ptr[ir+1]-index_offset; iptr++) {
145        for (irb=0;irb< A->row_block_size;irb++) {        for (irb=0;irb< A->row_block_size;irb++) {
146          irow=irb+A->row_block_size*ir;          irow=irb+A->row_block_size*ir;
147          if (mask_row[irow]>0. ) {          if (mask_row[irow]>0. ) {
148                   #pragma ivdep
149             for (icb=0;icb< A->col_block_size;icb++) {             for (icb=0;icb< A->col_block_size;icb++) {
150                 icol=icb+A->col_block_size*(A->pattern->index[iptr]-index_offset);                 icol=icb+A->col_block_size*(A->pattern->index[iptr]-index_offset);
151                     l=iptr*A->block_size+irb+A->row_block_size*icb;                     l=iptr*A->block_size+irb+A->row_block_size*icb;

Legend:
Removed from v.1384  
changed lines
  Added in v.2548

  ViewVC Help
Powered by ViewVC 1.1.26