#include "BSprivate.h" /*+ BSpar_symmlq - SYMMLQ; reverse communication Input Parameters: . num_cols - the length of the vector on this processor . rhs - the rhs on this processor . x - the solution vector on this processor . resid - the residual vector on this processor . z - the work vector on this processor . v - the work vector on this processor . w - the work vector on this processor . r2 - the work vector on this processor . beta thru conv - symmlq values that aren't of much interest . cur_step - the current cg step . cur_phase - the current cg phase . procinfo - the usual processor stuff Output Parameters: . many of the input parameters are changed, it is just the usual SYMMLQ algorithm Returns: The action of the calling program depends on the return value SYMM_MATVECXR: multiply A*x and put the results in resid SYMM_MATVECVZ: multiply A*v and put the results in z SYMM_MSOLVE1: multiply A(-1)*resid and put the results in z SYMM_MSOLVE2: multiply A(-1)*r2 and put the results in z SYMM_MSOLVEB: multiply A(-1)*rhs and put the results in z SYMM_ERROR: error during SYMMLQ SYMM_DONE: SYMMLQ is finished, convergence has occurred Notes: The first time that BSpar_bcg is called, cur_step and cur_phase should be 0 and conv should be FALSE. +*/ int BSpar_symmlq(int num_cols, FLOAT *rhs, FLOAT *x, FLOAT *resid, FLOAT *z, FLOAT *v, FLOAT *w, FLOAT *r2, FLOAT *cg_beta, FLOAT *cg_alpha, FLOAT *obeta, FLOAT *gbar, FLOAT *dbar, FLOAT *rhs1, FLOAT *rhs2, FLOAT *bstep, FLOAT *snprod, FLOAT *beta1, FLOAT *tnorm, FLOAT *ynorm2, FLOAT *bestnm, int *cgpt, int conv, int *cur_step, int *cur_phase, BSprocinfo *procinfo) { int i; FLOAT t1, t2; FLOAT s; FLOAT gamma, cs, sn, delta, epsln; FLOAT ynorm, anorm, epsa, gpert, diag; FLOAT elqnrm, qrnorm, cgnorm; FLOAT zbar; FLOAT eps; char EPS = 'E'; eps = DLAMCH(&EPS); switch((*cur_phase)) { case 0: { /* compute A*x=r */ (*cur_phase) = 1; (*cur_step) = 0; return(SYMM_MATVECXR); } case 1: { /* compute r and then z = M(-1)*r */ for (i=0;i