summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEdoardo Pasca <edo@vishighmem01.esc.rl.ac.uk>2019-08-08 22:47:13 +0100
committerEdoardo Pasca <edo@vishighmem01.esc.rl.ac.uk>2019-08-08 22:47:13 +0100
commit432189f9d90324f7adf8f58d5905632866a3a2cf (patch)
tree1e469305a5ae28684432ca30c4873d4781ff3e1f /src
parente2d85c8557733174690da77f712a0c0a7c2d26e0 (diff)
downloadregularization-432189f9d90324f7adf8f58d5905632866a3a2cf.tar.gz
regularization-432189f9d90324f7adf8f58d5905632866a3a2cf.tar.bz2
regularization-432189f9d90324f7adf8f58d5905632866a3a2cf.tar.xz
regularization-432189f9d90324f7adf8f58d5905632866a3a2cf.zip
inverted nested for loop
Diffstat (limited to 'src')
-rw-r--r--src/Core/regularisers_CPU/FGP_TV_core.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/Core/regularisers_CPU/FGP_TV_core.c b/src/Core/regularisers_CPU/FGP_TV_core.c
index a17604e..69c92bc 100644
--- a/src/Core/regularisers_CPU/FGP_TV_core.c
+++ b/src/Core/regularisers_CPU/FGP_TV_core.c
@@ -175,8 +175,8 @@ float Obj_func2D(float *A, float *D, float *R1, float *R2, float lambda, long di
float val1, val2;
long i,j,index;
#pragma omp parallel for shared(A,D,R1,R2) private(index,i,j,val1,val2)
- for(i=0; i<dimX; i++) {
- for(j=0; j<dimY; j++) {
+ for(j=0; j<dimY; j++) {
+ for(i=0; i<dimX; i++) {
index = j*dimX+i;
/* boundary conditions */
if (i == 0) {val1 = 0.0f;} else {val1 = R1[j*dimX + (i-1)];}
@@ -191,8 +191,8 @@ 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(i=0; i<dimX; i++) {
- for(j=0; j<dimY; j++) {
+ for(j=0; j<dimY; j++) {
+ for(i=0; i<dimX; i++) {
index = j*dimX+i;
/* boundary conditions */
if (i == dimX-1) val1 = 0.0f; else val1 = D[index] - D[j*dimX + (i+1)];
@@ -252,10 +252,10 @@ float Obj_func3D(float *A, float *D, float *R1, float *R2, float *R3, float lamb
float val1, val2, val3;
long i,j,k,index;
#pragma omp parallel for shared(A,D,R1,R2,R3) private(index,i,j,k,val1,val2,val3)
- for(i=0; i<dimX; i++) {
+ for(k=0; k<dimZ; k++) {
for(j=0; j<dimY; j++) {
- for(k=0; k<dimZ; k++) {
- index = (dimX*dimY)*k + j*dimX+i;
+ for(i=0; i<dimX; i++) {
+ index = (dimX*dimY)*k + j*dimX+i;
/* boundary conditions */
if (i == 0) {val1 = 0.0f;} else {val1 = R1[(dimX*dimY)*k + j*dimX + (i-1)];}
if (j == 0) {val2 = 0.0f;} else {val2 = R2[(dimX*dimY)*k + (j-1)*dimX + i];}
@@ -270,10 +270,10 @@ float Grad_func3D(float *P1, float *P2, float *P3, float *D, float *R1, float *R
long i,j,k, index;
multip = (1.0f/(26.0f*lambda));
#pragma omp parallel for shared(P1,P2,P3,D,R1,R2,R3,multip) private(index,i,j,k,val1,val2,val3)
- for(i=0; i<dimX; i++) {
+ for(k=0; k<dimZ; k++) {
for(j=0; j<dimY; j++) {
- for(k=0; k<dimZ; k++) {
- index = (dimX*dimY)*k + j*dimX+i;
+ for(i=0; i<dimX; i++) {
+ index = (dimX*dimY)*k + j*dimX+i;
/* boundary conditions */
if (i == dimX-1) val1 = 0.0f; else val1 = D[index] - D[(dimX*dimY)*k + j*dimX + (i+1)];
if (j == dimY-1) val2 = 0.0f; else val2 = D[index] - D[(dimX*dimY)*k + (j+1)*dimX + i];