From ac40c919088cf01d459d4b5b3016d2e0e06966cf Mon Sep 17 00:00:00 2001 From: oguyon Date: Mon, 13 Nov 2023 16:59:37 -1000 Subject: [PATCH] add co-input --- .../milk-extra-src/linalgebra/GramSchmidt.c | 26 +++++++++++++++---- .../linalgebra/SingularValueDecomp.c | 3 ++- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/plugins/milk-extra-src/linalgebra/GramSchmidt.c b/plugins/milk-extra-src/linalgebra/GramSchmidt.c index 81eea6a1..8e533ed3 100644 --- a/plugins/milk-extra-src/linalgebra/GramSchmidt.c +++ b/plugins/milk-extra-src/linalgebra/GramSchmidt.c @@ -95,8 +95,9 @@ errno_t GramSchmidt( // Compute cross product on input - IMGID imginxp = mkIMGID_from_name("_outxp"); - computeSGEMM(imginm, imginm, &imginxp, 1, 0, GPUdev); + // + //IMGID imginxp = mkIMGID_from_name("_outxp"); + //computeSGEMM(imginm, imginm, &imginxp, 1, 0, GPUdev); // Create output @@ -118,11 +119,25 @@ errno_t GramSchmidt( zsize = imginm.md->size[1]; } + uint32_t xysizeaux = 0; + if ( imgaux.ID != -1) + { + xysizeaux = imgaux.md->size[0]; + if(imginm.md->naxis == 3) + { + xysizeaux *= imgaux.md->size[1]; + } + } + + printf("xysize = %u, zsize = %u\n", xysize, zsize); + printf("\n"); for ( uint32_t kk=0; kkim->array.F[kk*xysize], &imginm.im->array.F[kk*xysize], sizeof(float)*xysize); for ( uint32_t kk0 = 0; kk0 < kk; kk0++ ) @@ -157,13 +172,14 @@ errno_t GramSchmidt( if ( imgaux.ID != -1) { - for( uint32_t ii=0; iiarray.F[ kk*xysize + ii] -= vcoeff * imgaux.im->array.F[ kk0*xysize + ii]; + imgaux.im->array.F[ kk*xysizeaux + ii] -= vcoeff * imgaux.im->array.F[ kk0*xysizeaux + ii]; } } } } + printf("\n"); list_image_ID(); diff --git a/plugins/milk-extra-src/linalgebra/SingularValueDecomp.c b/plugins/milk-extra-src/linalgebra/SingularValueDecomp.c index 3b02f1c9..438e175b 100644 --- a/plugins/milk-extra-src/linalgebra/SingularValueDecomp.c +++ b/plugins/milk-extra-src/linalgebra/SingularValueDecomp.c @@ -696,9 +696,10 @@ errno_t compute_SVD( for(int kk=0; kkarray.F[kk]; + //printf("mfact %4d = %f\n", kk, mfact); for(long ii=0; iiarray.F[kk*framesize+ii] = imgV.im->array.F[kk*framesize+ii] / mfact; + imgvnmodes.im->array.F[kk*framesize+ii] = imgV.im->array.F[kk*framesize+ii] * mfact; } }