#include <stdlib.h>
#include <stdio.h>
#include <BSprivate.h>
Go to the source code of this file.
|
MPI_Comm | GetCommunicator () |
|
void | ctranspose (int n, double d[n][n]) |
|
void | bs95setup_ (int *ndim, int *nnz, int *nstart, int *nrows, int rp[*nrows+1], int cval[*nnz], double aval[*nnz], int *symm, int *debugwrite) |
|
void | bs95solve_ (int *ndim, double rhs[*ndim], double x[*ndim], double *tolerance, int *debugwrite) |
|
void | bs95free_ (int *debugwrite) |
|
void | bs95finalize_ (int *debugwrite) |
|
void | serialbs95tridiag_ (int *ndim, double ad[*ndim], double bd[*ndim], double cd[*ndim], double rhs[*ndim], double x[*ndim], int *debugwrite) |
|
void | serialbs95_ (int *ndim, double A[*ndim][*ndim], double rhs[*ndim], double x[*ndim], int *debugwrite) |
|
void | serialbs95mat_ (int *ndim, int *nnz, double A[*ndim][*ndim], int rp[*ndim+1], int cval[*nnz], double aval[*nnz], int *debugwrite) |
|
void bs95finalize_ |
( |
int * |
debugwrite | ) |
|
Definition at line 396 of file BS95.c.
401 if(*debugwrite==1){printf(
" BS95FINALIZE\n finalizing BS...");}
403 if(*debugwrite==1){printf(
"done\n");}
void bs95free_ |
( |
int * |
debugwrite | ) |
|
Definition at line 346 of file BS95.c.
References Acomm, bA, f_pA, fcomm, pA, and procinfo.
Referenced by serialbs95_(), and serialbs95tridiag_().
351 if(*debugwrite==1){printf(
" BS95FREE\n freeing matrices...");}
353 BSfree_copy_par_mat(
f_pA);
355 if(*debugwrite==1){printf(
"done\n");}
360 if(*debugwrite==1){printf(
" freeing the communication patterns...");}
363 if(*debugwrite==1){printf(
"done\n");}
368 if(*debugwrite==1){printf(
" freeing the processor context...");}
370 if(*debugwrite==1){printf(
"done\n");}
void bs95setup_ |
( |
int * |
ndim, |
|
|
int * |
nnz, |
|
|
int * |
nstart, |
|
|
int * |
nrows, |
|
|
int |
rp[*nrows+1], |
|
|
int |
cval[*nnz], |
|
|
double |
aval[*nnz], |
|
|
int * |
symm, |
|
|
int * |
debugwrite |
|
) |
| |
Definition at line 125 of file BS95.c.
References Acomm, bA, f_pA, FALSE, fcomm, GetCommunicator(), i, maxiter, pA, and procinfo.
Referenced by serialbs95_(), and serialbs95tridiag_().
133 printf(
"ndim = %d\n",*ndim);
134 printf(
"nnz = %d\n",*nnz);
135 printf(
"nstart = %d\n",*nstart);
136 printf(
"nrows = %d\n",*nrows);
138 for(i=0;i<*nrows+1;i++) {
141 printf(
"]\ncval = [ ");
142 for(i=0;i<*nnz;i++) {
143 printf(
"%d ",cval[i]);
145 printf(
"]\naval = [ ");
146 for(i=0;i<*nnz;i++) {
147 printf(
"%f ",aval[i]);
156 argv = (
char ** ) MALLOC(
sizeof(
char)*argc);
157 for(i=0;i<argc;i++) {
160 if(*debugwrite==1){printf(
" BS95SETUP\n initializing BS...");}
162 if(*debugwrite==1){printf(
"done\n");}
167 if(*debugwrite==1){printf(
" getting the processor context...");}
171 BSctx_set_ps(
procinfo,the_communicator);
173 if(*debugwrite==1){printf(
"done\n");}
178 if(*debugwrite==1){printf(
" creating the BSspmat A matrix...");}
179 bA = BSeasy_A(*nstart,*nrows,rp,cval,aval,
procinfo);
180 if(*debugwrite==1){printf(
"done\n");}
185 if(*debugwrite==1){printf(
" setting up matrix storage...");}
186 BSset_mat_symmetric(
bA,*symm);
187 if(*debugwrite==1){printf(
"done\n");}
192 if(*debugwrite==1){printf(
" setting up storage type...");}
193 BSset_mat_icc_storage(
bA,*symm);
194 if(*debugwrite==1){printf(
"done\n");}
199 if(*debugwrite==1){printf(
" permuting the A matrix...");}
201 if(*debugwrite==1){printf(
"done\n");}
206 if(*debugwrite==1){printf(
" diagonally scaling the A matrix...");}
208 if(*debugwrite==1){printf(
"done\n");}
213 if(*debugwrite==1){printf(
" setting up communication data structures...");}
216 if(*debugwrite==1){printf(
"done\n");}
221 if(*debugwrite==1){printf(
" creating a copy of the permuted matrix...");}
222 f_pA = BScopy_par_mat(
pA);
223 if(*debugwrite==1){printf(
"done\n");}
228 if(*debugwrite==1){printf(
" performing an incomplete factorization of the matrix...");}
235 if(*debugwrite==1){printf(
"done\n");}
240 if(*debugwrite==1){printf(
" setting solver parameters...");}
253 if(*debugwrite==1){printf(
"done\n");}
MPI_Comm GetCommunicator()
void bs95solve_ |
( |
int * |
ndim, |
|
|
double |
rhs[*ndim], |
|
|
double |
x[*ndim], |
|
|
double * |
tolerance, |
|
|
int * |
debugwrite |
|
) |
| |
Definition at line 288 of file BS95.c.
References Acomm, f_pA, i, maxiter, pA, procinfo, rhs, and x.
Referenced by serialbs95_(), and serialbs95tridiag_().
296 for(i=0;i<*ndim;i++) {
297 printf(
"%f ",
rhs[i]);
305 if(*debugwrite==1){printf(
" BS95SOLVE\n solving the system...");}
309 printf(
"*** WARNING *** BlockSolve95 using too many iterations. Matrix likely ill-conditioned.\n");
313 printf(
" BS took %d iterations to solve the system\n",num_iter);
315 for(i=0;i<*ndim;i++) { printf(
"%f ",
x[i]); }
317 printf(
" residual = %e\n",residual);
void ctranspose |
( |
int |
n, |
|
|
double |
d[n][n] |
|
) |
| |
MPI_Comm GetCommunicator |
( |
| ) |
|
void serialbs95_ |
( |
int * |
ndim, |
|
|
double |
A[*ndim][*ndim], |
|
|
double |
rhs[*ndim], |
|
|
double |
x[*ndim], |
|
|
int * |
debugwrite |
|
) |
| |
Definition at line 554 of file BS95.c.
References A, bs95free_(), bs95setup_(), bs95solve_(), ctranspose(), i, j, rhs, and x.
576 if(*debugwrite==1){printf(
" Using BlockSolve95 to solve the system\n");}
586 if(*debugwrite==1){printf(
" defining matrix mapping...");}
588 for(i=0;i<*ndim;i++) {
589 for(j=0;j<*ndim;j++) {
595 aval = (FLOAT *) MALLOC(
sizeof(FLOAT)*nnz);
596 cval = (
int *) MALLOC(
sizeof(
int)*nnz);
597 rp = (
int *) MALLOC(
sizeof(
int)*(*ndim+1));
601 for(i=0;i<*ndim;i++) {
602 for(j=0;j<*ndim;j++) {
604 aval[avali] =
A[
i][
j];
610 if(*debugwrite==1){printf(
"done\n");}
617 bs95setup_(ndim,&nnz,&nstart,ndim,rp,cval,aval,&symm,debugwrite);
624 if(*debugwrite==1){printf(
" freeing matrix mapping...");}
628 if(*debugwrite==1){printf(
"done\n");}
638 if(*debugwrite==1){printf(
" Done using BlockSolve95 to solve the system\n");}
void bs95free_(int *debugwrite)
void bs95solve_(int *ndim, double rhs[*ndim], double x[*ndim], double *tolerance, int *debugwrite)
void bs95setup_(int *ndim, int *nnz, int *nstart, int *nrows, int rp[*nrows+1], int cval[*nnz], double aval[*nnz], int *symm, int *debugwrite)
void ctranspose(int n, double d[n][n])
void serialbs95mat_ |
( |
int * |
ndim, |
|
|
int * |
nnz, |
|
|
double |
A[*ndim][*ndim], |
|
|
int |
rp[*ndim+1], |
|
|
int |
cval[*nnz], |
|
|
double |
aval[*nnz], |
|
|
int * |
debugwrite |
|
) |
| |
Definition at line 669 of file BS95.c.
References A, ctranspose(), i, and j.
687 if(*debugwrite==1){printf(
" SERIALBS95MAT\n defining matrix mapping...");}
690 for(i=0;i<*ndim;i++) {
691 for(j=0;j<*ndim;j++) {
693 aval[avali] =
A[
i][
j];
700 if(*debugwrite==1){printf(
"done\n");}
void ctranspose(int n, double d[n][n])
void serialbs95tridiag_ |
( |
int * |
ndim, |
|
|
double |
ad[*ndim], |
|
|
double |
bd[*ndim], |
|
|
double |
cd[*ndim], |
|
|
double |
rhs[*ndim], |
|
|
double |
x[*ndim], |
|
|
int * |
debugwrite |
|
) |
| |
Definition at line 441 of file BS95.c.
References bs95free_(), bs95setup_(), bs95solve_(), i, rhs, and x.
468 if(*debugwrite==1){printf(
" Using BlockSolve95 to solve the tridiagonal system...\n");}
473 if(*debugwrite==1){printf(
" defining matrix mapping...");}
475 aval = (FLOAT *) MALLOC(
sizeof(FLOAT)*nnz);
476 cval = (
int *) MALLOC(
sizeof(
int)*nnz);
477 rp = (
int *) MALLOC(
sizeof(
int)*(*ndim+1));
486 for(i=1;i<*ndim-1;i++) {
488 aval[avali+1] = bd[
i];
489 aval[avali+2] = cd[
i];
496 aval[nnz-2] = ad[*ndim-1];
497 aval[nnz-1] = bd[*ndim-1];
498 cval[nnz-2] = *ndim-2;
499 cval[nnz-1] = *ndim-1;
501 if(*debugwrite==1){printf(
"done\n");}
508 bs95setup_(ndim,&nnz,&nstart,ndim,rp,cval,aval,&symm,debugwrite);
515 if(*debugwrite==1){printf(
" freeing matrix mapping...");}
519 if(*debugwrite==1){printf(
"done\n");}
524 if(*debugwrite==1){printf(
" Done using BlockSolve95 to solve the system\n");}
void bs95free_(int *debugwrite)
void bs95solve_(int *ndim, double rhs[*ndim], double x[*ndim], double *tolerance, int *debugwrite)
void bs95setup_(int *ndim, int *nnz, int *nstart, int *nrows, int rp[*nrows+1], int cval[*nnz], double aval[*nnz], int *symm, int *debugwrite)