HP MLIB User's Guide Vol. 2 7th Ed.
Chapter 11 Introduction to Distributed SuperLU 761
Sample programs
Astore = (NRformat_loc *) A.Store;
Astore->nnz_loc = nnz_loc;
Astore->fst_row = fst_row;
Astore->m_loc = m_loc;
Astore->nzval = nzval_loc;
Astore->colind = colind;
Astore->rowptr = rowptr;
/* Get the local B */
if (!(b=(double *) malloc(m_loc*nrhs*sizeof(double)))) {
printf(“malloc fails for b[]\n”);
exit (-1);
}
for (j =0; j < nrhs; ++j) {
for (i = 0; i < m_loc; ++i) {
row = fst_row + i;
b[j*m_loc+i] = b_global[j*n+row];
}
}
ldb = m_loc;
free(marker);
if (!(berr=(double *) malloc(nrhs*sizeof(double)))) {
printf(“malloc fails for berr[]\n”);
exit (-1);
}
/* ------------------------------------------------------------
NOW WE SOLVE THE LINEAR SYSTEM.
------------------------------------------------------------*/
/* Set the default input options. */
options.Fact = DOFACT;
options.Trans = NOTRANS;
options.Equil = YES;
options.RowPerm = LargeDiag;
options.ColPerm = MMD_AT_PLUS_A;
options.ReplaceTinyPivot = YES;
options.IterRefine = DOUBLE;
options.SolveInitialized = NO;
options.RefineInitialized = NO;
/* Initialize ScalePermstruct. */
ScalePermstruct.DiagScale = NOEQUIL;
if ( !(ScalePermstruct.perm_r = (int_t *) malloc(m *
sizeof(int_t))) ) {
printf(“malloc fails for perm_r[].”);
exit (-1);
}