HP MLIB User's Guide Vol. 2 7th Ed.
762 HP MLIB LAPACK User’s Guide
Sample programs
if ( !(ScalePermstruct.perm_c = (int_t *) malloc(n *
sizeof(int_t)) ) ) {
printf(“malloc fails for perm_c[].”);
exit (-1);
}
/* Initialize ScalePermstruct. */
if ( !(LUstruct.etree =(int_t *) malloc(n * sizeof(int_t))) ) {
printf(“malloc fails for etree[].”);
exit (-1);
}
if ( !(LUstruct.Glu_persist = (Glu_persist_t *)
malloc(sizeof(Glu_persist_t))) ) {
printf(“malloc fails for Glu_persist_t.”);
exit (-1);
}
if ( !(LUstruct.Llu = (LocalLU_t *)
malloc(sizeof(LocalLU_t))) ) {
printf(“malloc fails for LocalLU_t.”);
exit (-1);
}
/* Initialize the statistics variables. */
if ( !(stat.utime = (double *) malloc(NPHASES*sizeof(double))) ) {
printf(“malloc fails for stat->utime[]\n”);
exit (-1);
}
if ( !(stat.ops = (flops_t *) malloc(NPHASES * sizeof(flops_t))) )
{
printf(“malloc fails for stat->ops[]\n”);
exit (-1);
}
for (i = 0; i < NPHASES; ++i) {
stat.utime[i] = 0.;
stat.ops[i] = 0.;
}
stat.TinyPivots = stat.RefineSteps = 0;
/* Call the linear equation solver. */
pdgssvx(&options, &A, &ScalePermstruct, b, ldb, nrhs, &grid,
&LUstruct, &SOLVEstruct, berr, &stat, &info);
/* Print the solution. */
for (j =0; j < nrhs; ++j) {
MPI_Gatherv(&b[j*m_loc], m_loc, MPI_DOUBLE, &b_global[j*m],
sol_recvcounts, sol_displs, MPI_DOUBLE, 0, grid.comm);
}
if (!iam) {
printf (“The solution is:\n”);
for (j =0; j < nrhs; ++j) {
for (i = 0; i < m; ++i) {