95 #ifndef __INTREPID2_POLYLIB_DEF_HPP__ 
   96 #define __INTREPID2_POLYLIB_DEF_HPP__ 
  105   template<
typename zViewType,
 
  107   KOKKOS_INLINE_FUNCTION
 
  109   Polylib::Serial::Cubature<POLYTYPE_GAUSS>::
 
  110   getValues(      zViewType z,
 
  112             const ordinal_type np,
 
  115     const double one = 1.0, two = 2.0, apb = alpha + beta;
 
  118     JacobiZeros(z, np, alpha, beta);
 
  119     JacobiPolynomialDerivative(np, z, w, np, alpha, beta);
 
  121     fac  = pow(two, apb + one)*GammaFunction(alpha + np + one)*GammaFunction(beta + np + one);
 
  122     fac /= GammaFunction((np + one))*GammaFunction(apb + np + one);
 
  124     for (ordinal_type i = 0; i < np; ++i)
 
  125       w(i) = fac/(w(i)*w(i)*(one-z(i)*z(i)));
 
  129   template<
typename zViewType,
 
  131   KOKKOS_INLINE_FUNCTION
 
  133   Polylib::Serial::Cubature<POLYTYPE_GAUSS_RADAU_LEFT>::
 
  134   getValues(      zViewType z,
 
  136             const ordinal_type np,
 
  143       const double one = 1.0, two = 2.0, apb = alpha + beta;
 
  148       auto z_plus_1 = Kokkos::subview(z, Kokkos::pair<ordinal_type,ordinal_type>(1, z.extent(0)));      
 
  149       JacobiZeros(z_plus_1, np-1, alpha, beta+1);
 
  151       Kokkos::View<typename zViewType::value_type*,Kokkos::Impl::ActiveExecutionMemorySpace,Kokkos::MemoryUnmanaged> null;
 
  152       JacobiPolynomial(np, z, w, null, np-1, alpha, beta);
 
  154       fac  = pow(two, apb)*GammaFunction(alpha + np)*GammaFunction(beta + np);
 
  155       fac /= GammaFunction(np)*(beta + np)*GammaFunction(apb + np + 1);
 
  157       for (ordinal_type i = 0; i < np; ++i)
 
  158         w(i) = fac*(1-z(i))/(w(i)*w(i));
 
  159       w(0) *= (beta + one);
 
  164   template<
typename zViewType,
 
  166   KOKKOS_INLINE_FUNCTION
 
  168   Polylib::Serial::Cubature<POLYTYPE_GAUSS_RADAU_RIGHT>::
 
  169   getValues(      zViewType z,
 
  171             const ordinal_type np,
 
  178       const double one = 1.0, two = 2.0, apb = alpha + beta;
 
  181       JacobiZeros(z, np-1, alpha+1, beta);
 
  184       Kokkos::View<typename zViewType::value_type*,Kokkos::Impl::ActiveExecutionMemorySpace,Kokkos::MemoryUnmanaged> null;
 
  185       JacobiPolynomial(np, z, w, null, np-1, alpha, beta);
 
  187       fac  = pow(two,apb)*GammaFunction(alpha + np)*GammaFunction(beta + np);
 
  188       fac /= GammaFunction(np)*(alpha + np)*GammaFunction(apb + np + 1);
 
  190       for (ordinal_type i = 0; i < np; ++i)
 
  191         w(i) = fac*(1+z(i))/(w(i)*w(i));
 
  192       w(np-1) *= (alpha + one);
 
  197   template<
typename zViewType,
 
  199   KOKKOS_INLINE_FUNCTION
 
  201   Polylib::Serial::Cubature<POLYTYPE_GAUSS_LOBATTO>::
 
  202   getValues(      zViewType z,
 
  204             const ordinal_type np,
 
  211       const double one = 1.0, apb = alpha + beta, two = 2.0;
 
  217       auto z_plus_1 = Kokkos::subview(z, Kokkos::pair<ordinal_type,ordinal_type>(1, z.extent(0)));      
 
  218       JacobiZeros(z_plus_1, np-2, alpha+one, beta+one);
 
  220       Kokkos::View<typename zViewType::value_type*,Kokkos::Impl::ActiveExecutionMemorySpace,Kokkos::MemoryUnmanaged> null;
 
  221       JacobiPolynomial(np, z, w, null, np-1, alpha, beta);
 
  223       fac  = pow(two, apb + 1)*GammaFunction(alpha + np)*GammaFunction(beta + np);
 
  224       fac /= (np-1)*GammaFunction(np)*GammaFunction(alpha + beta + np + one);
 
  226       for (ordinal_type i = 0; i < np; ++i)
 
  227         w(i) = fac/(w(i)*w(i));
 
  229       w(0)    *= (beta  + one);
 
  230       w(np-1) *= (alpha + one);
 
  239   template<
typename DViewType,
 
  241   KOKKOS_INLINE_FUNCTION
 
  243   Polylib::Serial::Derivative<POLYTYPE_GAUSS>::
 
  244   getValues(      DViewType D,
 
  246             const ordinal_type np,
 
  252       const double one = 1.0, two = 2.0;
 
  254       typename zViewType::value_type pd_buf[MaxPolylibPoint];
 
  255       Kokkos::View<
typename zViewType::value_type*,
 
  256         Kokkos::Impl::ActiveExecutionMemorySpace,Kokkos::MemoryUnmanaged> 
 
  257         pd((
typename zViewType::pointer_type)&pd_buf[0], MaxPolylibPoint);
 
  259       JacobiPolynomialDerivative(np, z, pd, np, alpha, beta);
 
  261       for (ordinal_type i = 0; i < np; ++i)
 
  262         for (ordinal_type j = 0; j < np; ++j)
 
  265             D(i,j) = pd(i)/(pd(j)*(z(i)-z(j)));
 
  267             D(i,j) = (alpha - beta + (alpha + beta + two)*z(j))/
 
  268               (two*(one - z(j)*z(j)));
 
  273   template<
typename DViewType,
 
  275   KOKKOS_INLINE_FUNCTION
 
  277   Polylib::Serial::Derivative<POLYTYPE_GAUSS_RADAU_LEFT>::
 
  278   getValues(      DViewType D,
 
  280             const ordinal_type np,
 
  286       const double one = 1.0, two = 2.0;
 
  288       typename zViewType::value_type pd_buf[MaxPolylibPoint];
 
  289       Kokkos::View<
typename zViewType::value_type*,
 
  290         Kokkos::Impl::ActiveExecutionMemorySpace,Kokkos::MemoryUnmanaged>
 
  291         pd((
typename zViewType::pointer_type)&pd_buf[0], MaxPolylibPoint);
 
  293       pd(0) = pow(-one,np-1)*GammaFunction(np+beta+one);
 
  294       pd(0) /= GammaFunction(np)*GammaFunction(beta+two);
 
  296       auto pd_plus_1 = Kokkos::subview(pd, Kokkos::pair<ordinal_type,ordinal_type>(1, pd.extent(0)));
 
  297       auto  z_plus_1 = Kokkos::subview( z, Kokkos::pair<ordinal_type,ordinal_type>(1,  z.extent(0)));
 
  299       JacobiPolynomialDerivative(np-1, z_plus_1, pd_plus_1, np-1, alpha, beta+1);
 
  300       for(ordinal_type i = 1; i < np; ++i)
 
  303       for (ordinal_type i = 0; i < np; ++i) 
 
  304         for (ordinal_type j = 0; j < np; ++j) 
 
  306             D(i,j) = pd(i)/(pd(j)*(z(i)-z(j)));
 
  309               D(i,j) = -(np + alpha + beta + one)*(np - one)/
 
  312               D(i,j) = (alpha - beta + one + (alpha + beta + one)*z(j))/
 
  313                 (two*(one - z(j)*z(j)));
 
  318   template<
typename DViewType,
 
  320   KOKKOS_INLINE_FUNCTION
 
  322   Polylib::Serial::Derivative<POLYTYPE_GAUSS_RADAU_RIGHT>::
 
  323   getValues(      DViewType D,
 
  325             const ordinal_type np,
 
  331       const double one = 1.0, two = 2.0;
 
  333       typename zViewType::value_type pd_buf[MaxPolylibPoint];
 
  334       Kokkos::View<
typename zViewType::value_type*,
 
  335         Kokkos::Impl::ActiveExecutionMemorySpace,Kokkos::MemoryUnmanaged>
 
  336         pd((
typename zViewType::pointer_type)&pd_buf[0], MaxPolylibPoint);
 
  338       JacobiPolynomialDerivative(np-1, z, pd, np-1, alpha+1, beta);
 
  339       for (ordinal_type i = 0; i < np-1; ++i)
 
  342       pd(np-1) = -GammaFunction(np+alpha+one);
 
  343       pd(np-1) /= GammaFunction(np)*GammaFunction(alpha+two);
 
  345       for (ordinal_type i = 0; i < np; ++i) 
 
  346         for (ordinal_type j = 0; j < np; ++j) 
 
  348             D(i,j) = pd(i)/(pd(j)*(z(i)-z(j)));
 
  351               D(i,j) = (np + alpha + beta + one)*(np - one)/
 
  354               D(i,j) = (alpha - beta - one + (alpha + beta + one)*z(j))/
 
  355                 (two*(one - z(j)*z(j)));
 
  360   template<
typename DViewType,
 
  362   KOKKOS_INLINE_FUNCTION
 
  364   Polylib::Serial::Derivative<POLYTYPE_GAUSS_LOBATTO>::
 
  365   getValues(      DViewType D,
 
  367             const ordinal_type np,
 
  373       const double one = 1.0, two = 2.0;
 
  375       typename zViewType::value_type pd_buf[MaxPolylibPoint];
 
  376       Kokkos::View<
typename zViewType::value_type*,
 
  377         Kokkos::Impl::ActiveExecutionMemorySpace,Kokkos::MemoryUnmanaged>
 
  378         pd((
typename zViewType::pointer_type)&pd_buf[0], MaxPolylibPoint);
 
  380       pd(0)  = two*pow(-one,np)*GammaFunction(np + beta);
 
  381       pd(0) /= GammaFunction(np - one)*GammaFunction(beta + two);
 
  383       auto pd_plus_1 = Kokkos::subview(pd, Kokkos::pair<ordinal_type,ordinal_type>(1, pd.extent(0)));
 
  384       auto  z_plus_1 = Kokkos::subview( z, Kokkos::pair<ordinal_type,ordinal_type>(1,  z.extent(0)));
 
  386       JacobiPolynomialDerivative(np-2, z_plus_1, pd_plus_1, np-2, alpha+1, beta+1);
 
  387       for (ordinal_type i = 1; i < np-1; ++i) 
 
  388         pd(i) *= (one-z(i)*z(i));
 
  390       pd(np-1)  = -two*GammaFunction(np + alpha);
 
  391       pd(np-1) /= GammaFunction(np - one)*GammaFunction(alpha + two);
 
  393       for (ordinal_type i = 0; i < np; ++i) 
 
  394         for (ordinal_type j = 0; j < np; ++j) 
 
  396             D(i,j) = pd(i)/(pd(j)*(z(i)-z(j)));
 
  399               D(i,j) = (alpha - (np-1)*(np + alpha + beta))/(two*(beta+ two));
 
  401               D(i,j) =-(beta - (np-1)*(np + alpha + beta))/(two*(alpha+ two));
 
  403               D(i,j) = (alpha - beta + (alpha + beta)*z(j))/
 
  404                 (two*(one - z(j)*z(j)));
 
  413   template<
typename zViewType>
 
  414   KOKKOS_INLINE_FUNCTION
 
  415   typename zViewType::value_type
 
  416   Polylib::Serial::LagrangianInterpolant<POLYTYPE_GAUSS>::
 
  417   getValue(
const ordinal_type i,
 
  418            const typename zViewType::value_type z,
 
  420            const ordinal_type np,
 
  423     const double tol = tolerence();
 
  425     typedef typename zViewType::value_type value_type;
 
  426     typedef typename zViewType::pointer_type pointer_type;
 
  428     value_type h, p_buf, pd_buf, zi_buf = zgj(i);
 
  429     Kokkos::View<value_type*,Kokkos::Impl::ActiveExecutionMemorySpace,Kokkos::MemoryUnmanaged> 
 
  430       p((pointer_type)&p_buf, 1), pd((pointer_type)&pd_buf, 1), zi((pointer_type)&zi_buf, 1), 
 
  431       zv(const_cast<pointer_type>(&z), 1), null;
 
  433     const auto dz  = z - zi(0);
 
  434     if (Util<value_type>::abs(dz) < tol) 
 
  437     JacobiPolynomialDerivative(1, zi, pd, np, alpha, beta);
 
  438     JacobiPolynomial(1, zv, p, null , np, alpha, beta);
 
  446   template<
typename zViewType>
 
  447   KOKKOS_INLINE_FUNCTION
 
  448   typename zViewType::value_type
 
  449   Polylib::Serial::LagrangianInterpolant<POLYTYPE_GAUSS_RADAU_LEFT>::
 
  450   getValue(
const ordinal_type i,
 
  451            const typename zViewType::value_type z,
 
  452            const zViewType zgrj,
 
  453            const ordinal_type np,
 
  456     const double tol = tolerence();
 
  458     typedef typename zViewType::value_type value_type;
 
  459     typedef typename zViewType::pointer_type pointer_type;
 
  461     value_type h, p_buf, pd_buf, zi_buf = zgrj(i);
 
  462     Kokkos::View<value_type*,Kokkos::Impl::ActiveExecutionMemorySpace,Kokkos::MemoryUnmanaged> 
 
  463       p((pointer_type)&p_buf, 1), pd((pointer_type)&pd_buf, 1), zi((pointer_type)&zi_buf, 1), 
 
  464       zv(const_cast<pointer_type>(&z), 1), null;
 
  466     const auto dz  = z - zi(0);
 
  467     if (Util<value_type>::abs(dz) < tol) 
 
  470     JacobiPolynomial(1, zi, p , null, np-1, alpha, beta + 1);
 
  473     JacobiPolynomialDerivative(1, zi, pd, np-1, alpha, beta + 1);
 
  474     h = (1.0 + zi(0))*pd(0) + p(0);
 
  476     JacobiPolynomial(1, zv, p, null,  np-1, alpha, beta + 1);
 
  477     h = (1.0 + z)*p(0)/(h*dz);
 
  484   template<
typename zViewType>
 
  485   KOKKOS_INLINE_FUNCTION
 
  486   typename zViewType::value_type
 
  487   Polylib::Serial::LagrangianInterpolant<POLYTYPE_GAUSS_RADAU_RIGHT>::
 
  488   getValue(
const ordinal_type i,
 
  489            const typename zViewType::value_type z,
 
  490            const zViewType zgrj,
 
  491            const ordinal_type np,
 
  494     const double tol = tolerence();
 
  496     typedef typename zViewType::value_type value_type;
 
  497     typedef typename zViewType::pointer_type pointer_type;
 
  499     value_type h, p_buf, pd_buf, zi_buf = zgrj(i);
 
  500     Kokkos::View<value_type*,Kokkos::Impl::ActiveExecutionMemorySpace,Kokkos::MemoryUnmanaged> 
 
  501       p((pointer_type)&p_buf, 1), pd((pointer_type)&pd_buf, 1), zi((pointer_type)&zi_buf, 1), 
 
  502       zv(const_cast<pointer_type>(&z), 1), null;
 
  504     const auto dz  = z - zi(0);
 
  505     if (Util<value_type>::abs(dz) < tol) 
 
  508     JacobiPolynomial(1, zi, p , null, np-1, alpha+1, beta);
 
  511     JacobiPolynomialDerivative(1, zi, pd, np-1, alpha+1, beta);
 
  512     h = (1.0 - zi(0))*pd(0) - p(0);
 
  514     JacobiPolynomial (1, zv, p, null,  np-1, alpha+1, beta);
 
  515     h = (1.0 - z)*p(0)/(h*dz);
 
  522   template<
typename zViewType>
 
  523   KOKKOS_INLINE_FUNCTION
 
  524   typename zViewType::value_type
 
  525   Polylib::Serial::LagrangianInterpolant<POLYTYPE_GAUSS_LOBATTO>::
 
  526   getValue(
const ordinal_type i,
 
  527            const typename zViewType::value_type z,
 
  528            const zViewType zglj,
 
  529            const ordinal_type np,
 
  532     const double one = 1.0, two = 2.0, tol = tolerence();
 
  534     typedef typename zViewType::value_type value_type;
 
  535     typedef typename zViewType::pointer_type pointer_type;
 
  537     value_type h, p_buf, pd_buf, zi_buf = zglj(i);
 
  538     Kokkos::View<value_type*,Kokkos::Impl::ActiveExecutionMemorySpace,Kokkos::MemoryUnmanaged> 
 
  539       p((pointer_type)&p_buf, 1), pd((pointer_type)&pd_buf, 1), zi((pointer_type)&zi_buf, 1), 
 
  540       zv(const_cast<pointer_type>(&z), 1), null;
 
  542     const auto dz = z - zi(0);
 
  543     if (Util<value_type>::abs(dz) < tol) 
 
  546     JacobiPolynomial(1, zi, p , null, np-2, alpha + one, beta + one);
 
  549     JacobiPolynomialDerivative(1, zi, pd, np-2, alpha + one, beta + one);
 
  550     h = (one - zi(0)*zi(0))*pd(0) - two*zi(0)*p(0);
 
  552     JacobiPolynomial(1, zv, p, null, np-2, alpha + one, beta + one);
 
  553     h = (one - z*z)*p(0)/(h*dz);
 
  562   template<EPolyType polyType>
 
  563   template<
typename imViewType,
 
  564            typename zgrjViewType,
 
  566   KOKKOS_INLINE_FUNCTION
 
  568   Polylib::Serial::InterpolationOperator<polyType>::
 
  569   getMatrix(      imViewType im,
 
  570             const zgrjViewType zgrj,
 
  572             const ordinal_type nz,
 
  573             const ordinal_type mz,
 
  576     for (ordinal_type i = 0; i < mz; ++i) {
 
  577       const auto zp = zm(i);
 
  578       for (ordinal_type j = 0; j < nz; ++j)
 
  579         im(i, j) = LagrangianInterpolant<polyType>::getValue(j, zp, zgrj, nz, alpha, beta);
 
  585   template<
typename zViewType,
 
  586            typename polyiViewType,
 
  587            typename polydViewType>
 
  588   KOKKOS_INLINE_FUNCTION
 
  595                    const ordinal_type n,
 
  598     const double zero = 0.0, one = 1.0, two = 2.0;
 
  606         for (ordinal_type i = 0; i < np; ++i) 
 
  609         for (ordinal_type i = 0; i < np; ++i) 
 
  613         for (ordinal_type i = 0; i < np; ++i) 
 
  614           polyi(i) = 0.5*(alpha - beta + (alpha + beta + two)*z(i));
 
  616         for (ordinal_type i = 0; i < np; ++i) 
 
  617           polyd(i) = 0.5*(alpha + beta + two);
 
  619       double a1, a2, a3, a4;
 
  620       const double apb = alpha + beta;
 
  622       typename polyiViewType::value_type
 
  623         poly[MaxPolylibPoint]={}, polyn1[MaxPolylibPoint]={}, polyn2[MaxPolylibPoint]={};
 
  626         for (ordinal_type i=0;i<np;++i)
 
  629       for (ordinal_type i = 0; i < np; ++i) {
 
  631         polyn1[i] = 0.5*(alpha - beta + (alpha + beta + two)*z(i));
 
  634       for (
auto k = 2; k <= n; ++k) {
 
  635         a1 =  two*k*(k + apb)*(two*k + apb - two);
 
  636         a2 = (two*k + apb - one)*(alpha*alpha - beta*beta);
 
  637         a3 = (two*k + apb - two)*(two*k + apb - one)*(two*k + apb);
 
  638         a4 =  two*(k + alpha - one)*(k + beta - one)*(two*k + apb);
 
  644         for (ordinal_type i = 0; i < np; ++i) {
 
  645           poly  [i] = (a2 + a3*z(i))*polyn1[i] - a4*polyn2[i];
 
  646           polyn2[i] = polyn1[i];
 
  647           polyn1[i] = poly  [i];
 
  652         a1 = n*(alpha - beta);
 
  653         a2 = n*(two*n + alpha + beta);
 
  654         a3 = two*(n + alpha)*(n + beta);
 
  655         a4 = (two*n + alpha + beta);
 
  661         for (ordinal_type i = 0; i < np; ++i) {
 
  662           polyd(i)  = (a1- a2*z(i))*poly[i] + a3*polyn2[i];
 
  663           polyd(i) /= (one - z(i)*z(i));
 
  668         for (ordinal_type i=0;i<np;++i)
 
  673   template<
typename zViewType,
 
  674            typename polydViewType>
 
  675   KOKKOS_INLINE_FUNCTION
 
  681                              const ordinal_type n,
 
  684     const double one = 1.0;
 
  686       for(ordinal_type i = 0; i < np; ++i)
 
  689       Kokkos::View<typename polydViewType::value_type*,Kokkos::Impl::ActiveExecutionMemorySpace,Kokkos::MemoryUnmanaged> null;
 
  690       JacobiPolynomial(np, z, polyd, null, n-1, alpha+one, beta+one);
 
  691       for(ordinal_type i = 0; i < np; ++i)
 
  692         polyd(i) *= 0.5*(alpha + beta + n + one);
 
  698   template<
typename zViewType,
 
  699            bool DeflationEnabled>
 
  700   KOKKOS_INLINE_FUNCTION
 
  704               const ordinal_type n,
 
  707     if (DeflationEnabled)
 
  708       JacobiZerosPolyDeflation(z, n, alpha, beta);
 
  710       JacobiZerosTriDiagonal(z, n, alpha, beta);
 
  713   template<
typename zViewType>
 
  714   KOKKOS_INLINE_FUNCTION
 
  717   JacobiZerosPolyDeflation(      zViewType z,
 
  718                            const ordinal_type n,
 
  724     const double dth = M_PI/(2.0*n);
 
  725     const double one = 1.0, two = 2.0;
 
  726     const double tol = tolerence();
 
  728     typedef typename zViewType::value_type value_type;
 
  729     typedef typename zViewType::pointer_type pointer_type;
 
  731     value_type r_buf, poly_buf, pder_buf;
 
  732     Kokkos::View<value_type*,Kokkos::Impl::ActiveExecutionMemorySpace,Kokkos::MemoryUnmanaged> 
 
  733       poly((pointer_type)&poly_buf, 1), pder((pointer_type)&pder_buf, 1), r((pointer_type)&r_buf, 1); 
 
  735     value_type rlast = 0.0;
 
  736     for (
auto k = 0; k < n; ++k) {
 
  737       r(0) = -cos((two*(
double)k + one) * dth);
 
  739         r(0) = 0.5*(r(0) + rlast);
 
  741       for (ordinal_type j = 1; j < MaxPolylibIteration; ++j) {
 
  742         JacobiPolynomial(1, r, poly, pder, n, alpha, beta);
 
  745         for (ordinal_type i = 0; i < k; ++i) 
 
  746           sum += one/(r(0) - z(i));
 
  748         const value_type delr = -poly(0) / (pder(0) - sum * poly(0));
 
  759   template<
typename aViewType>
 
  760   KOKKOS_INLINE_FUNCTION
 
  763   JacobiZerosTriDiagonal(      aViewType a,
 
  764                          const ordinal_type n,
 
  770     typedef typename aViewType::value_type value_type;
 
  771     typedef typename aViewType::pointer_type pointer_type;
 
  773     value_type b_buf[MaxPolylibPoint];
 
  774     Kokkos::View<value_type*,Kokkos::Impl::ActiveExecutionMemorySpace,Kokkos::MemoryUnmanaged> 
 
  775       b((pointer_type)&b_buf[0], MaxPolylibPoint);
 
  778     const double apb  = alpha + beta;
 
  779     double apbi = 2.0 + apb;
 
  781     b(n-1) = pow(2.0,apb+1.0)*GammaFunction(alpha+1.0)*GammaFunction(beta+1.0)/GammaFunction(apbi);
 
  782     a(0)   = (beta-alpha)/apbi;
 
  783     b(0)   = sqrt(4.0*(1.0+alpha)*(1.0+beta)/((apbi+1.0)*apbi*apbi));
 
  785     const double a2b2 = beta*beta-alpha*alpha;
 
  786     for (ordinal_type i = 1; i < n-1; ++i) {
 
  787       apbi = 2.0*(i+1) + apb;
 
  788       a(i) = a2b2/((apbi-2.0)*apbi);
 
  789       b(i) = sqrt(4.0*(i+1)*(i+1+alpha)*(i+1+beta)*(i+1+apb)/
 
  790                   ((apbi*apbi-1)*apbi*apbi));
 
  795     if (n>1) a(n-1) = a2b2/((apbi-2.0)*apbi);
 
  802   template<
typename dViewType,
 
  804   KOKKOS_INLINE_FUNCTION
 
  809         const ordinal_type n) {
 
  810     ordinal_type m,l,iter,i,k;
 
  812     typedef typename dViewType::value_type value_type;
 
  813     value_type s,r,p,g,f,dd,c,b;
 
  815     for (l=0; l<n; ++l) {
 
  818         for (m=l; m<n-1; ++m) {
 
  823           if (iter++ == MaxPolylibIteration) {
 
  824             INTREPID2_TEST_FOR_ABORT(
true,
 
  825                                      ">>> ERROR (Polylib::Serial): Too many iterations in TQLI.");
 
  827           g=(d(l+1)-d(l))/(2.0*e(l));
 
  833           for (i=m-1; i>=l; i--) {
 
  848             r=(d(i)-g)*s+2.0*c*b;
 
  861     for (i = 0; i < n-1; ++i) {
 
  864       for (l = i+1; l < n; ++l)
 
  874   KOKKOS_INLINE_FUNCTION
 
  880     if      (x == -0.5) gamma = -2.0*sqrt(M_PI);
 
  881     else if (x ==  0.0) gamma = 1.0;
 
  882     else if ((x-(ordinal_type)x) == 0.5) {
 
  883       ordinal_type n = (ordinal_type) x;
 
  891     } 
else if ((x-(ordinal_type)x) == 0.0) {
 
  892       ordinal_type n = (ordinal_type) x;
 
  901       INTREPID2_TEST_FOR_ABORT(
true,
 
  902                                ">>> ERROR (Polylib::Serial): Argument is not of integer or half order.");
 
static KOKKOS_INLINE_FUNCTION void JacobiPolynomialDerivative(const ordinal_type np, const zViewType z, polydViewType polyd, const ordinal_type n, const double alpha, const double beta)
Calculate the derivative of Jacobi polynomials. 
static KOKKOS_INLINE_FUNCTION void JacobiPolynomial(const ordinal_type np, const zViewType z, polyiViewType poly_in, polydViewType polyd, const ordinal_type n, const double alpha, const double beta)
Routine to calculate Jacobi polynomials, , and their first derivative, . 
static KOKKOS_INLINE_FUNCTION void JacobiZeros(zViewType z, const ordinal_type n, const double alpha, const double beta)
Calculate the n zeros, z, of the Jacobi polynomial, i.e. . 
static KOKKOS_INLINE_FUNCTION double GammaFunction(const double x)
Calculate the Gamma function , , for integer values x and halves. 
static KOKKOS_INLINE_FUNCTION void TriQL(dViewType d, eViewType e, const ordinal_type n)
QL algorithm for symmetric tridiagonal matrix.