ext/cvode/source/cvband.c
static int CVBandInit(CVodeMem cv_mem, boole *setupNonNull)
{
  CVBandMem cvband_mem;
  
  cvband_mem = (CVBandMem) lmem;

  /* Print error message and return if cvband_mem is NULL */
  if (cvband_mem == NULL) {
    fprintf(errfp, MSG_MEM_FAIL);
    return(LINIT_ERR);
  }

  /* Set flag setupNonNull = TRUE */
  *setupNonNull = TRUE;

  /* Test ml and mu for legality */
  if ((ml < 0) || (mu < 0) || (ml >= N) || (mu >= N)) {
    fprintf(errfp, MSG_BAD_SIZES, ml, mu, N-1);
    return(LINIT_ERR);
  }

  /* Set extended upper half-bandwith for M (required for pivoting) */
  storage_mu = MIN(N-1, mu + ml);

  /* Allocate memory for M, savedJ, and pivot arrays */
  M = BandAllocMat(N, mu, ml, storage_mu);
  if (M == NULL) {
    fprintf(errfp, MSG_MEM_FAIL);
    return(LINIT_ERR);
  }
  savedJ = BandAllocMat(N, mu, ml, mu);
  if (savedJ == NULL) {
    fprintf(errfp, MSG_MEM_FAIL);
    BandFreeMat(M);
    return(LINIT_ERR);
  }
  pivots = BandAllocPiv(N);
  if (pivots == NULL) {
    fprintf(errfp, MSG_MEM_FAIL);
    BandFreeMat(M);
    BandFreeMat(savedJ);
    return(LINIT_ERR);
  }

  /* Initialize nje and nstlj, and set workspace lengths */
  nje = 0;
  if (iopt != NULL) {
    iopt[BAND_NJE] = nje;
    iopt[BAND_LRW] = N*(storage_mu + mu + 2*ml + 2);
    iopt[BAND_LIW] = N;
  }
  nstlj = 0;
  
  return(LINIT_OK);
}
/*************** CVBandInit ******************************************

 This routine initializes remaining memory specific to the band
 linear solver.  If any memory request fails, all memory previously
 allocated is freed, and an error message printed, before returning.

**********************************************************************/
CVBandInit
This routine initializes remaining memory specific to the band
linear solver.  If any memory request fails, all memory previously
allocated is freed, and an error message printed, before returning.
CVBandInit This routine initializes remaining memory specific to the band linear solver . If any memory request fails all memory previously allocated is freed and an error message printed before returning .
static int CVBandInit(CVodeMem cv_mem, boole *setupNonNull)
{
  CVBandMem cvband_mem;
  cvband_mem = (CVBandMem) lmem;
  if (cvband_mem == NULL) {
    fprintf(errfp, MSG_MEM_FAIL);
    return(LINIT_ERR);
  }
  *setupNonNull = TRUE;
  if ((ml < 0) || (mu < 0) || (ml >= N) || (mu >= N)) {
    fprintf(errfp, MSG_BAD_SIZES, ml, mu, N-1);
    return(LINIT_ERR);
  }
  storage_mu = MIN(N-1, mu + ml);
  M = BandAllocMat(N, mu, ml, storage_mu);
  if (M == NULL) {
    fprintf(errfp, MSG_MEM_FAIL);
    return(LINIT_ERR);
  }
  savedJ = BandAllocMat(N, mu, ml, mu);
  if (savedJ == NULL) {
    fprintf(errfp, MSG_MEM_FAIL);
    BandFreeMat(M);
    return(LINIT_ERR);
  }
  pivots = BandAllocPiv(N);
  if (pivots == NULL) {
    fprintf(errfp, MSG_MEM_FAIL);
    BandFreeMat(M);
    BandFreeMat(savedJ);
    return(LINIT_ERR);
  }
  nje = 0;
  if (iopt != NULL) {
    iopt[BAND_NJE] = nje;
    iopt[BAND_LRW] = N*(storage_mu + mu + 2*ml + 2);
    iopt[BAND_LIW] = N;
  }
  nstlj = 0;
  return(LINIT_OK);
}
static int CVBandInit ( CVodeMem cv_mem , boole * setupNonNull ) { CVBandMem cvband_mem ; cvband_mem = ( CVBandMem ) lmem ; if ( cvband_mem == NULL ) { fprintf ( errfp , MSG_MEM_FAIL ) ; return ( LINIT_ERR ) ; } * setupNonNull = TRUE ; if ( ( ml < 0 ) || ( mu < 0 ) || ( ml >= N ) || ( mu >= N ) ) { fprintf ( errfp , MSG_BAD_SIZES , ml , mu , N - 1 ) ; return ( LINIT_ERR ) ; } storage_mu = MIN ( N - 1 , mu + ml ) ; M = BandAllocMat ( N , mu , ml , storage_mu ) ; if ( M == NULL ) { fprintf ( errfp , MSG_MEM_FAIL ) ; return ( LINIT_ERR ) ; } savedJ = BandAllocMat ( N , mu , ml , mu ) ; if ( savedJ == NULL ) { fprintf ( errfp , MSG_MEM_FAIL ) ; BandFreeMat ( M ) ; return ( LINIT_ERR ) ; } pivots = BandAllocPiv ( N ) ; if ( pivots == NULL ) { fprintf ( errfp , MSG_MEM_FAIL ) ; BandFreeMat ( M ) ; BandFreeMat ( savedJ ) ; return ( LINIT_ERR ) ; } nje = 0 ; if ( iopt != NULL ) { iopt [ BAND_NJE ] = nje ; iopt [ BAND_LRW ] = N * ( storage_mu + mu + 2 * ml + 2 ) ; iopt [ BAND_LIW ] = N ; } nstlj = 0 ; return ( LINIT_OK ) ; }
CVBandInit 
This routine initializes remaining memory specific to the band
linear solver.
CVBandInit This routine initializes remaining memory specific to the band linear solver .
/* Print error message and return if cvband_mem is NULL */ /* Set flag setupNonNull = TRUE */ /* Test ml and mu for legality */ /* Set extended upper half-bandwith for M (required for pivoting) */ /* Allocate memory for M, savedJ, and pivot arrays */ /* Initialize nje and nstlj, and set workspace lengths */