8 #include <boost/core/ignore_unused.hpp> 14 #define EPS 100*DBL_EPSILON 16 #define sign(a,b) ((b)<0 ? -fabs(a) : fabs(a)) 27 int m_digits =
static_cast<int>(fabs(floor(log10(DBL_EPSILON)))-1);
29 if (fabs(xl-xr)<1.e-4){
31 m_expn =
static_cast<int>(floor(log10(fabs(xl-xr))));
32 m_xln = xl*powl(10.0
L,-m_expn)-floor(xl*powl(10.0
L,-m_expn));
33 m_xrn = xr*powl(10.0
L,-m_expn)-floor(xl*powl(10.0
L,-m_expn));
34 m_xln = round(m_xln*powl(10.0
L,m_digits+m_expn));
35 m_xrn = round(m_xrn*powl(10.0
L,m_digits+m_expn));
37 return powl(10.0
L,-m_digits)*(m_xln-m_xrn);
43 double laginterp(
double z,
int j,
const double *zj,
int np)
46 for (
int i=0; i<np; i++)
50 temp *=
optdiff(z,zj[i])/(zj[j]-zj[i]);
56 #define POLYNOMIAL_DEFLATION 0 58 #ifdef POLYNOMIAL_DEFLATION 60 #define jacobz(n,z,alpha,beta) Jacobz(n,z,alpha,beta) 63 #define jacobz(n,z,alpha,beta) JacZeros(n,z,alpha,beta) 69 static void Jacobz (
const int n,
double *z,
const double alpha,
74 static void TriQL(
const int,
double *,
double *,
double **);
75 double gammaF (
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);
100 fac = pow(two,apb + one)*
gammaF(alpha + np + one)*
gammaF(beta + np + one);
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);
135 fac = pow(two,apb)*
gammaF(alpha + np)*
gammaF(beta + np);
138 for(i = 0; i < np; ++i) w[i] = fac*(1-z[i])/(w[i]*w[i]);
139 w[0] *= (beta + one);
157 void zwgrjp(
double *z,
double *w,
const int np,
const double alpha,
167 double fac, one = 1.0, two = 2.0, apb = alpha + beta;
169 jacobz (np-1,z,alpha+1,beta);
171 jacobfd (np,z,w,NULL,np-1,alpha,beta);
173 fac = pow(two,apb)*
gammaF(alpha + np)*
gammaF(beta + np);
176 for(i = 0; i < np; ++i) w[i] = fac*(1+z[i])/(w[i]*w[i]);
177 w[np-1] *= (alpha + one);
193 void zwglj(
double *z,
double *w,
const int np,
const double alpha,
210 double fac, one = 1.0, apb = alpha + beta, two = 2.0;
214 jacobz (np-2,z + 1,alpha + one,beta + one);
215 jacobfd (np,z,w,NULL,np-1,alpha,beta);
217 fac = pow(two,apb + 1)*
gammaF(alpha + np)*
gammaF(beta + np);
218 fac /= (np-1)*
gammaF(np)*
gammaF(alpha + beta + np + one);
220 for(i = 0; i < np; ++i) w[i] = fac/(w[i]*w[i]);
221 w[0] *= (beta + one);
222 w[np-1] *= (alpha + one);
237 void zwgk(
double *z,
double *w,
const int npt ,
const double alpha,
246 int kpoints = 2*np + 1;
249 int ncoeffs = (int)floor(3.0*(np+1)/2);
254 double *a =
new double[kpoints];
255 double *b =
new double[kpoints];
258 for(i = 0; i < kpoints; i++)
271 double** zmatrix =
new double*[kpoints];
272 for(i = 0; i < kpoints; i++)
274 zmatrix[i] =
new double[kpoints];
275 for(j = 0; j < kpoints; j++)
280 for(i = 0; i < kpoints; i++)
286 TriQL(kpoints, a, b, zmatrix);
288 for(i = 0; i < kpoints; i++)
295 for (i = 0; i < kpoints; i++)
310 void zwrk(
double* z,
double* w,
const int npt ,
const double alpha,
318 fprintf(stderr,
"too few points in formula\n");
330 int ncoeffs = (int)ceil(3.0*np/2);
333 double *a =
new double[ncoeffs+1];
334 double *b =
new double[ncoeffs+1];
337 for(i = 0; i < ncoeffs+1; i++)
346 double* a0 =
new double[ncoeffs];
347 double* b0 =
new double[ncoeffs];
349 chri1(ncoeffs,a,b,a0,b0,end0);
351 double s = b0[0]/fabs(b0[0]);
355 double* z1 =
new double[2*np-1];
356 double* w1 =
new double[2*np-1];
357 for(i = 0; i < ncoeffs; i++)
364 double** zmatrix =
new double*[2*np-1];
365 for(i = 0; i < 2*np-1; i++)
367 zmatrix[i] =
new double[2*np-1];
368 for(j = 0; j < 2*np-1; j++)
373 for(i = 0; i < 2*np-1; i++)
379 TriQL(2*np-1, z1, w1, zmatrix);
382 for(i = 0; i < 2*np-1; i++)
384 w1[i] = s*w1[i]/(z1[i]-end0);
390 for(i = 1; i < kpoints; i++)
403 for(i = 0; i < 2*np-1; i++)
417 void zwlk(
double* z,
double* w,
const int npt,
418 const double alpha,
const double beta)
425 fprintf (stderr,
"too few points in formula\n");
434 int kpoints = 2*np-1;
437 int ncoeffs = (int)ceil(3.0*np/2)-1;
440 double *a =
new double[ncoeffs+1];
441 double *b =
new double[ncoeffs+1];
444 for(i = 0; i < ncoeffs+1; i++)
454 double* a0 =
new double[ncoeffs];
455 double* b0 =
new double[ncoeffs];
457 chri1(ncoeffs,a,b,a0,b0,endl);
459 double* a1 =
new double[ncoeffs-1];
460 double* b1 =
new double[ncoeffs-1];
462 chri1(ncoeffs-1,a0,b0,a1,b1,endr);
465 double s = b1[0]/fabs(b1[0]);
469 double* z1 =
new double[2*np-3];
470 double* w1 =
new double[2*np-3];
471 for(i = 0; i < ncoeffs; i++)
478 double** zmatrix =
new double*[2*np-3];
479 for(i = 0; i < 2*np-3; i++)
481 zmatrix[i] =
new double[2*np-3];
482 for(j = 0; j < 2*np-3; j++)
487 for(i = 0; i < 2*np-3; i++)
493 TriQL(2*np-3, z1, w1, zmatrix);
496 double sumW1Z1 = 0.0;
497 for(i = 0; i < 2*np-3; i++)
499 w1[i] = s*w1[i]/(z1[i]-endl)/(z1[i]-endr);
501 sumW1Z1 += z1[i]*w1[i];
504 double c0 = b[0]-sumW1;
505 double c1 = a[0]*b[0]-sumW1Z1;
509 w[0] = (c0*endr-c1)/(endr-endl);
510 w[2*np-2] = (c1-c0*endl)/(endr-endl);
512 for(i = 1; i < kpoints-1; i++)
525 for(i = 0; i < 2*np-3; i++)
543 void Dgj(
double *D,
const double *z,
const int np,
const double alpha,
547 double one = 1.0, two = 2.0;
556 pd = (
double *)malloc(np*
sizeof(
double));
557 jacobd(np,z,pd,np,alpha,beta);
559 for (i = 0; i < np; i++){
560 for (j = 0; j < np; j++){
563 D[i*np+j] = pd[j]/(pd[i]*(z[j]-z[i]));
565 D[i*np+j] = (alpha - beta + (alpha + beta + two)*z[j])/
566 (two*(one - z[j]*z[j]));
586 void Dgrjm(
double *D,
const double *z,
const int np,
const double alpha,
595 double one = 1.0, two = 2.0;
598 pd = (
double *)malloc(np*
sizeof(
double));
600 pd[0] = pow(-one,np-1)*
gammaF(np+beta+one);
602 jacobd(np-1,z+1,pd+1,np-1,alpha,beta+1);
603 for(i = 1; i < np; ++i) pd[i] *= (1+z[i]);
605 for (i = 0; i < np; i++) {
606 for (j = 0; j < np; j++){
608 D[i*np+j] = pd[j]/(pd[i]*(z[j]-z[i]));
611 D[i*np+j] = -(np + alpha + beta + one)*(np - one)/
614 D[i*np+j] = (alpha - beta + one + (alpha + beta + one)*z[j])/
615 (two*(one - z[j]*z[j]));
636 void Dgrjp(
double *D,
const double *z,
const int np,
const double alpha,
645 double one = 1.0, two = 2.0;
648 pd = (
double *)malloc(np*
sizeof(
double));
651 jacobd(np-1,z,pd,np-1,alpha+1,beta);
652 for(i = 0; i < np-1; ++i) pd[i] *= (1-z[i]);
653 pd[np-1] = -
gammaF(np+alpha+one);
656 for (i = 0; i < np; i++) {
657 for (j = 0; j < np; j++){
659 D[i*np+j] = pd[j]/(pd[i]*(z[j]-z[i]));
662 D[i*np+j] = (np + alpha + beta + one)*(np - one)/
665 D[i*np+j] = (alpha - beta - one + (alpha + beta + one)*z[j])/
666 (two*(one - z[j]*z[j]));
687 void Dglj(
double *D,
const double *z,
const int np,
const double alpha,
695 double one = 1.0, two = 2.0;
698 pd = (
double *)malloc(np*
sizeof(
double));
700 pd[0] = two*pow(-one,np)*
gammaF(np + beta);
702 jacobd(np-2,z+1,pd+1,np-2,alpha+1,beta+1);
703 for(i = 1; i < np-1; ++i) pd[i] *= (one-z[i]*z[i]);
704 pd[np-1] = -two*
gammaF(np + alpha);
707 for (i = 0; i < np; i++) {
708 for (j = 0; j < np; j++){
710 D[i*np+j] = pd[j]/(pd[i]*(z[j]-z[i]));
713 D[i*np+j] = (alpha - (np-1)*(np + alpha + beta))/(two*(beta+ two));
715 D[i*np+j] =-(beta - (np-1)*(np + alpha + beta))/(two*(alpha+ two));
717 D[i*np+j] = (alpha - beta + (alpha + beta)*z[j])/
718 (two*(one - z[j]*z[j]));
749 double hgj (
const int i,
const double z,
const double *zgj,
750 const int np,
const double alpha,
const double beta)
752 boost::ignore_unused(alpha, beta);
757 if (fabs(dz) <
EPS)
return 1.0;
784 double hgrjm (
const int i,
const double z,
const double *zgrj,
const int np,
785 const double alpha,
const double beta)
787 boost::ignore_unused(alpha, beta);
793 if (fabs(dz) <
EPS)
return 1.0;
820 double hgrjp (
const int i,
const double z,
const double *zgrj,
const int np,
821 const double alpha,
const double beta)
823 boost::ignore_unused(alpha, beta);
828 if (fabs(dz) <
EPS)
return 1.0;
855 double hglj (
const int i,
const double z,
const double *zglj,
const int np,
856 const double alpha,
const double beta)
858 boost::ignore_unused(alpha, beta);
864 if (fabs(dz) <
EPS)
return 1.0;
884 void Imgj(
double *im,
const double *zgj,
const double *zm,
const int nz,
885 const int mz,
const double alpha,
const double beta){
889 for (i = 0; i < nz; ++i) {
890 for (j = 0; j < mz; ++j)
893 im [i*mz+j] =
hgj(i, zp, zgj, nz, alpha, beta);
913 void Imgrjm(
double *im,
const double *zgrj,
const double *zm,
const int nz,
914 const int mz,
const double alpha,
const double beta)
919 for (i = 0; i < nz; i++) {
920 for (j = 0; j < mz; j++)
923 im [i*mz+j] =
hgrjm(i, zp, zgrj, nz, alpha, beta);
943 void Imgrjp(
double *im,
const double *zgrj,
const double *zm,
const int nz,
944 const int mz,
const double alpha,
const double beta)
949 for (i = 0; i < nz; i++) {
950 for (j = 0; j < mz; j++)
953 im [i*mz+j] =
hgrjp(i, zp, zgrj, nz, alpha, beta);
974 void Imglj(
double *im,
const double *zglj,
const double *zm,
const int nz,
975 const int mz,
const double alpha,
const double beta)
980 for (i = 0; i < nz; i++) {
981 for (j = 0; j < mz; j++)
984 im[i*mz+j] =
hglj(i, zp, zglj, nz, alpha, beta);
1031 void jacobfd(
const int np,
const double *z,
double *poly_in,
double *polyd,
1032 const int n,
const double alpha,
const double beta){
1034 double zero = 0.0, one = 1.0, two = 2.0;
1041 for(i = 0; i < np; ++i)
1044 for(i = 0; i < np; ++i)
1049 for(i = 0; i < np; ++i)
1050 poly_in[i] = 0.5*(alpha - beta + (alpha + beta + two)*z[i]);
1052 for(i = 0; i < np; ++i)
1053 polyd[i] = 0.5*(alpha + beta + two);
1058 double two = 2.0, apb = alpha + beta;
1059 double *poly, *polyn1,*polyn2;
1062 polyn1 = (
double *)malloc(2*np*
sizeof(
double));
1067 polyn1 = (
double *)malloc(3*np*
sizeof(
double));
1072 for(i = 0; i < np; ++i){
1074 polyn1[i] = 0.5*(alpha - beta + (alpha + beta + two)*z[i]);
1077 for(k = 2; k <= n; ++k){
1078 a1 = two*k*(k + apb)*(two*k + apb - two);
1079 a2 = (two*k + apb - one)*(alpha*alpha - beta*beta);
1080 a3 = (two*k + apb - two)*(two*k + apb - one)*(two*k + apb);
1081 a4 = two*(k + alpha - one)*(k + beta - one)*(two*k + apb);
1087 for(i = 0; i < np; ++i){
1088 poly [i] = (a2 + a3*z[i])*polyn1[i] - a4*polyn2[i];
1089 polyn2[i] = polyn1[i];
1090 polyn1[i] = poly [i];
1095 a1 = n*(alpha - beta);
1096 a2 = n*(two*n + alpha + beta);
1097 a3 = two*(n + alpha)*(n + beta);
1098 a4 = (two*n + alpha + beta);
1099 a1 /= a4; a2 /= a4; a3 /= a4;
1102 for(i = 0; i < np; ++i){
1103 polyd[i] = (a1- a2*z[i])*poly[i] + a3*polyn2[i];
1104 polyd[i] /= (one - z[i]*z[i]);
1131 void jacobd(
const int np,
const double *z,
double *polyd,
const int n,
1132 const double alpha,
const double beta)
1137 for(i = 0; i < np; ++i) polyd[i] = 0.0;
1140 jacobfd(np,z,polyd,NULL,n-1,alpha+one,beta+one);
1141 for(i = 0; i < np; ++i) polyd[i] *= 0.5*(alpha + beta + (
double)n + one);
1161 if (x == -0.5) gamma = -2.0*sqrt(M_PI);
1162 else if (!x)
return gamma;
1163 else if ((x-(
int)x) == 0.5){
1173 else if ((x-(
int)x) == 0.0){
1183 fprintf(stderr,
"%lf is not of integer or half order\n",x);
1195 static void Jacobz(
const int n,
double *z,
const double alpha,
1198 double dth = M_PI/(2.0*(double)n);
1199 double poly,pder,rlast=0.0;
1201 double one = 1.0, two = 2.0;
1206 for(k = 0; k < n; ++k){
1207 r = -cos((two*(
double)k + one) * dth);
1208 if(k) r = 0.5*(r + rlast);
1210 for(j = 1; j <
STOP; ++j){
1211 jacobfd(1,&r,&poly, &pder, n, alpha, beta);
1213 for(i = 0, sum = 0.0; i < k; ++i) sum += one/(r - z[i]);
1215 delr = -poly / (pder - sum * poly);
1217 if( fabs(delr) <
EPS )
break;
1250 void JacZeros(
const int n,
double *a,
double*b,
const double alpha,
1256 double **z =
new double*[n];
1257 for(i = 0; i < n; i++)
1259 z[i] =
new double[n];
1260 for(j = 0; j < n; j++)
1265 for(i = 0; i < n; i++)
1281 static void RecCoeff(
const int n,
double *a,
double *b,
const double alpha,
1285 double apb, apbi,a2b2;
1295 a[0] = (beta-alpha)/apbi;
1296 b[1] = (4.0*(1.0+alpha)*(1.0+beta)/((apbi+1.0)*apbi*apbi));
1298 a2b2 = beta*beta-alpha*alpha;
1300 for(i = 1; i < n-1; i++){
1301 apbi = 2.0*(i+1) + apb;
1302 a[i] = a2b2/((apbi-2.0)*apbi);
1303 b[i+1] = (4.0*(i+1)*(i+1+alpha)*(i+1+beta)*(i+1+apb)/
1304 ((apbi*apbi-1)*apbi*apbi));
1308 a[n-1] = a2b2/((apbi-2.0)*apbi);
1339 static void TriQL(
const int n,
double *d,
double *e,
double **z){
1341 double s,r,
p,g,f,dd,c,b;
1343 double MuZero = e[0];
1346 for(i = 0; i < n-1; i++)
1348 e[i] = sqrt(e[i+1]);
1356 for (m=l;m<n-1;m++) {
1357 dd=fabs(d[m])+fabs(d[m+1]);
1358 if (fabs(e[m])+dd == dd)
break;
1361 if (iter++ ==
STOP){
1362 fprintf(stderr,
"triQL: Too many iterations in TQLI");
1365 g=(d[l+1]-d[l])/(2.0*e[l]);
1367 g=d[m]-d[l]+e[l]/(g+
sign(r,g));
1370 for (i=m-1;i>=l;i--) {
1373 if (fabs(f) >= fabs(g)) {
1385 r=(d[i]-g)*s+2.0*c*b;
1391 for(k = 0; k < n; k++)
1394 z[k][i+1] = s*z[k][i] + c*f;
1395 z[k][i] = c*z[k][i] - s*f;
1409 for(i = 0; i < n-1; ++i){
1412 for(l = i+1; l < n; ++l)
1420 double temp = z[0][k];
1426 for(i =0 ; i < n; i++)
1428 e[i] = MuZero*z[0][i]*z[0][i];
1445 int size = (int)floor(n/2.0)+2;
1446 double *s =
new double[size];
1447 double *t =
new double[size];
1450 for(i = 0; i < size; i++)
1457 for(m = 0; m <= n-2; m++)
1460 for(k = (
int)floor((m+1)/2.0); k >= 0; k--)
1463 u = u+(a[k+n+1]-a[l])*t[k+1] + b[k+n+1]*s[k] - b[l]*s[k+1];
1474 for(j = (
int)floor(n/2.0); j >= 0; j--)
1479 for(m = n-1; m <= 2*n-3; m++)
1482 for(k = m+1-n; k <= floor((m-1)/2.0); k++)
1486 u = u-(a[k+n+1]-a[l])*t[j+1] - b[k+n+1]*s[j+1] + b[l]*s[j+2];
1493 a[k+n+1] = a[k] + (s[j+1]-b[k+n+1]*s[j+2])/t[j+2];
1498 b[k+n+1] = s[j+1]/s[j+2];
1508 a[2*n ] = a[n-1]-b[2*n]*s[1]/t[1];
1522 void chri1(
int n,
double* a,
double* b,
double* a0,
1523 double* b0,
double z)
1526 double q = ceil(3.0*n/2);
1527 int size = (int)q+1;
1530 fprintf(stderr,
"input arrays a and b are too short\n");
1532 double* r =
new double[n+1];
1534 r[1] = z - a[1] - b[1]/r[0];
1535 a0[0] = a[1] + r[1] - r[0];
1544 for(k = 1; k < n; k++)
1546 r[k+1] = z - a[k+1] - b[k+1]/r[k];
1547 a0[k] = a[k+1] + r[k+1] - r[k];
1548 b0[k] = b[k] * r[k]/r[k-1];
1565 std::complex<Nektar::NekDouble>
ImagBesselComp(
int n,std::complex<Nektar::NekDouble> y)
1567 std::complex<Nektar::NekDouble> z (1.0,0.0);
1568 std::complex<Nektar::NekDouble> zbes (1.0,0.0);
1569 std::complex<Nektar::NekDouble> zarg;
1576 while (abs(z) > tol && i <= maxit){
1577 z = z*(1.0/i/(i+n)*zarg);
1578 if (abs(z) <= tol)
break;
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.
#define sign(a, b)
return the sign(b)*a
static void RecCoeff(const int, double *, double *, const double, const double)
The routine finds the recurrence coefficients a and b of the orthogonal polynomials.
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 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 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.
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 zwlk(double *z, double *w, const int npt, const double alpha, const double beta)
Gauss-Lobatto-Kronrod-Jacobi zeros and weights.
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 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 jacobd(const int np, const double *z, double *polyd, const int n, const double alpha, const double beta)
Calculate the derivative of Jacobi polynomials.
#define jacobz(n, z, alpha, beta)
zero determination using Newton iteration with polynomial deflation
#define STOP
Maximum number of iterations in polynomial defalation routine Jacobz.
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 JKMatrix(int, double *, double *)
Calcualtes the Jacobi-kronrod matrix by determining the a and coefficients.
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...
void zwgk(double *z, double *w, const int npt, const double alpha, const double beta)
Gauss-Kronrod-Jacobi zeros and weights.
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 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...
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.
The namespace associated with the the Polylib library (Polylib introduction)
double optdiff(double xl, double xr)
The following function is used to circumvent/reduce "Subtractive Cancellation" The expression 1/dz is...
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. .
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 ...
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...
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...
#define EPS
Precision tolerance for two points to be similar.
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 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...
double laginterp(double z, int j, const double *zj, int np)
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, .
double gammaF(const double)
Calculate the Gamma function , , for integer values and halves.
void zwgj(double *z, double *w, const int np, const double alpha, const double beta)
Gauss-Jacobi zeros and weights.