27 return x < 0.0 ? -1.0 : 1.0;
85 cerr <<
"Incompatible sizes in void "
86 <<
"void gauss_hermite (const dvector& _t,const dvector& _wts)" <<
endl;
99 zemu = 1.772453850905516;
100 for ( i = lb; i <= ub; i++ )
104 for ( i = lb; i <= ub; i++ )
106 bj(i) =
sqrt((i-lb+1)/2.0);
113 cout <<
"SGQF - Fatal error!\n";
114 cout <<
" ZEMU <= 0.\n";
119 for ( i = lb; i <= ub; i++ )
123 wts(lb) =
sqrt ( zemu );
124 for ( i = lb+1; i <= ub; i++ )
132 for ( i = lb; i <= ub; i++ )
134 wts(i) = wts(i) * wts(i);
199 cerr <<
"Incompatible sizes in void "
200 "mygauss_legendre(double a, double b, const dvector& _t, const dvector& _wts)"
230 zemu = 2.0 / ( ab + 1.0 );
231 for ( i = 0; i < nt; i++ )
235 for ( i = 1; i <= nt; i++ )
237 abi = i + ab * ( i % 2 );
239 bj[i-1] =
sqrt ( abi * abi / ( abj * abj - 1.0 ) );
246 cout <<
"Fatal error!\n";
247 cout <<
" ZEMU <= 0.\n";
252 for ( i = 0; i < nt; i++ )
256 wts[0] =
sqrt ( zemu );
257 for ( i = 1; i < nt; i++ )
265 for ( i = 0; i < nt; i++ )
267 wts[i] = wts[i] * wts[i];
273 for ( i = 0; i < nt; i++ )
278 for ( i = 0; i < nt; i++ )
289 if (
fabs ( b - a ) <= temp )
292 cout <<
"Fatal error!\n";
293 cout <<
" |B - A| too small.\n";
296 shft = ( a + b ) / 2.0;
297 slp = ( b - a ) / 2.0;
299 p =
pow ( slp, al + be + 1.0 );
301 for ( k = 0; k < nt; k++ )
303 st[k] = shft + slp * t[k];
309 for ( i = l - 1; i <= l - 1 + mlt[k] - 1; i++ )
311 swts[i] = wts[i] * tmp;
424 cerr <<
"Incompatible sizes in void "
425 <<
"imtqlx ( const dvector& _d, const dvector& _e, const dvector& _z )"
462 for ( l = 1; l <= n; l++ )
467 for ( m = l; m <= n; m++ )
474 if (
fabs ( e[m-1] ) <= prec * (
fabs ( d[m-1] ) +
fabs ( d[m] ) ) )
487 cout <<
"IMTQLX - Fatal error!\n";
488 cout <<
" Iteration limit exceeded\n";
492 g = ( d[l] - p ) / ( 2.0 * e[l-1] );
493 r =
sqrt ( g * g + 1.0 );
494 g = d[m-1] - p + e[l-1] / ( g +
fabs ( r ) *
sign ( g ) );
500 for ( ii = 1; ii <= mml; ii++ )
509 r =
sqrt ( c * c + 1.0 );
517 r =
sqrt ( s * s + 1.0 );
523 r = ( d[i-1] - g ) * s + 2.0 * c * b;
528 z[i] = s * z[i-1] + c * f;
529 z[i-1] = c * z[i-1] - s * f;
540 for ( ii = 2; ii <= m; ii++ )
546 for ( j = ii; j <= n; j++ )
d3_array elem_prod(const d3_array &a, const d3_array &b)
Returns d3_array results with computed elements product of a(i, j, k) * b(i, j, k).
Vector of double precision numbers.
int indexmin() const
Get minimum valid index.
void gauss_legendre(double x1, double x2, const dvector &_x, const dvector &_w)
Gauss-Legendre quadature.
void gauss_hermite(const dvector &_x, const dvector &_w)
Gauss-Hermite quadature.
df1_two_variable fabs(const df1_two_variable &x)
prnstream & endl(prnstream &)
Array of integers(int) with indexes from index_min to indexmax.
d3_array sqrt(const d3_array &arr3)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
int indexmax() const
Get maximum valid index.
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
void normalized_gauss_hermite(const dvector &_x, const dvector &_w)
Gauss-Hermite quadature.
d3_array exp(const d3_array &arr3)
Returns d3_array results with computed exp from elements in arr3.
dvector & shift(int min)
Shift valid range of subscripts.
void imtqlx(const dvector &_d, const dvector &_e, const dvector &_z)
Diagonalizes a symmetric tridiagonal matrix.
double sign(const double x)
The sign of a number.
double square(const double value)
Return square of value; constant object.
d3_array pow(const d3_array &m, int e)
Description not yet available.