7 #include <boost/core/ignore_unused.hpp>
13 #define EPS 100*DBL_EPSILON
15 #define sign(a,b) ((b)<0 ? -fabs(a) : fabs(a))
26 int m_digits =
static_cast<int>(fabs(floor(log10(DBL_EPSILON)))-1);
28 if (fabs(xl-xr)<1.e-4){
30 m_expn =
static_cast<int>(floor(log10(fabs(xl-xr))));
31 m_xln = xl*powl(10.0L,-m_expn)-floor(xl*powl(10.0L,-m_expn));
32 m_xrn = xr*powl(10.0L,-m_expn)-floor(xl*powl(10.0L,-m_expn));
33 m_xln = round(m_xln*powl(10.0L,m_digits+m_expn));
34 m_xrn = round(m_xrn*powl(10.0L,m_digits+m_expn));
36 return powl(10.0L,-m_digits)*(m_xln-m_xrn);
42 double laginterp(
double z,
int j,
const double *zj,
int np)
45 for (
int i=0; i<np; i++)
49 temp *=
optdiff(z,zj[i])/(zj[j]-zj[i]);
55 #define POLYNOMIAL_DEFLATION 0
57 #ifdef POLYNOMIAL_DEFLATION
59 #define jacobz(n,z,alpha,beta) Jacobz(n,z,alpha,beta)
62 #define jacobz(n,z,alpha,beta) JacZeros(n,z,alpha,beta)
68 static void Jacobz (
const int n,
double *z,
const double alpha,
73 static void TriQL(
const int,
double *,
double *,
double **);
74 double gammaF (
const double);
75 double gammaFracGammaF(
const int,
const double,
const int,
const double);
76 static void RecCoeff(
const int,
double *,
double *,
const double,
78 void JKMatrix(
int,
double *,
double *);
79 void chri1(
int,
double*,
double*,
double*,
double*,
double);
91 void zwgj (
double *z,
double *w,
const int np,
const double alpha,
95 double fac, one = 1.0, two = 2.0, apb = alpha + beta;
98 jacobd (np,z,w,np,alpha,beta);
103 for(i = 0; i < np; ++i) w[i] = fac/(w[i]*w[i]*(one-z[i]*z[i]));
119 void zwgrjm(
double *z,
double *w,
const int np,
const double alpha,
129 double fac, one = 1.0, two = 2.0, apb = alpha + beta;
132 jacobz (np-1,z+1,alpha,beta+1);
133 jacobfd (np,z,w,NULL,np-1,alpha,beta);
139 for(i = 0; i < np; ++i) w[i] = fac*(1-z[i])/(w[i]*w[i]);
140 w[0] *= (beta + one);
158 void zwgrjp(
double *z,
double *w,
const int np,
const double alpha,
168 double fac, one = 1.0, two = 2.0, apb = alpha + beta;
170 jacobz (np-1,z,alpha+1,beta);
172 jacobfd (np,z,w,NULL,np-1,alpha,beta);
178 for(i = 0; i < np; ++i) w[i] = fac*(1+z[i])/(w[i]*w[i]);
179 w[np-1] *= (alpha + one);
195 void zwglj(
double *z,
double *w,
const int np,
const double alpha,
212 double fac, one = 1.0, apb = alpha + beta, two = 2.0;
216 jacobz (np-2,z + 1,alpha + one,beta + one);
217 jacobfd (np,z,w,NULL,np-1,alpha,beta);
223 for(i = 0; i < np; ++i) w[i] = fac/(w[i]*w[i]);
224 w[0] *= (beta + one);
225 w[np-1] *= (alpha + one);
240 void zwgk(
double *z,
double *w,
const int npt ,
const double alpha,
249 int kpoints = 2*np + 1;
252 int ncoeffs = (int)floor(3.0*(np+1)/2);
257 double *a =
new double[kpoints];
258 double *b =
new double[kpoints];
261 for(i = 0; i < kpoints; i++)
274 double** zmatrix =
new double*[kpoints];
275 for(i = 0; i < kpoints; i++)
277 zmatrix[i] =
new double[kpoints];
278 for(j = 0; j < kpoints; j++)
283 for(i = 0; i < kpoints; i++)
289 TriQL(kpoints, a, b, zmatrix);
291 for(i = 0; i < kpoints; i++)
298 for (i = 0; i < kpoints; i++)
313 void zwrk(
double* z,
double* w,
const int npt ,
const double alpha,
321 fprintf(stderr,
"too few points in formula\n");
333 int ncoeffs = (int)ceil(3.0*np/2);
336 double *a =
new double[ncoeffs+1];
337 double *b =
new double[ncoeffs+1];
340 for(i = 0; i < ncoeffs+1; i++)
349 double* a0 =
new double[ncoeffs];
350 double* b0 =
new double[ncoeffs];
352 chri1(ncoeffs,a,b,a0,b0,end0);
354 double s = b0[0]/fabs(b0[0]);
358 double* z1 =
new double[2*np-1];
359 double* w1 =
new double[2*np-1];
360 for(i = 0; i < ncoeffs; i++)
367 double** zmatrix =
new double*[2*np-1];
368 for(i = 0; i < 2*np-1; i++)
370 zmatrix[i] =
new double[2*np-1];
371 for(j = 0; j < 2*np-1; j++)
376 for(i = 0; i < 2*np-1; i++)
382 TriQL(2*np-1, z1, w1, zmatrix);
385 for(i = 0; i < 2*np-1; i++)
387 w1[i] = s*w1[i]/(z1[i]-end0);
393 for(i = 1; i < kpoints; i++)
406 for(i = 0; i < 2*np-1; i++)
420 void zwlk(
double* z,
double* w,
const int npt,
421 const double alpha,
const double beta)
428 fprintf (stderr,
"too few points in formula\n");
437 int kpoints = 2*np-1;
440 int ncoeffs = (int)ceil(3.0*np/2)-1;
443 double *a =
new double[ncoeffs+1];
444 double *b =
new double[ncoeffs+1];
447 for(i = 0; i < ncoeffs+1; i++)
457 double* a0 =
new double[ncoeffs];
458 double* b0 =
new double[ncoeffs];
460 chri1(ncoeffs,a,b,a0,b0,endl);
462 double* a1 =
new double[ncoeffs-1];
463 double* b1 =
new double[ncoeffs-1];
465 chri1(ncoeffs-1,a0,b0,a1,b1,endr);
468 double s = b1[0]/fabs(b1[0]);
472 double* z1 =
new double[2*np-3];
473 double* w1 =
new double[2*np-3];
474 for(i = 0; i < ncoeffs; i++)
481 double** zmatrix =
new double*[2*np-3];
482 for(i = 0; i < 2*np-3; i++)
484 zmatrix[i] =
new double[2*np-3];
485 for(j = 0; j < 2*np-3; j++)
490 for(i = 0; i < 2*np-3; i++)
496 TriQL(2*np-3, z1, w1, zmatrix);
499 double sumW1Z1 = 0.0;
500 for(i = 0; i < 2*np-3; i++)
502 w1[i] = s*w1[i]/(z1[i]-endl)/(z1[i]-endr);
504 sumW1Z1 += z1[i]*w1[i];
507 double c0 = b[0]-sumW1;
508 double c1 = a[0]*b[0]-sumW1Z1;
512 w[0] = (c0*endr-c1)/(endr-endl);
513 w[2*np-2] = (c1-c0*endl)/(endr-endl);
515 for(i = 1; i < kpoints-1; i++)
528 for(i = 0; i < 2*np-3; i++)
546 void Dgj(
double *D,
const double *z,
const int np,
const double alpha,
550 double one = 1.0, two = 2.0;
559 pd = (
double *)malloc(np*
sizeof(
double));
560 jacobd(np,z,pd,np,alpha,beta);
562 for (i = 0; i < np; i++){
563 for (j = 0; j < np; j++){
566 D[i*np+j] = pd[j]/(pd[i]*(z[j]-z[i]));
568 D[i*np+j] = (alpha - beta + (alpha + beta + two)*z[j])/
569 (two*(one - z[j]*z[j]));
589 void Dgrjm(
double *D,
const double *z,
const int np,
const double alpha,
598 double one = 1.0, two = 2.0;
601 pd = (
double *)malloc(np*
sizeof(
double));
604 pd[0] /=
gammaF(beta+two);
605 jacobd(np-1,z+1,pd+1,np-1,alpha,beta+1);
606 for(i = 1; i < np; ++i) pd[i] *= (1+z[i]);
608 for (i = 0; i < np; i++) {
609 for (j = 0; j < np; j++){
611 D[i*np+j] = pd[j]/(pd[i]*(z[j]-z[i]));
614 D[i*np+j] = -(np + alpha + beta + one)*(np - one)/
617 D[i*np+j] = (alpha - beta + one + (alpha + beta + one)*z[j])/
618 (two*(one - z[j]*z[j]));
639 void Dgrjp(
double *D,
const double *z,
const int np,
const double alpha,
648 double one = 1.0, two = 2.0;
651 pd = (
double *)malloc(np*
sizeof(
double));
654 jacobd(np-1,z,pd,np-1,alpha+1,beta);
655 for(i = 0; i < np-1; ++i) pd[i] *= (1-z[i]);
657 pd[np-1] /=
gammaF(alpha+two);
659 for (i = 0; i < np; i++) {
660 for (j = 0; j < np; j++){
662 D[i*np+j] = pd[j]/(pd[i]*(z[j]-z[i]));
665 D[i*np+j] = (np + alpha + beta + one)*(np - one)/
668 D[i*np+j] = (alpha - beta - one + (alpha + beta + one)*z[j])/
669 (two*(one - z[j]*z[j]));
690 void Dglj(
double *D,
const double *z,
const int np,
const double alpha,
698 double one = 1.0, two = 2.0;
701 pd = (
double *)malloc(np*
sizeof(
double));
704 pd[0] /=
gammaF(beta + two);
705 jacobd(np-2,z+1,pd+1,np-2,alpha+1,beta+1);
706 for(i = 1; i < np-1; ++i) pd[i] *= (one-z[i]*z[i]);
708 pd[np-1] /=
gammaF(alpha + two);
710 for (i = 0; i < np; i++) {
711 for (j = 0; j < np; j++){
713 D[i*np+j] = pd[j]/(pd[i]*(z[j]-z[i]));
716 D[i*np+j] = (alpha - (np-1)*(np + alpha + beta))/(two*(beta+ two));
718 D[i*np+j] =-(beta - (np-1)*(np + alpha + beta))/(two*(alpha+ two));
720 D[i*np+j] = (alpha - beta + (alpha + beta)*z[j])/
721 (two*(one - z[j]*z[j]));
752 double hgj (
const int i,
const double z,
const double *zgj,
753 const int np,
const double alpha,
const double beta)
755 boost::ignore_unused(alpha, beta);
760 if (fabs(dz) <
EPS)
return 1.0;
787 double hgrjm (
const int i,
const double z,
const double *zgrj,
const int np,
788 const double alpha,
const double beta)
790 boost::ignore_unused(alpha, beta);
796 if (fabs(dz) <
EPS)
return 1.0;
823 double hgrjp (
const int i,
const double z,
const double *zgrj,
const int np,
824 const double alpha,
const double beta)
826 boost::ignore_unused(alpha, beta);
831 if (fabs(dz) <
EPS)
return 1.0;
858 double hglj (
const int i,
const double z,
const double *zglj,
const int np,
859 const double alpha,
const double beta)
861 boost::ignore_unused(alpha, beta);
867 if (fabs(dz) <
EPS)
return 1.0;
887 void Imgj(
double *im,
const double *zgj,
const double *zm,
const int nz,
888 const int mz,
const double alpha,
const double beta){
892 for (i = 0; i < nz; ++i) {
893 for (j = 0; j < mz; ++j)
896 im [i*mz+j] =
hgj(i, zp, zgj, nz, alpha, beta);
916 void Imgrjm(
double *im,
const double *zgrj,
const double *zm,
const int nz,
917 const int mz,
const double alpha,
const double beta)
922 for (i = 0; i < nz; i++) {
923 for (j = 0; j < mz; j++)
926 im [i*mz+j] =
hgrjm(i, zp, zgrj, nz, alpha, beta);
946 void Imgrjp(
double *im,
const double *zgrj,
const double *zm,
const int nz,
947 const int mz,
const double alpha,
const double beta)
952 for (i = 0; i < nz; i++) {
953 for (j = 0; j < mz; j++)
956 im [i*mz+j] =
hgrjp(i, zp, zgrj, nz, alpha, beta);
977 void Imglj(
double *im,
const double *zglj,
const double *zm,
const int nz,
978 const int mz,
const double alpha,
const double beta)
983 for (i = 0; i < nz; i++) {
984 for (j = 0; j < mz; j++)
987 im[i*mz+j] =
hglj(i, zp, zglj, nz, alpha, beta);
1034 void jacobfd(
const int np,
const double *z,
double *poly_in,
double *polyd,
1035 const int n,
const double alpha,
const double beta){
1037 double zero = 0.0, one = 1.0, two = 2.0;
1044 for(i = 0; i < np; ++i)
1047 for(i = 0; i < np; ++i)
1052 for(i = 0; i < np; ++i)
1053 poly_in[i] = 0.5*(alpha - beta + (alpha + beta + two)*z[i]);
1055 for(i = 0; i < np; ++i)
1056 polyd[i] = 0.5*(alpha + beta + two);
1061 double two = 2.0, apb = alpha + beta;
1062 double *poly, *polyn1,*polyn2;
1065 polyn1 = (
double *)malloc(2*np*
sizeof(
double));
1070 polyn1 = (
double *)malloc(3*np*
sizeof(
double));
1075 for(i = 0; i < np; ++i){
1077 polyn1[i] = 0.5*(alpha - beta + (alpha + beta + two)*z[i]);
1080 for(k = 2; k <= n; ++k){
1081 a1 = two*k*(k + apb)*(two*k + apb - two);
1082 a2 = (two*k + apb - one)*(alpha*alpha - beta*beta);
1083 a3 = (two*k + apb - two)*(two*k + apb - one)*(two*k + apb);
1084 a4 = two*(k + alpha - one)*(k + beta - one)*(two*k + apb);
1090 for(i = 0; i < np; ++i){
1091 poly [i] = (a2 + a3*z[i])*polyn1[i] - a4*polyn2[i];
1092 polyn2[i] = polyn1[i];
1093 polyn1[i] = poly [i];
1098 a1 = n*(alpha - beta);
1099 a2 = n*(two*n + alpha + beta);
1100 a3 = two*(n + alpha)*(n + beta);
1101 a4 = (two*n + alpha + beta);
1102 a1 /= a4; a2 /= a4; a3 /= a4;
1105 for(i = 0; i < np; ++i){
1106 polyd[i] = (a1- a2*z[i])*poly[i] + a3*polyn2[i];
1107 polyd[i] /= (one - z[i]*z[i]);
1134 void jacobd(
const int np,
const double *z,
double *polyd,
const int n,
1135 const double alpha,
const double beta)
1140 for(i = 0; i < np; ++i) polyd[i] = 0.0;
1143 jacobfd(np,z,polyd,NULL,n-1,alpha+one,beta+one);
1144 for(i = 0; i < np; ++i) polyd[i] *= 0.5*(alpha + beta + (
double)n + one);
1164 if (x == -0.5) gamma = -2.0*
sqrt(M_PI);
1165 else if (!x)
return gamma;
1166 else if ((x-(
int)x) == 0.5){
1176 else if ((x-(
int)x) == 0.0){
1186 fprintf(stderr,
"%lf is not of integer or half order\n",x);
1205 double halfa = fabs(alpha -
int(alpha));
1206 double halfb = fabs(beta -
int(beta ));
1207 if (halfa == 0.0 && halfb == 0.0)
1213 for(
int tmp=X-1; tmp > Y-1; tmp-=1)
1218 for(
int tmp=Y-1; tmp > X-1; tmp-=1)
1223 else if (halfa == 0.5 && halfb == 0.5)
1225 double X = x + alpha;
1226 double Y = y + beta;
1229 for(
int tmp=
int(X); tmp > int(Y); tmp-=1)
1234 for(
int tmp=
int(Y); tmp > int(X); tmp-=1)
1241 double X = x + alpha;
1242 double Y = y + beta;
1258 gamma *=
sqrt(M_PI);
1262 gamma /=
sqrt(M_PI);
1266 fprintf(stderr,
"%lf or %lf is not of integer or half order\n",X, Y);
1281 static void Jacobz(
const int n,
double *z,
const double alpha,
1284 double dth = M_PI/(2.0*(double)n);
1285 double poly,pder,rlast=0.0;
1287 double one = 1.0, two = 2.0;
1292 for(k = 0; k < n; ++k){
1293 r = -cos((two*(
double)k + one) * dth);
1294 if(k) r = 0.5*(r + rlast);
1296 for(j = 1; j <
STOP; ++j){
1297 jacobfd(1,&r,&poly, &pder, n, alpha, beta);
1299 for(i = 0, sum = 0.0; i < k; ++i) sum += one/(r - z[i]);
1301 delr = -poly / (pder - sum * poly);
1303 if( fabs(delr) <
EPS )
break;
1336 void JacZeros(
const int n,
double *a,
double*b,
const double alpha,
1342 double **z =
new double*[n];
1343 for(i = 0; i < n; i++)
1345 z[i] =
new double[n];
1346 for(j = 0; j < n; j++)
1351 for(i = 0; i < n; i++)
1367 static void RecCoeff(
const int n,
double *a,
double *b,
const double alpha,
1371 double apb, apbi,a2b2;
1381 a[0] = (beta-alpha)/apbi;
1382 b[1] = (4.0*(1.0+alpha)*(1.0+beta)/((apbi+1.0)*apbi*apbi));
1384 a2b2 = beta*beta-alpha*alpha;
1386 for(i = 1; i < n-1; i++){
1387 apbi = 2.0*(i+1) + apb;
1388 a[i] = a2b2/((apbi-2.0)*apbi);
1389 b[i+1] = (4.0*(i+1)*(i+1+alpha)*(i+1+beta)*(i+1+apb)/
1390 ((apbi*apbi-1)*apbi*apbi));
1394 a[n-1] = a2b2/((apbi-2.0)*apbi);
1425 static void TriQL(
const int n,
double *d,
double *e,
double **z){
1427 double s,r,
p,g,f,dd,c,b;
1429 double MuZero = e[0];
1432 for(i = 0; i < n-1; i++)
1434 e[i] =
sqrt(e[i+1]);
1442 for (m=l;m<n-1;m++) {
1443 dd=fabs(d[m])+fabs(d[m+1]);
1444 if (fabs(e[m])+dd == dd)
break;
1447 if (iter++ ==
STOP){
1448 fprintf(stderr,
"triQL: Too many iterations in TQLI");
1451 g=(d[l+1]-d[l])/(2.0*e[l]);
1453 g=d[m]-d[l]+e[l]/(g+
sign(r,g));
1456 for (i=m-1;i>=l;i--) {
1459 if (fabs(f) >= fabs(g)) {
1471 r=(d[i]-g)*s+2.0*c*b;
1477 for(k = 0; k < n; k++)
1480 z[k][i+1] = s*z[k][i] + c*f;
1481 z[k][i] = c*z[k][i] - s*f;
1495 for(i = 0; i < n-1; ++i){
1498 for(l = i+1; l < n; ++l)
1506 double temp = z[0][k];
1512 for(i =0 ; i < n; i++)
1514 e[i] = MuZero*z[0][i]*z[0][i];
1531 int size = (int)floor(n/2.0)+2;
1532 double *s =
new double[size];
1533 double *t =
new double[size];
1536 for(i = 0; i < size; i++)
1543 for(m = 0; m <= n-2; m++)
1546 for(k = (
int)floor((m+1)/2.0); k >= 0; k--)
1549 u = u+(a[k+n+1]-a[l])*t[k+1] + b[k+n+1]*s[k] - b[l]*s[k+1];
1560 for(j = (
int)floor(n/2.0); j >= 0; j--)
1565 for(m = n-1; m <= 2*n-3; m++)
1568 for(k = m+1-n; k <= floor((m-1)/2.0); k++)
1572 u = u-(a[k+n+1]-a[l])*t[j+1] - b[k+n+1]*s[j+1] + b[l]*s[j+2];
1579 a[k+n+1] = a[k] + (s[j+1]-b[k+n+1]*s[j+2])/t[j+2];
1584 b[k+n+1] = s[j+1]/s[j+2];
1594 a[2*n ] = a[n-1]-b[2*n]*s[1]/t[1];
1608 void chri1(
int n,
double* a,
double* b,
double* a0,
1609 double* b0,
double z)
1612 double q = ceil(3.0*n/2);
1613 int size = (int)q+1;
1616 fprintf(stderr,
"input arrays a and b are too short\n");
1618 double* r =
new double[n+1];
1620 r[1] = z - a[1] - b[1]/r[0];
1621 a0[0] = a[1] + r[1] - r[0];
1630 for(k = 1; k < n; k++)
1632 r[k+1] = z - a[k+1] - b[k+1]/r[k];
1633 a0[k] = a[k+1] + r[k+1] - r[k];
1634 b0[k] = b[k] * r[k]/r[k-1];
1651 std::complex<Nektar::NekDouble>
ImagBesselComp(
int n,std::complex<Nektar::NekDouble> y)
1653 std::complex<Nektar::NekDouble> z (1.0,0.0);
1654 std::complex<Nektar::NekDouble> zbes (1.0,0.0);
1655 std::complex<Nektar::NekDouble> zarg;
1662 while (
abs(z) > tol && i <= maxit){
1663 z = z*(1.0/i/(i+n)*zarg);
1664 if (
abs(z) <= tol)
break;
#define jacobz(n, z, alpha, beta)
zero determination using Newton iteration with polynomial deflation
#define sign(a, b)
return the sign(b)*a
#define EPS
Precision tolerance for two points to be similar.
#define STOP
Maximum number of iterations in polynomial defalation routine Jacobz.
The namespace associated with the the Polylib library (Polylib introduction)
double gammaF(const double)
Calculate the Gamma function , , for integer values and halves.
void Dgj(double *D, const double *z, const int np, const double alpha, const double beta)
Compute the Derivative Matrix and its transpose associated with the Gauss-Jacobi zeros.
void zwgrjm(double *z, double *w, const int np, const double alpha, const double beta)
Gauss-Radau-Jacobi zeros and weights with end point at z=-1.
void JacZeros(const int n, double *a, double *b, const double alpha, const double beta)
Zero and Weight determination through the eigenvalues and eigenvectors of a tridiagonal matrix from t...
void zwgrjp(double *z, double *w, const int np, const double alpha, const double beta)
Gauss-Radau-Jacobi zeros and weights with end point at z=1.
double laginterp(double z, int j, const double *zj, int np)
void chri1(int, double *, double *, double *, double *, double)
Given a weight function through the first n+1 coefficients a and b of its orthogonal polynomials thi...
void Dglj(double *D, const double *z, const int np, const double alpha, const double beta)
Compute the Derivative Matrix associated with the Gauss-Lobatto-Jacobi zeros.
void Imgrjp(double *im, const double *zgrj, const double *zm, const int nz, const int mz, const double alpha, const double beta)
Interpolation Operator from Gauss-Radau-Jacobi points (including z=1) to an arbitrary distrubtion at ...
void zwglj(double *z, double *w, const int np, const double alpha, const double beta)
Gauss-Lobatto-Jacobi zeros and weights with end point at z=-1,1.
void zwgj(double *z, double *w, const int np, const double alpha, const double beta)
Gauss-Jacobi zeros and weights.
void Imgj(double *im, const double *zgj, const double *zm, const int nz, const int mz, const double alpha, const double beta)
Interpolation Operator from Gauss-Jacobi points to an arbitrary distribution at points zm.
static void RecCoeff(const int, double *, double *, const double, const double)
The routine finds the recurrence coefficients a and b of the orthogonal polynomials.
double hgrjm(const int i, const double z, const double *zgrj, const int np, const double alpha, const double beta)
Compute the value of the i th Lagrangian interpolant through the np Gauss-Radau-Jacobi points zgrj at...
double gammaFracGammaF(const int, const double, const int, const double)
Calculate fraction of two Gamma functions, , for integer values and halves.
static void TriQL(const int, double *, double *, double **)
QL algorithm for symmetric tridiagonal matrix.
static void Jacobz(const int n, double *z, const double alpha, const double beta)
Calculate the n zeros, z, of the Jacobi polynomial, i.e. .
double hgj(const int i, const double z, const double *zgj, const int np, const double alpha, const double beta)
Compute the value of the i th Lagrangian interpolant through the np Gauss-Jacobi points zgj at the ar...
void Imgrjm(double *im, const double *zgrj, const double *zm, const int nz, const int mz, const double alpha, const double beta)
Interpolation Operator from Gauss-Radau-Jacobi points (including z=-1) to an arbitrary distrubtion at...
void zwgk(double *z, double *w, const int npt, const double alpha, const double beta)
Gauss-Kronrod-Jacobi zeros and weights.
void Dgrjm(double *D, const double *z, const int np, const double alpha, const double beta)
Compute the Derivative Matrix and its transpose associated with the Gauss-Radau-Jacobi zeros with a z...
std::complex< Nektar::NekDouble > ImagBesselComp(int n, std::complex< Nektar::NekDouble > y)
Calcualte the bessel function of the first kind with complex double input y. Taken from Numerical Rec...
void Dgrjp(double *D, const double *z, const int np, const double alpha, const double beta)
Compute the Derivative Matrix associated with the Gauss-Radau-Jacobi zeros with a zero at z=1.
double hgrjp(const int i, const double z, const double *zgrj, const int np, const double alpha, const double beta)
Compute the value of the i th Lagrangian interpolant through the np Gauss-Radau-Jacobi points zgrj at...
void zwrk(double *z, double *w, const int npt, const double alpha, const double beta)
Gauss-Radau-Kronrod-Jacobi zeros and weights.
double hglj(const int i, const double z, const double *zglj, const int np, const double alpha, const double beta)
Compute the value of the i th Lagrangian interpolant through the np Gauss-Lobatto-Jacobi points zgrj ...
void Imglj(double *im, const double *zglj, const double *zm, const int nz, const int mz, const double alpha, const double beta)
Interpolation Operator from Gauss-Lobatto-Jacobi points to an arbitrary distrubtion at points zm.
void jacobd(const int np, const double *z, double *polyd, const int n, const double alpha, const double beta)
Calculate the derivative of Jacobi polynomials.
double optdiff(double xl, double xr)
The following function is used to circumvent/reduce "Subtractive Cancellation" The expression 1/dz is...
void jacobfd(const int np, const double *z, double *poly_in, double *polyd, const int n, const double alpha, const double beta)
Routine to calculate Jacobi polynomials, , and their first derivative, .
void JKMatrix(int, double *, double *)
Calcualtes the Jacobi-kronrod matrix by determining the a and coefficients.
void zwlk(double *z, double *w, const int npt, const double alpha, const double beta)
Gauss-Lobatto-Kronrod-Jacobi zeros and weights.
scalarT< T > abs(scalarT< T > in)
scalarT< T > sqrt(scalarT< T > in)