Skip to content

Commit

Permalink
aux matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
oguyon committed Nov 11, 2023
1 parent ff786a5 commit feb7758
Showing 1 changed file with 34 additions and 7 deletions.
41 changes: 34 additions & 7 deletions plugins/milk-extra-src/linalgebra/GramSchmidt.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ static long fpi_inmodes;
static char *outmodes;
static long fpi_outmodes;

static char *auxmat;
static long fpi_auxmat;;

static int32_t *GPUdevice;
static long fpi_GPUdevice;
Expand All @@ -40,6 +42,15 @@ static CLICMDARGDEF farg[] =
(void **) &outmodes,
&fpi_outmodes
},
{
CLIARG_STR,
".auxmat",
"optional aux matrix, co-transformed",
"auxmat",
CLIARG_HIDDEN_DEFAULT,
(void **) &auxmat,
&fpi_auxmat
},
{
// using GPU (99 : no GPU, otherwise GPU device)
CLIARG_INT32,
Expand Down Expand Up @@ -67,14 +78,21 @@ static errno_t help_function()
}




errno_t GramSchmidt(
IMGID imginm,
IMGID *imgoutm,
IMGID imgaux,
int GPUdev
)
{
DEBUG_TRACE_FSTART();

resolveIMGID(&imginm, ERRMODE_ABORT);

resolveIMGID(&imgaux, ERRMODE_WARN);


// Compute cross product on input
IMGID imginxp = mkIMGID_from_name("_outxp");
Expand Down Expand Up @@ -130,14 +148,21 @@ errno_t GramSchmidt(

float vcoeff = xpval / sqrsum0;

printf(" %5u %5u %f\n", kk, kk0, vcoeff);
//printf(" %5u %5u %f\n", kk, kk0, vcoeff);

for( uint32_t ii=0; ii<xysize; ii++)
{
imgoutm->im->array.F[ kk*xysize + ii] -= vcoeff * imgoutm->im->array.F[ kk0*xysize + ii];
}
}

if ( imgaux.ID != -1)
{
for( uint32_t ii=0; ii<xysize; ii++)
{
imgaux.im->array.F[ kk*xysize + ii] -= vcoeff * imgaux.im->array.F[ kk0*xysize + ii];
}
}
}
}


Expand All @@ -152,6 +177,8 @@ errno_t GramSchmidt(





static errno_t compute_function()
{
DEBUG_TRACE_FSTART();
Expand All @@ -162,17 +189,17 @@ static errno_t compute_function()

IMGID imgoutm = mkIMGID_from_name(outmodes);

IMGID imgaux = mkIMGID_from_name(auxmat);
resolveIMGID(&imgaux, ERRMODE_WARN);



INSERT_STD_PROCINFO_COMPUTEFUNC_INIT


INSERT_STD_PROCINFO_COMPUTEFUNC_LOOPSTART
{


GramSchmidt(imginm, &imgoutm, *GPUdevice);


GramSchmidt(imginm, &imgoutm, imgaux, *GPUdevice);
}
INSERT_STD_PROCINFO_COMPUTEFUNC_END

Expand Down

0 comments on commit feb7758

Please sign in to comment.