QMCPACK
SolveFirstDerivInterp1D< double > Struct Template Reference
+ Collaboration diagram for SolveFirstDerivInterp1D< double >:

Static Public Member Functions

template<class CT >
static void apply (const CT &data, CT &p, int N, double *bcLower, double *bcUpper)
 

Detailed Description

template<>
struct SolveFirstDerivInterp1D< double >

Definition at line 134 of file BsplineOneDimSolvers.h.

Member Function Documentation

◆ apply()

static void apply ( const CT &  data,
CT &  p,
int  N,
double *  bcLower,
double *  bcUpper 
)
inlinestatic

Definition at line 137 of file BsplineOneDimSolvers.h.

References qmcplusplus::Units::force::N.

138  {
139  const double ratio = 0.25;
140  CT d(N + 2), mu(N + 2, ratio);
141  for (int i = 1; i <= N; i++)
142  d[i] = 1.5 * data[i - 1];
143  double al = 0.25 * bcLower[0];
144  double bl = 0.25 * bcLower[1];
145  double cl = 0.25 * bcLower[2];
146  double dl = 1.5 * bcLower[3];
147  double ar = 0.25 * bcUpper[0];
148  double br = 0.25 * bcUpper[1];
149  double cr = 0.25 * bcUpper[2];
150  double dr = 1.5 * bcUpper[3];
151  // First, eliminate leading coefficients
152  double alInv = 1.0 / al;
153  bl *= alInv;
154  cl *= alInv;
155  dl *= alInv;
156  d[0] = dl;
157  mu[0] = bl;
158  mu[1] = ratio - ratio * cl;
159  for (int row = 1; row <= N; row++)
160  {
161  double diag = 1.0 - mu[row - 1] * ratio;
162  double diagInv = 1.0 / diag;
163  mu[row] *= diagInv;
164  d[row] = diagInv * (d[row] - ratio * d[row - 1]);
165  }
166  br -= ar * mu[N - 1];
167  dr -= ar * d[N - 1];
168  cr -= br * mu[N];
169  dr -= br * d[N];
170  p[N + 1] = dr / cr;
171  // Now go back upward, back substituting
172  for (int row = N; row >= 1; row--)
173  p[row] = d[row] - mu[row] * p[row + 1];
174  // And do 0th row
175  p[0] = dl - bl * p[1] - cl * p[2];
176  }

The documentation for this struct was generated from the following file: