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
2 changes: 2 additions & 0 deletions EXAMPLE/xlinsolx.base
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ int main(int argc, char *argv[])
Destroy_SuperNode_Matrix(&L);
Destroy_CompCol_Matrix(&U);
} else if ( lwork > 0 ) {
Destroy_SuperMatrix_Store(&L);
Destroy_SuperMatrix_Store(&U);
SUPERLU_FREE(work);
}

Expand Down
2 changes: 2 additions & 0 deletions EXAMPLE/xlinsolx1.base
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ int main(int argc, char *argv[])
Destroy_SuperNode_Matrix(&L);
Destroy_CompCol_Matrix(&U);
} else if ( lwork > 0 ) {
Destroy_SuperMatrix_Store(&L);
Destroy_SuperMatrix_Store(&U);
SUPERLU_FREE(work);
}

Expand Down
7 changes: 6 additions & 1 deletion EXAMPLE/xlinsolx2.base
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,12 @@ int main(int argc, char *argv[])
StatFree(&stat);
Destroy_CompCol_Matrix(&A);
Destroy_Dense_Matrix(&B);
if ( lwork >= 0 ) { /* Deallocate storage associated with L and U. */
if ( lwork == 0 ) { /* Deallocate storage associated with L and U. */
Destroy_SuperNode_Matrix(&L);
Destroy_CompCol_Matrix(&U);
} else if ( lwork > 0 ) { /* L and U are stored in work[]. */
Destroy_SuperMatrix_Store(&L);
Destroy_SuperMatrix_Store(&U);
}

/* ------------------------------------------------------------
Expand Down Expand Up @@ -259,6 +262,8 @@ int main(int argc, char *argv[])
Destroy_SuperNode_Matrix(&L);
Destroy_CompCol_Matrix(&U);
} else if ( lwork > 0 ) {
Destroy_SuperMatrix_Store(&L);
Destroy_SuperMatrix_Store(&U);
SUPERLU_FREE(work);
}

Expand Down
2 changes: 2 additions & 0 deletions EXAMPLE/xlinsolx3.base
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,8 @@ int main(int argc, char *argv[])
Destroy_SuperNode_Matrix(&L);
Destroy_CompCol_Matrix(&U);
} else if ( lwork > 0 ) {
Destroy_SuperMatrix_Store(&L);
Destroy_SuperMatrix_Store(&U);
SUPERLU_FREE(work);
}

Expand Down
19 changes: 18 additions & 1 deletion SRC/xgsisx.base
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,13 @@ void

if ( lwork == -1 ) {
mem_usage->total_needed = *info - A->ncol;
// cleanup prior to returning
if ( perm ) SUPERLU_FREE(perm);
Destroy_CompCol_Permuted(&AC);
if ( A->Stype == SLU_NR ) {
Destroy_SuperMatrix_Store(AA);
SUPERLU_FREE(AA);
}
return;
}

Expand All @@ -654,7 +661,17 @@ void
}

if ( options->PivotGrowth ) {
if ( *info > 0 ) return;
if ( *info > 0 ) {
// cleanup prior to returning
if ( nofact ) {
Destroy_CompCol_Permuted(&AC);
}
if ( A->Stype == SLU_NR ) {
Destroy_SuperMatrix_Store(AA);
SUPERLU_FREE(AA);
}
return;
}

/* Compute the reciprocal pivot growth factor *recip_pivot_growth. */
*recip_pivot_growth = @(pre)PivotGrowth(A->ncol, AA, perm_c, L, U);
Expand Down
14 changes: 14 additions & 0 deletions SRC/xgssvx.base
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,12 @@ printf("dgssvx: Fact=%4d, Trans=%4d, equed=%c\n",

if ( lwork == -1 ) {
mem_usage->total_needed = *info - A->ncol;
// cleanup prior to returning
Destroy_CompCol_Permuted(&AC);
if ( A->Stype == SLU_NR ) {
Destroy_SuperMatrix_Store(AA);
SUPERLU_FREE(AA);
}
return;
}
}
Expand All @@ -555,6 +561,14 @@ printf("dgssvx: Fact=%4d, Trans=%4d, equed=%c\n",
rank-deficient (*info) columns of A. */
*recip_pivot_growth = @(pre)PivotGrowth(*info, AA, perm_c, L, U);
}
// cleanup prior to returning
if ( nofact ) {
Destroy_CompCol_Permuted(&AC);
}
if ( A->Stype == SLU_NR ) {
Destroy_SuperMatrix_Store(AA);
SUPERLU_FREE(AA);
}
return;
}

Expand Down
25 changes: 19 additions & 6 deletions TESTING/xdrive.base
Original file line number Diff line number Diff line change
Expand Up @@ -410,10 +410,9 @@ int main(int argc, char *argv[])
/* Restore perm_c. */
for (i = 0; i < n; ++i) perm_c[i] = pc_save[i];

if (lwork == 0) {
Destroy_SuperNode_Matrix(&L);
Destroy_CompCol_Matrix(&U);
}
/* @(pre)gssv allocated the factors */
Destroy_SuperNode_Matrix(&L);
Destroy_CompCol_Matrix(&U);
} /* if .. end of testing @(pre)gssv */

/*----------------
Expand All @@ -427,6 +426,19 @@ int main(int argc, char *argv[])
@(pre)laqgs(&A, R, C, rowcnd, colcnd, amax, equed);
}

/* @(pre)gssvx computes new factors for DOFACT and
SamePattern; free those of the previous call. */
if ( itran > 0 && (options.Fact == DOFACT ||
options.Fact == SamePattern) ) {
if ( lwork == 0 ) {
Destroy_SuperNode_Matrix(&L);
Destroy_CompCol_Matrix(&U);
} else { /* L and U are stored in work[] */
Destroy_SuperMatrix_Store(&L);
Destroy_SuperMatrix_Store(&U);
}
}

/* Solve the system and compute the condition number
and error bounds using @(pre)gssvx. */
@(pre)gssvx(&options, &A, perm_c, perm_r, etree,
Expand Down Expand Up @@ -491,6 +503,9 @@ int main(int argc, char *argv[])
if ( lwork == 0 ) {
Destroy_SuperNode_Matrix(&L);
Destroy_CompCol_Matrix(&U);
} else { /* L and U are stored in work[] */
Destroy_SuperMatrix_Store(&L);
Destroy_SuperMatrix_Store(&U);
}

} /* for equil ... */
Expand Down Expand Up @@ -536,8 +551,6 @@ int main(int argc, char *argv[])
#endif
if ( lwork > 0 ) {
SUPERLU_FREE (work);
Destroy_SuperMatrix_Store(&L);
Destroy_SuperMatrix_Store(&U);
}

return (nfail == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
Expand Down