Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 17 additions & 14 deletions SRC/cmemory.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ cLUMemInit(fact_t fact, void *work, int_t lwork, int m, int n, int_t annz,
int panel_size, float fill_ratio, SuperMatrix *L, SuperMatrix *U,
GlobalLU_t *Glu, int **iwork, singlecomplex **dwork)
{
int info, iword, dword;
int info, iword, liword, dword;
SCformat *Lstore;
NCformat *Ustore;
int *xsup, *supno;
Expand All @@ -203,6 +203,7 @@ cLUMemInit(fact_t fact, void *work, int_t lwork, int m, int n, int_t annz,
int_t nzlmax, nzumax, nzlumax;

iword = sizeof(int);
liword = sizeof(int_t);
dword = sizeof(singlecomplex);
Glu->n = n;
Glu->num_expansions = 0;
Expand All @@ -217,8 +218,9 @@ cLUMemInit(fact_t fact, void *work, int_t lwork, int m, int n, int_t annz,
//nzlmax = SUPERLU_MAX(1, fill_ratio/4.) * annz;

if ( lwork == -1 ) {
return ( GluIntArray(n) * iword + TempSpace(m, panel_size)
+ (nzlmax+nzumax)*iword + (nzlumax+nzumax)*dword + n );
return ( 2 * (n+1) * iword + 3 * (n+1) * liword
+ TempSpace(m, panel_size)
+ (nzlmax+nzumax)*liword + (nzlumax+nzumax)*dword + n );
} else {
cSetupSpace(work, lwork, Glu);
}
Expand All @@ -239,9 +241,9 @@ cLUMemInit(fact_t fact, void *work, int_t lwork, int m, int n, int_t annz,
} else {
xsup = (int *)cuser_malloc((n+1) * iword, HEAD, Glu);
supno = (int *)cuser_malloc((n+1) * iword, HEAD, Glu);
xlsub = cuser_malloc((n+1) * iword, HEAD, Glu);
xlusup = cuser_malloc((n+1) * iword, HEAD, Glu);
xusub = cuser_malloc((n+1) * iword, HEAD, Glu);
xlsub = cuser_malloc((n+1) * liword, HEAD, Glu);
xlusup = cuser_malloc((n+1) * liword, HEAD, Glu);
xusub = cuser_malloc((n+1) * liword, HEAD, Glu);
}

lusup = (singlecomplex *) cexpand( &nzlumax, LUSUP, 0, 0, Glu );
Expand All @@ -256,7 +258,7 @@ cLUMemInit(fact_t fact, void *work, int_t lwork, int m, int n, int_t annz,
SUPERLU_FREE(lsub);
SUPERLU_FREE(usub);
} else {
cuser_free((nzlumax+nzumax)*dword+(nzlmax+nzumax)*iword,
cuser_free((nzlumax+nzumax)*dword+(nzlmax+nzumax)*liword,
HEAD, Glu);
}
nzlumax /= 2;
Expand Down Expand Up @@ -291,8 +293,9 @@ cLUMemInit(fact_t fact, void *work, int_t lwork, int m, int n, int_t annz,
nzlumax = Glu->nzlumax;

if ( lwork == -1 ) {
return ( GluIntArray(n) * iword + TempSpace(m, panel_size)
+ (nzlmax+nzumax)*iword + (nzlumax+nzumax)*dword + n );
return ( 2 * (n+1) * iword + 3 * (n+1) * liword
+ TempSpace(m, panel_size)
+ (nzlmax+nzumax)*liword + (nzlumax+nzumax)*dword + n );
} else if ( lwork == 0 ) {
Glu->MemModel = SYSTEM;
} else {
Expand Down Expand Up @@ -624,14 +627,14 @@ void
void
cStackCompress(GlobalLU_t *Glu)
{
register int iword, dword, ndim;
register int liword, dword, ndim;
char *last, *fragment;
int_t *ifrom, *ito;
singlecomplex *dfrom, *dto;
int_t *xlsub, *lsub, *xusub, *usub, *xlusup;
singlecomplex *ucol, *lusup;

iword = sizeof(int);
liword = sizeof(int_t);
dword = sizeof(singlecomplex);
ndim = Glu->n;

Expand All @@ -649,16 +652,16 @@ cStackCompress(GlobalLU_t *Glu)
ucol = dto;

ifrom = lsub;
ito = (int_t *) ((char*)ucol + xusub[ndim] * iword);
ito = (int_t *) ((char*)ucol + xusub[ndim] * dword);
copy_mem_int(xlsub[ndim], ifrom, ito);
lsub = ito;

ifrom = usub;
ito = (int_t *) ((char*)lsub + xlsub[ndim] * iword);
ito = (int_t *) ((char*)lsub + xlsub[ndim] * liword);
copy_mem_int(xusub[ndim], ifrom, ito);
usub = ito;

last = (char*)usub + xusub[ndim] * iword;
last = (char*)usub + xusub[ndim] * liword;
fragment = (char*) (((char*)Glu->stack.array + Glu->stack.top1) - last);
Glu->stack.used -= (int_t)(intptr_t) fragment;
Glu->stack.top1 -= (int_t)(intptr_t) fragment;
Expand Down
31 changes: 17 additions & 14 deletions SRC/dmemory.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ dLUMemInit(fact_t fact, void *work, int_t lwork, int m, int n, int_t annz,
int panel_size, double fill_ratio, SuperMatrix *L, SuperMatrix *U,
GlobalLU_t *Glu, int **iwork, double **dwork)
{
int info, iword, dword;
int info, iword, liword, dword;
SCformat *Lstore;
NCformat *Ustore;
int *xsup, *supno;
Expand All @@ -203,6 +203,7 @@ dLUMemInit(fact_t fact, void *work, int_t lwork, int m, int n, int_t annz,
int_t nzlmax, nzumax, nzlumax;

iword = sizeof(int);
liword = sizeof(int_t);
dword = sizeof(double);
Glu->n = n;
Glu->num_expansions = 0;
Expand All @@ -217,8 +218,9 @@ dLUMemInit(fact_t fact, void *work, int_t lwork, int m, int n, int_t annz,
//nzlmax = SUPERLU_MAX(1, fill_ratio/4.) * annz;

if ( lwork == -1 ) {
return ( GluIntArray(n) * iword + TempSpace(m, panel_size)
+ (nzlmax+nzumax)*iword + (nzlumax+nzumax)*dword + n );
return ( 2 * (n+1) * iword + 3 * (n+1) * liword
+ TempSpace(m, panel_size)
+ (nzlmax+nzumax)*liword + (nzlumax+nzumax)*dword + n );
} else {
dSetupSpace(work, lwork, Glu);
}
Expand All @@ -239,9 +241,9 @@ dLUMemInit(fact_t fact, void *work, int_t lwork, int m, int n, int_t annz,
} else {
xsup = (int *)duser_malloc((n+1) * iword, HEAD, Glu);
supno = (int *)duser_malloc((n+1) * iword, HEAD, Glu);
xlsub = duser_malloc((n+1) * iword, HEAD, Glu);
xlusup = duser_malloc((n+1) * iword, HEAD, Glu);
xusub = duser_malloc((n+1) * iword, HEAD, Glu);
xlsub = duser_malloc((n+1) * liword, HEAD, Glu);
xlusup = duser_malloc((n+1) * liword, HEAD, Glu);
xusub = duser_malloc((n+1) * liword, HEAD, Glu);
}

lusup = (double *) dexpand( &nzlumax, LUSUP, 0, 0, Glu );
Expand All @@ -256,7 +258,7 @@ dLUMemInit(fact_t fact, void *work, int_t lwork, int m, int n, int_t annz,
SUPERLU_FREE(lsub);
SUPERLU_FREE(usub);
} else {
duser_free((nzlumax+nzumax)*dword+(nzlmax+nzumax)*iword,
duser_free((nzlumax+nzumax)*dword+(nzlmax+nzumax)*liword,
HEAD, Glu);
}
nzlumax /= 2;
Expand Down Expand Up @@ -291,8 +293,9 @@ dLUMemInit(fact_t fact, void *work, int_t lwork, int m, int n, int_t annz,
nzlumax = Glu->nzlumax;

if ( lwork == -1 ) {
return ( GluIntArray(n) * iword + TempSpace(m, panel_size)
+ (nzlmax+nzumax)*iword + (nzlumax+nzumax)*dword + n );
return ( 2 * (n+1) * iword + 3 * (n+1) * liword
+ TempSpace(m, panel_size)
+ (nzlmax+nzumax)*liword + (nzlumax+nzumax)*dword + n );
} else if ( lwork == 0 ) {
Glu->MemModel = SYSTEM;
} else {
Expand Down Expand Up @@ -624,14 +627,14 @@ void
void
dStackCompress(GlobalLU_t *Glu)
{
register int iword, dword, ndim;
register int liword, dword, ndim;
char *last, *fragment;
int_t *ifrom, *ito;
double *dfrom, *dto;
int_t *xlsub, *lsub, *xusub, *usub, *xlusup;
double *ucol, *lusup;

iword = sizeof(int);
liword = sizeof(int_t);
dword = sizeof(double);
ndim = Glu->n;

Expand All @@ -649,16 +652,16 @@ dStackCompress(GlobalLU_t *Glu)
ucol = dto;

ifrom = lsub;
ito = (int_t *) ((char*)ucol + xusub[ndim] * iword);
ito = (int_t *) ((char*)ucol + xusub[ndim] * dword);
copy_mem_int(xlsub[ndim], ifrom, ito);
lsub = ito;

ifrom = usub;
ito = (int_t *) ((char*)lsub + xlsub[ndim] * iword);
ito = (int_t *) ((char*)lsub + xlsub[ndim] * liword);
copy_mem_int(xusub[ndim], ifrom, ito);
usub = ito;

last = (char*)usub + xusub[ndim] * iword;
last = (char*)usub + xusub[ndim] * liword;
fragment = (char*) (((char*)Glu->stack.array + Glu->stack.top1) - last);
Glu->stack.used -= (int_t)(intptr_t) fragment;
Glu->stack.top1 -= (int_t)(intptr_t) fragment;
Expand Down
31 changes: 17 additions & 14 deletions SRC/smemory.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ sLUMemInit(fact_t fact, void *work, int_t lwork, int m, int n, int_t annz,
int panel_size, float fill_ratio, SuperMatrix *L, SuperMatrix *U,
GlobalLU_t *Glu, int **iwork, float **dwork)
{
int info, iword, dword;
int info, iword, liword, dword;
SCformat *Lstore;
NCformat *Ustore;
int *xsup, *supno;
Expand All @@ -203,6 +203,7 @@ sLUMemInit(fact_t fact, void *work, int_t lwork, int m, int n, int_t annz,
int_t nzlmax, nzumax, nzlumax;

iword = sizeof(int);
liword = sizeof(int_t);
dword = sizeof(float);
Glu->n = n;
Glu->num_expansions = 0;
Expand All @@ -217,8 +218,9 @@ sLUMemInit(fact_t fact, void *work, int_t lwork, int m, int n, int_t annz,
//nzlmax = SUPERLU_MAX(1, fill_ratio/4.) * annz;

if ( lwork == -1 ) {
return ( GluIntArray(n) * iword + TempSpace(m, panel_size)
+ (nzlmax+nzumax)*iword + (nzlumax+nzumax)*dword + n );
return ( 2 * (n+1) * iword + 3 * (n+1) * liword
+ TempSpace(m, panel_size)
+ (nzlmax+nzumax)*liword + (nzlumax+nzumax)*dword + n );
} else {
sSetupSpace(work, lwork, Glu);
}
Expand All @@ -239,9 +241,9 @@ sLUMemInit(fact_t fact, void *work, int_t lwork, int m, int n, int_t annz,
} else {
xsup = (int *)suser_malloc((n+1) * iword, HEAD, Glu);
supno = (int *)suser_malloc((n+1) * iword, HEAD, Glu);
xlsub = suser_malloc((n+1) * iword, HEAD, Glu);
xlusup = suser_malloc((n+1) * iword, HEAD, Glu);
xusub = suser_malloc((n+1) * iword, HEAD, Glu);
xlsub = suser_malloc((n+1) * liword, HEAD, Glu);
xlusup = suser_malloc((n+1) * liword, HEAD, Glu);
xusub = suser_malloc((n+1) * liword, HEAD, Glu);
}

lusup = (float *) sexpand( &nzlumax, LUSUP, 0, 0, Glu );
Expand All @@ -256,7 +258,7 @@ sLUMemInit(fact_t fact, void *work, int_t lwork, int m, int n, int_t annz,
SUPERLU_FREE(lsub);
SUPERLU_FREE(usub);
} else {
suser_free((nzlumax+nzumax)*dword+(nzlmax+nzumax)*iword,
suser_free((nzlumax+nzumax)*dword+(nzlmax+nzumax)*liword,
HEAD, Glu);
}
nzlumax /= 2;
Expand Down Expand Up @@ -291,8 +293,9 @@ sLUMemInit(fact_t fact, void *work, int_t lwork, int m, int n, int_t annz,
nzlumax = Glu->nzlumax;

if ( lwork == -1 ) {
return ( GluIntArray(n) * iword + TempSpace(m, panel_size)
+ (nzlmax+nzumax)*iword + (nzlumax+nzumax)*dword + n );
return ( 2 * (n+1) * iword + 3 * (n+1) * liword
+ TempSpace(m, panel_size)
+ (nzlmax+nzumax)*liword + (nzlumax+nzumax)*dword + n );
} else if ( lwork == 0 ) {
Glu->MemModel = SYSTEM;
} else {
Expand Down Expand Up @@ -624,14 +627,14 @@ void
void
sStackCompress(GlobalLU_t *Glu)
{
register int iword, dword, ndim;
register int liword, dword, ndim;
char *last, *fragment;
int_t *ifrom, *ito;
float *dfrom, *dto;
int_t *xlsub, *lsub, *xusub, *usub, *xlusup;
float *ucol, *lusup;

iword = sizeof(int);
liword = sizeof(int_t);
dword = sizeof(float);
ndim = Glu->n;

Expand All @@ -649,16 +652,16 @@ sStackCompress(GlobalLU_t *Glu)
ucol = dto;

ifrom = lsub;
ito = (int_t *) ((char*)ucol + xusub[ndim] * iword);
ito = (int_t *) ((char*)ucol + xusub[ndim] * dword);
copy_mem_int(xlsub[ndim], ifrom, ito);
lsub = ito;

ifrom = usub;
ito = (int_t *) ((char*)lsub + xlsub[ndim] * iword);
ito = (int_t *) ((char*)lsub + xlsub[ndim] * liword);
copy_mem_int(xusub[ndim], ifrom, ito);
usub = ito;

last = (char*)usub + xusub[ndim] * iword;
last = (char*)usub + xusub[ndim] * liword;
fragment = (char*) (((char*)Glu->stack.array + Glu->stack.top1) - last);
Glu->stack.used -= (int_t)(intptr_t) fragment;
Glu->stack.top1 -= (int_t)(intptr_t) fragment;
Expand Down
31 changes: 17 additions & 14 deletions SRC/zmemory.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ zLUMemInit(fact_t fact, void *work, int_t lwork, int m, int n, int_t annz,
int panel_size, double fill_ratio, SuperMatrix *L, SuperMatrix *U,
GlobalLU_t *Glu, int **iwork, doublecomplex **dwork)
{
int info, iword, dword;
int info, iword, liword, dword;
SCformat *Lstore;
NCformat *Ustore;
int *xsup, *supno;
Expand All @@ -203,6 +203,7 @@ zLUMemInit(fact_t fact, void *work, int_t lwork, int m, int n, int_t annz,
int_t nzlmax, nzumax, nzlumax;

iword = sizeof(int);
liword = sizeof(int_t);
dword = sizeof(doublecomplex);
Glu->n = n;
Glu->num_expansions = 0;
Expand All @@ -217,8 +218,9 @@ zLUMemInit(fact_t fact, void *work, int_t lwork, int m, int n, int_t annz,
//nzlmax = SUPERLU_MAX(1, fill_ratio/4.) * annz;

if ( lwork == -1 ) {
return ( GluIntArray(n) * iword + TempSpace(m, panel_size)
+ (nzlmax+nzumax)*iword + (nzlumax+nzumax)*dword + n );
return ( 2 * (n+1) * iword + 3 * (n+1) * liword
+ TempSpace(m, panel_size)
+ (nzlmax+nzumax)*liword + (nzlumax+nzumax)*dword + n );
} else {
zSetupSpace(work, lwork, Glu);
}
Expand All @@ -239,9 +241,9 @@ zLUMemInit(fact_t fact, void *work, int_t lwork, int m, int n, int_t annz,
} else {
xsup = (int *)zuser_malloc((n+1) * iword, HEAD, Glu);
supno = (int *)zuser_malloc((n+1) * iword, HEAD, Glu);
xlsub = zuser_malloc((n+1) * iword, HEAD, Glu);
xlusup = zuser_malloc((n+1) * iword, HEAD, Glu);
xusub = zuser_malloc((n+1) * iword, HEAD, Glu);
xlsub = zuser_malloc((n+1) * liword, HEAD, Glu);
xlusup = zuser_malloc((n+1) * liword, HEAD, Glu);
xusub = zuser_malloc((n+1) * liword, HEAD, Glu);
}

lusup = (doublecomplex *) zexpand( &nzlumax, LUSUP, 0, 0, Glu );
Expand All @@ -256,7 +258,7 @@ zLUMemInit(fact_t fact, void *work, int_t lwork, int m, int n, int_t annz,
SUPERLU_FREE(lsub);
SUPERLU_FREE(usub);
} else {
zuser_free((nzlumax+nzumax)*dword+(nzlmax+nzumax)*iword,
zuser_free((nzlumax+nzumax)*dword+(nzlmax+nzumax)*liword,
HEAD, Glu);
}
nzlumax /= 2;
Expand Down Expand Up @@ -291,8 +293,9 @@ zLUMemInit(fact_t fact, void *work, int_t lwork, int m, int n, int_t annz,
nzlumax = Glu->nzlumax;

if ( lwork == -1 ) {
return ( GluIntArray(n) * iword + TempSpace(m, panel_size)
+ (nzlmax+nzumax)*iword + (nzlumax+nzumax)*dword + n );
return ( 2 * (n+1) * iword + 3 * (n+1) * liword
+ TempSpace(m, panel_size)
+ (nzlmax+nzumax)*liword + (nzlumax+nzumax)*dword + n );
} else if ( lwork == 0 ) {
Glu->MemModel = SYSTEM;
} else {
Expand Down Expand Up @@ -624,14 +627,14 @@ void
void
zStackCompress(GlobalLU_t *Glu)
{
register int iword, dword, ndim;
register int liword, dword, ndim;
char *last, *fragment;
int_t *ifrom, *ito;
doublecomplex *dfrom, *dto;
int_t *xlsub, *lsub, *xusub, *usub, *xlusup;
doublecomplex *ucol, *lusup;

iword = sizeof(int);
liword = sizeof(int_t);
dword = sizeof(doublecomplex);
ndim = Glu->n;

Expand All @@ -649,16 +652,16 @@ zStackCompress(GlobalLU_t *Glu)
ucol = dto;

ifrom = lsub;
ito = (int_t *) ((char*)ucol + xusub[ndim] * iword);
ito = (int_t *) ((char*)ucol + xusub[ndim] * dword);
copy_mem_int(xlsub[ndim], ifrom, ito);
lsub = ito;

ifrom = usub;
ito = (int_t *) ((char*)lsub + xlsub[ndim] * iword);
ito = (int_t *) ((char*)lsub + xlsub[ndim] * liword);
copy_mem_int(xusub[ndim], ifrom, ito);
usub = ito;

last = (char*)usub + xusub[ndim] * iword;
last = (char*)usub + xusub[ndim] * liword;
fragment = (char*) (((char*)Glu->stack.array + Glu->stack.top1) - last);
Glu->stack.used -= (int_t)(intptr_t) fragment;
Glu->stack.top1 -= (int_t)(intptr_t) fragment;
Expand Down
Loading