HP MLIB User's Guide Vol. 2 7th Ed.

752 HP MLIB LAPACK User’s Guide
Sample programs
rowind[10]=1; rowind[11]=2; rowind[12]=3; rowind[13]=4;
colptr[0]=0; colptr[1]=3; colptr[2]=6; colptr[3]=9;
colptr[4]=13; colptr[5]=14;
b[0]=3.8; b[1]=4.7; b[2]=13.0; b[3]=8.6; b[4]=15.8;
/*
* Create SuperMatrix A:
* Astore points to the storage of a Harwell-Boeing sparse matrix
* format for A.
* A.Stype MUST be NC, A.Dtype MUST be D for pdgssvx_ABglobal and
* MUST be Z for pzgssvx_ABglobal, and A.Mtype MUST be GE.
*/
A.Stype = SLU_NC;
A.Dtype = SLU_D;
A.Mtype = SLU_GE;
A.nrow = m;
A.ncol = n;
A.Store = (void *) malloc( sizeof(NCformat) );
if ( !(A.Store) ) {
printf(“malloc fails for A.Store”);
exit (-1);
}
Astore = (NCformat *) A.Store;
Astore->nnz = nnz;
Astore->nzval = a;
Astore->rowind = rowind;
Astore->colptr = colptr;
if ( !(berr =(double *) malloc(nrhs*sizeof(double))) ) {
printf(“malloc fails for berr[].”);
exit (-1);
}
/* ------------------------------------------------------------
Initialize the input arguments.
------------------------------------------------------------*/
/* 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;
/* Initialize ScalePermstruct. */
ScalePermstruct.DiagScale = NOEQUIL;
if ( !(ScalePermstruct.perm_r = (int_t *) malloc(m *
sizeof(int_t))) ) {
printf(“malloc fails for perm_r[].”);