26 #if defined (HAVE_CONFIG_H)
79 double y =
x - root[j];
81 dif3[i] = y * dif3[i] + 3.0 * dif2[i];
82 dif2[i] = y * dif2[i] + 2.0 * dif1[i];
83 dif1[i] = y * dif1[i];
151 double alpha,
double beta,
double *dif1,
double *dif2,
152 double *dif3,
double *root)
154 assert (n0 == 0 || n0 == 1);
155 assert (n1 == 0 || n1 == 1);
164 double ab = alpha + beta;
165 double ad = beta - alpha;
166 double ap = beta * alpha;
168 dif1[0] = (ad / (ab + 2.0) + 1.0) / 2.0;
176 double z = ab + 2 * z1;
178 dif1[i] = (ab * ad / z / (z + 2.0) + 1.0) / 2.0;
181 dif2[i] = (ab + ap + z1) / z / z / (z + 1.0);
185 double y = z1 * (ab + z1);
187 dif2[i] = y / z / (z - 1.0);
212 double xp = (dif1[j] -
x) * xn - dif2[j] * xd;
213 double xp1 = (dif1[j] -
x) * xn1 - dif2[j] * xd1 - xn;
227 zc -= z / (
x - root[j-1]);
239 if (
std::abs (z) <= 100 * std::numeric_limits<double>::epsilon ())
244 x += std::sqrt (std::numeric_limits<double>::epsilon ());
260 dif (nt, root, dif1, dif2, dif3);
314 double *dif2,
double *dif3,
double *root,
double *vect)
316 assert (n0 == 0 || n0 == 1);
317 assert (n1 == 0 || n1 == 1);
323 assert (
id == 1 ||
id == 2 ||
id == 3);
326 assert (i >= 0 && i < nt);
338 vect[i] = dif2[i] / dif1[i] / 2.0;
340 vect[i] = dif3[i] / dif1[i] / 3.0;
344 double y = root[i] - root[j];
346 vect[j] = dif1[i] / dif1[j] / y;
349 vect[j] = vect[j] * (dif2[i] / dif1[i] - 2.0 / y);
361 double ax =
x * (1.0 -
x);
367 ax = ax / (1.0 -
x) / (1.0 -
x);
369 vect[j] = ax / (dif1[j] * dif1[j]);
375 vect[j] = vect[j] / y;
384 (*current_liboctave_error_handler) (
"CollocWt: fatal error '%s'", msg);
391 error (
"CollocWt: left bound greater than right bound");
402 error (
"CollocWt: right bound less than left bound");
414 double wid =
rb -
lb;
417 error (
"CollocWt: width less than or equal to zero");
424 error (
"CollocWt: total number of collocation points less than zero");
450 error (
"jcobi: newton iteration failed");
489 os <<
"left boundary is included\n";
491 os <<
"left boundary is not included\n";
494 os <<
"right boundary is included\n";
496 os <<
"right boundary is not included\n";
static bool jcobi(octave_idx_type n, octave_idx_type n0, octave_idx_type n1, double alpha, double beta, double *dif1, double *dif2, double *dif3, double *root)
std::ostream & operator<<(std::ostream &os, const CollocWt &a)
static void dfopr(octave_idx_type n, octave_idx_type n0, octave_idx_type n1, octave_idx_type i, octave_idx_type id, double *dif1, double *dif2, double *dif3, double *root, double *vect)
static void dif(octave_idx_type nt, double *root, double *dif1, double *dif2, double *dif3)
const T * fortran_vec(void) const
Size of the specified dimension.
octave_idx_type right_included(void) const
void error(const char *msg)
octave_idx_type left_included(void) const
CollocWt & set_left(double val)
octave_idx_type inc_right
CollocWt & set_right(double val)
void resize(octave_idx_type n, const double &rfv=0)
void resize(octave_idx_type nr, octave_idx_type nc, double rfv=0)
Vector representing the dimensions (size) of an Array.
F77_RET_T const F77_DBLE * x