diff options
author | Edoardo Pasca <edo.paskino@gmail.com> | 2019-08-08 22:48:18 +0100 |
---|---|---|
committer | Edoardo Pasca <edo.paskino@gmail.com> | 2019-08-08 22:48:18 +0100 |
commit | 1e16641b20e7d2a6ccdadfde6bf700e42ba03f29 (patch) | |
tree | a088b763c0fabc5d680201cf5f901f17dd5af9c9 | |
parent | 432189f9d90324f7adf8f58d5905632866a3a2cf (diff) | |
download | regularization-1e16641b20e7d2a6ccdadfde6bf700e42ba03f29.tar.gz regularization-1e16641b20e7d2a6ccdadfde6bf700e42ba03f29.tar.bz2 regularization-1e16641b20e7d2a6ccdadfde6bf700e42ba03f29.tar.xz regularization-1e16641b20e7d2a6ccdadfde6bf700e42ba03f29.zip |
deal with boundary outside loop (2D)
-rw-r--r-- | src/Core/regularisers_CPU/FGP_TV_core.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/src/Core/regularisers_CPU/FGP_TV_core.c b/src/Core/regularisers_CPU/FGP_TV_core.c index 69c92bc..eddefd6 100644 --- a/src/Core/regularisers_CPU/FGP_TV_core.c +++ b/src/Core/regularisers_CPU/FGP_TV_core.c @@ -191,15 +191,30 @@ float Grad_func2D(float *P1, float *P2, float *D, float *R1, float *R2, float la long i,j,index; multip = (1.0f/(8.0f*lambda)); #pragma omp parallel for shared(P1,P2,D,R1,R2,multip) private(index,i,j,val1,val2) - for(j=0; j<dimY; j++) { - for(i=0; i<dimX; i++) { - index = j*dimX+i; + for(j=0; j<dimY-1; j++) { + for(i=0; i<dimX-1; i++) { + index = j*dimX+i; /* boundary conditions */ - if (i == dimX-1) val1 = 0.0f; else val1 = D[index] - D[j*dimX + (i+1)]; - if (j == dimY-1) val2 = 0.0f; else val2 = D[index] - D[(j+1)*dimX + i]; + if (i == dimX-1) val1 = 0.0f; else val1 = D[index] - D[index+1]; + if (j == dimY-1) val2 = 0.0f; else val2 = D[index] - D[index + dimX]; P1[index] = R1[index] + multip*val1; P2[index] = R2[index] + multip*val2; - }} + } + } + + /* boundary conditions */ + i = dimX - 1 ; + for(j=0; j<dimY; j++) { + index = j*dimX+i; + P1[index] = R1[index]; + } + j = dimY - 1; + for (i=0;i<dimX; i++) + { + index = j*dimX+i; + P2[index] = R2[index]; + + } return 1; } float Proj_func2D(float *P1, float *P2, int methTV, long DimTotal) |