ext/cvode/source/cvdense.c
static int CVDenseSetup(CVodeMem cv_mem, int convfail, N_Vector ypred,
			N_Vector fpred, boole *jcurPtr, N_Vector vtemp1,
			N_Vector vtemp2, N_Vector vtemp3)
{
  boole jbad, jok;
  real dgamma;
  integer ier;
  CVDenseMem cvdense_mem;
  
  cvdense_mem = (CVDenseMem) lmem;
 
  /* Use nst, gamma/gammap, and convfail to set J eval. flag jok */
 
  dgamma = ABS((gamma/gammap) - ONE);
  jbad = (nst == 0) || (nst > nstlj + CVD_MSBJ) ||
         ((convfail == FAIL_BAD_J) && (dgamma < CVD_DGMAX)) ||
         (convfail == FAIL_OTHER);
  jok = !jbad;
 
  if (jok) {
    /* If jok = TRUE, use saved copy of J */
    *jcurPtr = FALSE;
    DenseCopy(savedJ, M);
  } else {
    /* If jok = FALSE, call jac routine for new J value */
    nje++;
    if (iopt != NULL) iopt[DENSE_NJE] = nje;
    nstlj = nst;
    *jcurPtr = TRUE;
    DenseZero(M); 
    jac(N, M, f, f_data, tn, ypred, fpred, ewt, h,
	uround, J_data, &nfe, vtemp1, vtemp2, vtemp3);
    DenseCopy(M, savedJ);
  }
  
  /* Scale and add I to get M = I - gamma*J */
  DenseScale(-gamma, M);
  DenseAddI(M);

  /* Do LU factorization of M */
  ier = DenseFactor(M, pivots); 
  
  /* Return 0 if the LU was complete; otherwise return 1 */
  if (ier > 0) return(1);
  return(0);
}
/*************** CVDenseSetup ****************************************

 This routine does the setup operations for the dense linear solver.
 It makes a decision whether or not to call the Jacobian evaluation
 routine based on various state variables, and if not it uses the 
 saved copy.  In any case, it constructs the Newton matrix 
 M = I - gamma*J, updates counters, and calls the dense LU 
 factorization routine.

**********************************************************************/
CVDenseSetup
This routine does the setup operations for the dense linear solver.
It makes a decision whether or not to call the Jacobian evaluation
routine based on various state variables, and if not it uses the
saved copy.  In any case, it constructs the Newton matrix
M = I - gamma*J, updates counters, and calls the dense LU
factorization routine.
CVDenseSetup This routine does the setup operations for the dense linear solver . It makes a decision whether or not to call the Jacobian evaluation routine based on various state variables and if not it uses the saved copy . In any case it constructs the Newton matrix M = I - gamma * J updates counters and calls the dense LU factorization routine .
static int CVDenseSetup(CVodeMem cv_mem, int convfail, N_Vector ypred,
			N_Vector fpred, boole *jcurPtr, N_Vector vtemp1,
			N_Vector vtemp2, N_Vector vtemp3)
{
  boole jbad, jok;
  real dgamma;
  integer ier;
  CVDenseMem cvdense_mem;
  cvdense_mem = (CVDenseMem) lmem;
  dgamma = ABS((gamma/gammap) - ONE);
  jbad = (nst == 0) || (nst > nstlj + CVD_MSBJ) ||
         ((convfail == FAIL_BAD_J) && (dgamma < CVD_DGMAX)) ||
         (convfail == FAIL_OTHER);
  jok = !jbad;
  if (jok) {
    *jcurPtr = FALSE;
    DenseCopy(savedJ, M);
  } else {
    nje++;
    if (iopt != NULL) iopt[DENSE_NJE] = nje;
    nstlj = nst;
    *jcurPtr = TRUE;
    DenseZero(M); 
    jac(N, M, f, f_data, tn, ypred, fpred, ewt, h,
	uround, J_data, &nfe, vtemp1, vtemp2, vtemp3);
    DenseCopy(M, savedJ);
  }
  DenseScale(-gamma, M);
  DenseAddI(M);
  ier = DenseFactor(M, pivots); 
  if (ier > 0) return(1);
  return(0);
}
static int CVDenseSetup ( CVodeMem cv_mem , int convfail , N_Vector ypred , N_Vector fpred , boole * jcurPtr , N_Vector vtemp1 , N_Vector vtemp2 , N_Vector vtemp3 ) { boole jbad , jok ; real dgamma ; integer ier ; CVDenseMem cvdense_mem ; cvdense_mem = ( CVDenseMem ) lmem ; dgamma = ABS ( ( gamma / gammap ) - ONE ) ; jbad = ( nst == 0 ) || ( nst > nstlj + CVD_MSBJ ) || ( ( convfail == FAIL_BAD_J ) && ( dgamma < CVD_DGMAX ) ) || ( convfail == FAIL_OTHER ) ; jok = ! jbad ; if ( jok ) { * jcurPtr = FALSE ; DenseCopy ( savedJ , M ) ; } else { nje ++ ; if ( iopt != NULL ) iopt [ DENSE_NJE ] = nje ; nstlj = nst ; * jcurPtr = TRUE ; DenseZero ( M ) ; jac ( N , M , f , f_data , tn , ypred , fpred , ewt , h , uround , J_data , & nfe , vtemp1 , vtemp2 , vtemp3 ) ; DenseCopy ( M , savedJ ) ; } DenseScale ( - gamma , M ) ; DenseAddI ( M ) ; ier = DenseFactor ( M , pivots ) ; if ( ier > 0 ) return ( 1 ) ; return ( 0 ) ; }
CVDenseSetup 
This routine does the setup operations for the dense linear solver.
CVDenseSetup This routine does the setup operations for the dense linear solver .
/* Use nst, gamma/gammap, and convfail to set J eval. flag jok */ /* If jok = TRUE, use saved copy of J */ /* If jok = FALSE, call jac routine for new J value */ /* Scale and add I to get M = I - gamma*J */ /* Do LU factorization of M */ /* Return 0 if the LU was complete; otherwise return 1 */