|
static void | apply (const std::vector< double > &data, std::vector< double > &p) |
|
template<typename CT > |
static void | apply (const CT &data, CT &p, int N) |
|
template<>
struct SolvePeriodicInterp1D< double >
Definition at line 64 of file BsplineOneDimSolvers.h.
◆ apply() [1/2]
static void apply |
( |
const std::vector< double > & |
data, |
|
|
std::vector< double > & |
p |
|
) |
| |
|
inlinestatic |
◆ apply() [2/2]
static void apply |
( |
const CT & |
data, |
|
|
CT & |
p, |
|
|
int |
N |
|
) |
| |
|
inlinestatic |
Definition at line 72 of file BsplineOneDimSolvers.h.
References qmcplusplus::Units::force::N.
74 const double ratio = 0.25;
75 CT d(
N), gamma(
N), mu(
N);
76 for (
int i = 0; i <
N; i++)
83 for (
int row = 1; row < (
N - 1); row++)
85 double diag = 1.0 - mu[row - 1] * ratio;
86 double diagInv = 1.0 / diag;
87 gamma[row] = -ratio * gamma[row - 1] * diagInv;
88 mu[row] = diagInv * ratio;
89 d[row] = diagInv * (d[row] - ratio * d[row - 1]);
91 d[
N - 1] -= mu[
N - 1] * d[row - 1];
92 gamma[
N - 1] -= mu[
N - 1] * gamma[row - 1];
93 mu[
N - 1] = -mu[
N - 1] * mu[row - 1];
97 gamma[
N - 1] -= mu[
N - 1] * (mu[
N - 2] + gamma[
N - 2]);
98 d[
N - 1] -= mu[
N - 1] * d[
N - 2];
99 p[
N] = d[
N - 1] / gamma[
N - 1];
101 for (
int row =
N - 2; row >= 0; row--)
102 p[row + 1] = d[row] - mu[row] * p[row + 2] - gamma[row] * p[
N];
The documentation for this struct was generated from the following file: