62 #ifndef __INTREPID2_POLYLIB_DEF_HPP__
63 #define __INTREPID2_POLYLIB_DEF_HPP__
65 #if defined(_MSC_VER) || defined(_WIN32) && defined(__ICL)
67 #ifndef _USE_MATH_DEFINES
68 #define _USE_MATH_DEFINES
80 template<
typename zViewType,
82 KOKKOS_INLINE_FUNCTION
84 Polylib::Serial::Cubature<POLYTYPE_GAUSS>::
85 getValues( zViewType z,
87 const ordinal_type np,
90 const double one = 1.0, two = 2.0, apb = alpha + beta;
93 JacobiZeros(z, np, alpha, beta);
94 JacobiPolynomialDerivative(np, z, w, np, alpha, beta);
96 fac = pow(two, apb + one)*GammaFunction(alpha + np + one)*GammaFunction(beta + np + one);
97 fac /= GammaFunction((np + one))*GammaFunction(apb + np + one);
99 for (ordinal_type i = 0; i < np; ++i)
100 w(i) = fac/(w(i)*w(i)*(one-z(i)*z(i)));
104 template<
typename zViewType,
106 KOKKOS_INLINE_FUNCTION
108 Polylib::Serial::Cubature<POLYTYPE_GAUSS_RADAU_LEFT>::
109 getValues( zViewType z,
111 const ordinal_type np,
118 const double one = 1.0, two = 2.0, apb = alpha + beta;
123 auto z_plus_1 = Kokkos::subview(z, Kokkos::pair<ordinal_type,ordinal_type>(1, z.extent(0)));
124 JacobiZeros(z_plus_1, np-1, alpha, beta+1);
126 Kokkos::View<typename zViewType::value_type*,Kokkos::AnonymousSpace,Kokkos::MemoryUnmanaged> null;
127 JacobiPolynomial(np, z, w, null, np-1, alpha, beta);
129 fac = pow(two, apb)*GammaFunction(alpha + np)*GammaFunction(beta + np);
130 fac /= GammaFunction(np)*(beta + np)*GammaFunction(apb + np + 1);
132 for (ordinal_type i = 0; i < np; ++i)
133 w(i) = fac*(1-z(i))/(w(i)*w(i));
134 w(0) *= (beta + one);
139 template<
typename zViewType,
141 KOKKOS_INLINE_FUNCTION
143 Polylib::Serial::Cubature<POLYTYPE_GAUSS_RADAU_RIGHT>::
144 getValues( zViewType z,
146 const ordinal_type np,
153 const double one = 1.0, two = 2.0, apb = alpha + beta;
156 JacobiZeros(z, np-1, alpha+1, beta);
159 Kokkos::View<typename zViewType::value_type*,Kokkos::AnonymousSpace,Kokkos::MemoryUnmanaged> null;
160 JacobiPolynomial(np, z, w, null, np-1, alpha, beta);
162 fac = pow(two,apb)*GammaFunction(alpha + np)*GammaFunction(beta + np);
163 fac /= GammaFunction(np)*(alpha + np)*GammaFunction(apb + np + 1);
165 for (ordinal_type i = 0; i < np; ++i)
166 w(i) = fac*(1+z(i))/(w(i)*w(i));
167 w(np-1) *= (alpha + one);
172 template<
typename zViewType,
174 KOKKOS_INLINE_FUNCTION
176 Polylib::Serial::Cubature<POLYTYPE_GAUSS_LOBATTO>::
177 getValues( zViewType z,
179 const ordinal_type np,
186 const double one = 1.0, apb = alpha + beta, two = 2.0;
192 auto z_plus_1 = Kokkos::subview(z, Kokkos::pair<ordinal_type,ordinal_type>(1, z.extent(0)));
193 JacobiZeros(z_plus_1, np-2, alpha+one, beta+one);
195 Kokkos::View<typename zViewType::value_type*,Kokkos::AnonymousSpace,Kokkos::MemoryUnmanaged> null;
196 JacobiPolynomial(np, z, w, null, np-1, alpha, beta);
198 fac = pow(two, apb + 1)*GammaFunction(alpha + np)*GammaFunction(beta + np);
199 fac /= (np-1)*GammaFunction(np)*GammaFunction(alpha + beta + np + one);
201 for (ordinal_type i = 0; i < np; ++i)
202 w(i) = fac/(w(i)*w(i));
204 w(0) *= (beta + one);
205 w(np-1) *= (alpha + one);
214 template<
typename DViewType,
216 KOKKOS_INLINE_FUNCTION
218 Polylib::Serial::Derivative<POLYTYPE_GAUSS>::
219 getValues( DViewType D,
221 const ordinal_type np,
227 const double one = 1.0, two = 2.0;
229 auto pd = Kokkos::subview(D, np-1, Kokkos::pair<int,int>(0,np));
230 JacobiPolynomialDerivative(np, z, pd, np, alpha, beta);
234 for (ordinal_type i = 0; i < np; ++i) {
235 const auto & pd_i = pd(i);
236 const auto & z_i = z(i);
237 for (ordinal_type j = 0; j < i; ++j) {
238 const auto & pd_j = pd(j);
239 const auto & z_j = z(j);
240 D(j,i) = pd_j/(pd_i*(z_j-z_i));
241 D(i,j) = pd_i/(pd_j*(z_i-z_j));
243 D(i,i) = (alpha - beta + (alpha + beta + two)*z_i) / (two*(one - z_i*z_i));
249 template<
typename DViewType,
251 KOKKOS_INLINE_FUNCTION
253 Polylib::Serial::Derivative<POLYTYPE_GAUSS_RADAU_LEFT>::
254 getValues( DViewType D,
256 const ordinal_type np,
262 const double one = 1.0, two = 2.0;
264 auto pd = Kokkos::subview(D, np-1, Kokkos::pair<int,int>(0,np));
265 pd(0) = pow(-one,np-1)*GammaFunction(np+beta+one) / (GammaFunction(np)*GammaFunction(beta+two));
267 auto pd_plus_1 = Kokkos::subview(pd, Kokkos::pair<ordinal_type,ordinal_type>(1, pd.extent(0)));
268 auto z_plus_1 = Kokkos::subview( z, Kokkos::pair<ordinal_type,ordinal_type>(1, z.extent(0)));
270 JacobiPolynomialDerivative(np-1, z_plus_1, pd_plus_1, np-1, alpha, beta+1);
271 for(ordinal_type i = 1; i < np; ++i)
276 for (ordinal_type i = 0; i < np; ++i) {
277 const auto & pd_i = pd(i);
278 const auto & z_i = z(i);
279 for (ordinal_type j = 0; j < i; ++j) {
280 const auto & pd_j = pd(j);
281 const auto & z_j = z(j);
282 D(j,i) = pd_j/(pd_i*(z_j-z_i));
283 D(i,j) = pd_i/(pd_j*(z_i-z_j));
286 D(i,i) = -(np + alpha + beta + one)*(np - one) / (two*(beta + two));
288 D(i,i) = (alpha - beta + one + (alpha + beta + one)*z_i) / (two*(one - z_i*z_i));
294 template<
typename DViewType,
296 KOKKOS_INLINE_FUNCTION
298 Polylib::Serial::Derivative<POLYTYPE_GAUSS_RADAU_RIGHT>::
299 getValues( DViewType D,
301 const ordinal_type np,
307 const double one = 1.0, two = 2.0;
309 auto pd = Kokkos::subview(D, np-1, Kokkos::pair<int,int>(0,np));
311 JacobiPolynomialDerivative(np-1, z, pd, np-1, alpha+1, beta);
312 for (ordinal_type i = 0; i < np-1; ++i)
315 pd(np-1) = -GammaFunction(np+alpha+one) / (GammaFunction(np)*GammaFunction(alpha+two));
319 for (ordinal_type i = 0; i < np; ++i) {
320 const auto & pd_i = pd(i);
321 const auto & z_i = z(i);
322 for (ordinal_type j = 0; j < i; ++j) {
323 const auto & pd_j = pd(j);
324 const auto & z_j = z(j);
325 D(j,i) = pd_j/(pd_i*(z_j-z_i));
326 D(i,j) = pd_i/(pd_j*(z_i-z_j));
329 D(i,i) = (np + alpha + beta + one)*(np - one) / (two*(alpha + two));
331 D(i,i) = (alpha - beta - one + (alpha + beta + one)*z_i) / (two*(one - z_i*z_i));
337 template<
typename DViewType,
339 KOKKOS_INLINE_FUNCTION
341 Polylib::Serial::Derivative<POLYTYPE_GAUSS_LOBATTO>::
342 getValues( DViewType D,
344 const ordinal_type np,
350 const double one = 1.0, two = 2.0;
352 auto pd = Kokkos::subview(D, np-1, Kokkos::pair<int,int>(0,np));
354 pd(0) = two*pow(-one,np)*GammaFunction(np + beta);
355 pd(0) /= GammaFunction(np - one)*GammaFunction(beta + two);
357 auto pd_plus_1 = Kokkos::subview(pd, Kokkos::pair<ordinal_type,ordinal_type>(1, pd.extent(0)));
358 auto z_plus_1 = Kokkos::subview( z, Kokkos::pair<ordinal_type,ordinal_type>(1, z.extent(0)));
360 JacobiPolynomialDerivative(np-2, z_plus_1, pd_plus_1, np-2, alpha+1, beta+1);
361 for (ordinal_type i = 1; i < np-1; ++i) {
362 const auto & z_i = z(i);
363 pd(i) *= (one-z_i*z_i);
366 pd(np-1) = -two*GammaFunction(np + alpha);
367 pd(np-1) /= GammaFunction(np - one)*GammaFunction(alpha + two);
371 for (ordinal_type i = 0; i < np; ++i) {
372 const auto & pd_i = pd(i);
373 const auto & z_i = z(i);
374 for (ordinal_type j = 0; j < i; ++j) {
375 const auto & pd_j = pd(j);
376 const auto & z_j = z(j);
377 D(j,i) = pd_j/(pd_i*(z_j-z_i));
378 D(i,j) = pd_i/(pd_j*(z_i-z_j));
381 D(i,i) = (alpha - (np-1)*(np + alpha + beta))/(two*(beta+ two));
383 D(i,i) =-(beta - (np-1)*(np + alpha + beta))/(two*(alpha+ two));
385 D(i,i) = (alpha - beta + (alpha + beta)*z_i)/(two*(one - z_i*z_i));
395 template<
typename zViewType>
396 KOKKOS_INLINE_FUNCTION
397 typename zViewType::value_type
398 Polylib::Serial::LagrangianInterpolant<POLYTYPE_GAUSS>::
399 getValue(
const ordinal_type i,
400 const typename zViewType::value_type z,
402 const ordinal_type np,
405 const double tol = tolerence();
407 typedef typename zViewType::value_type value_type;
408 typedef typename zViewType::pointer_type pointer_type;
410 value_type h, p_buf, pd_buf, zi_buf = zgj(i);
411 Kokkos::View<value_type*,Kokkos::AnonymousSpace,Kokkos::MemoryUnmanaged>
412 p((pointer_type)&p_buf, 1), pd((pointer_type)&pd_buf, 1), zi((pointer_type)&zi_buf, 1),
413 zv(const_cast<pointer_type>(&z), 1), null;
415 const auto dz = z - zi(0);
416 if (Util<value_type>::abs(dz) < tol)
419 JacobiPolynomialDerivative(1, zi, pd, np, alpha, beta);
420 JacobiPolynomial(1, zv, p, null , np, alpha, beta);
428 template<
typename zViewType>
429 KOKKOS_INLINE_FUNCTION
430 typename zViewType::value_type
431 Polylib::Serial::LagrangianInterpolant<POLYTYPE_GAUSS_RADAU_LEFT>::
432 getValue(
const ordinal_type i,
433 const typename zViewType::value_type z,
434 const zViewType zgrj,
435 const ordinal_type np,
438 const double tol = tolerence();
440 typedef typename zViewType::value_type value_type;
441 typedef typename zViewType::pointer_type pointer_type;
443 value_type h, p_buf, pd_buf, zi_buf = zgrj(i);
444 Kokkos::View<value_type*,Kokkos::AnonymousSpace,Kokkos::MemoryUnmanaged>
445 p((pointer_type)&p_buf, 1), pd((pointer_type)&pd_buf, 1), zi((pointer_type)&zi_buf, 1),
446 zv(const_cast<pointer_type>(&z), 1), null;
448 const auto dz = z - zi(0);
449 if (Util<value_type>::abs(dz) < tol)
452 JacobiPolynomial(1, zi, p , null, np-1, alpha, beta + 1);
455 JacobiPolynomialDerivative(1, zi, pd, np-1, alpha, beta + 1);
456 h = (1.0 + zi(0))*pd(0) + p(0);
458 JacobiPolynomial(1, zv, p, null, np-1, alpha, beta + 1);
459 h = (1.0 + z)*p(0)/(h*dz);
466 template<
typename zViewType>
467 KOKKOS_INLINE_FUNCTION
468 typename zViewType::value_type
469 Polylib::Serial::LagrangianInterpolant<POLYTYPE_GAUSS_RADAU_RIGHT>::
470 getValue(
const ordinal_type i,
471 const typename zViewType::value_type z,
472 const zViewType zgrj,
473 const ordinal_type np,
476 const double tol = tolerence();
478 typedef typename zViewType::value_type value_type;
479 typedef typename zViewType::pointer_type pointer_type;
481 value_type h, p_buf, pd_buf, zi_buf = zgrj(i);
482 Kokkos::View<value_type*,Kokkos::AnonymousSpace,Kokkos::MemoryUnmanaged>
483 p((pointer_type)&p_buf, 1), pd((pointer_type)&pd_buf, 1), zi((pointer_type)&zi_buf, 1),
484 zv(const_cast<pointer_type>(&z), 1), null;
486 const auto dz = z - zi(0);
487 if (Util<value_type>::abs(dz) < tol)
490 JacobiPolynomial(1, zi, p , null, np-1, alpha+1, beta);
493 JacobiPolynomialDerivative(1, zi, pd, np-1, alpha+1, beta);
494 h = (1.0 - zi(0))*pd(0) - p(0);
496 JacobiPolynomial (1, zv, p, null, np-1, alpha+1, beta);
497 h = (1.0 - z)*p(0)/(h*dz);
504 template<
typename zViewType>
505 KOKKOS_INLINE_FUNCTION
506 typename zViewType::value_type
507 Polylib::Serial::LagrangianInterpolant<POLYTYPE_GAUSS_LOBATTO>::
508 getValue(
const ordinal_type i,
509 const typename zViewType::value_type z,
510 const zViewType zglj,
511 const ordinal_type np,
514 const double one = 1.0, two = 2.0, tol = tolerence();
516 typedef typename zViewType::value_type value_type;
517 typedef typename zViewType::pointer_type pointer_type;
519 value_type h, p_buf, pd_buf, zi_buf = zglj(i);
520 Kokkos::View<value_type*,Kokkos::AnonymousSpace,Kokkos::MemoryUnmanaged>
521 p((pointer_type)&p_buf, 1), pd((pointer_type)&pd_buf, 1), zi((pointer_type)&zi_buf, 1),
522 zv(const_cast<pointer_type>(&z), 1), null;
524 const auto dz = z - zi(0);
525 if (Util<value_type>::abs(dz) < tol)
528 JacobiPolynomial(1, zi, p , null, np-2, alpha + one, beta + one);
531 JacobiPolynomialDerivative(1, zi, pd, np-2, alpha + one, beta + one);
532 h = (one - zi(0)*zi(0))*pd(0) - two*zi(0)*p(0);
534 JacobiPolynomial(1, zv, p, null, np-2, alpha + one, beta + one);
535 h = (one - z*z)*p(0)/(h*dz);
544 template<EPolyType polyType>
545 template<
typename imViewType,
546 typename zgrjViewType,
548 KOKKOS_INLINE_FUNCTION
550 Polylib::Serial::InterpolationOperator<polyType>::
551 getMatrix( imViewType im,
552 const zgrjViewType zgrj,
554 const ordinal_type nz,
555 const ordinal_type mz,
558 for (ordinal_type i = 0; i < mz; ++i) {
559 const auto zp = zm(i);
560 for (ordinal_type j = 0; j < nz; ++j)
561 im(i, j) = LagrangianInterpolant<polyType>::getValue(j, zp, zgrj, nz, alpha, beta);
567 template<
typename zViewType,
568 typename polyiViewType,
569 typename polydViewType>
570 KOKKOS_INLINE_FUNCTION
577 const ordinal_type n,
580 const double zero = 0.0, one = 1.0, two = 2.0;
588 for (ordinal_type i = 0; i < np; ++i)
591 for (ordinal_type i = 0; i < np; ++i)
595 for (ordinal_type i = 0; i < np; ++i)
596 polyi(i) = 0.5*(alpha - beta + (alpha + beta + two)*z(i));
598 for (ordinal_type i = 0; i < np; ++i)
599 polyd(i) = 0.5*(alpha + beta + two);
601 INTREPID2_TEST_FOR_ABORT(polyd.data() && !polyd.data() ,
602 ">>> ERROR (Polylib::Serial::JacobiPolynomial): polyi view needed to compute polyd view.");
603 if(!polyi.data())
return;
605 constexpr ordinal_type maxOrder = 2*MaxPolylibPoint-1;
607 INTREPID2_TEST_FOR_ABORT(maxOrder < n,
608 ">>> ERROR (Polylib::Serial::JacobiPolynomial): Requested order exceeds maxOrder .");
610 double a2[maxOrder-1]={}, a3[maxOrder-1]={}, a4[maxOrder-1]={};
611 double ad1(0.0), ad2(0.0), ad3(0.0);
612 const double apb = alpha + beta;
613 const double amb = alpha - beta;
616 for (
auto k = 2; k <= n; ++k) {
617 double a1 = two*k*(k + apb)*(two*k + apb - two);
618 a2[k-2] = (two*k + apb - one)*(apb*amb)/a1;
619 a3[k-2] = (two*k + apb - two)*(two*k + apb - one)*(two*k + apb)/a1;
620 a4[k-2] = two*(k + alpha - one)*(k + beta - one)*(two*k + apb)/a1;
624 double ad4 = (two*n + alpha + beta);
625 ad1 = n*(alpha - beta)/ad4;
626 ad2 = n*(two*n + alpha + beta)/ad4;
627 ad3 = two*(n + alpha)*(n + beta)/ad4;
630 typename polyiViewType::value_type polyn0, polyn1, polyn2;
631 for(ordinal_type i = 0; i < np; ++i) {
632 const auto & z_i = z(i);
634 polyn1 = 0.5*(amb + (apb + two)*z_i);
635 polyn0 = (a2[0] + a3[0]*z_i)*polyn1 - a4[0]*polyn2;
636 for (ordinal_type k = 1; k < n-1; ++k) {
639 polyn0 = (a2[k] + a3[k]*z_i)*polyn1 - a4[k]*polyn2;
642 polyd(i) = (ad1- ad2*z_i)*polyn0 + ad3*polyn1 / (one - z_i*z_i);
649 template<
typename zViewType,
650 typename polydViewType>
651 KOKKOS_INLINE_FUNCTION
657 const ordinal_type n,
660 const double one = 1.0;
662 for(ordinal_type i = 0; i < np; ++i)
665 Kokkos::View<typename polydViewType::value_type*,Kokkos::AnonymousSpace,Kokkos::MemoryUnmanaged> null;
666 JacobiPolynomial(np, z, polyd, null, n-1, alpha+one, beta+one);
667 for(ordinal_type i = 0; i < np; ++i)
668 polyd(i) *= 0.5*(alpha + beta + n + one);
674 template<
typename zViewType,
675 bool DeflationEnabled>
676 KOKKOS_INLINE_FUNCTION
680 const ordinal_type n,
683 if (DeflationEnabled)
684 JacobiZerosPolyDeflation(z, n, alpha, beta);
686 JacobiZerosTriDiagonal(z, n, alpha, beta);
689 template<
typename zViewType>
690 KOKKOS_INLINE_FUNCTION
693 JacobiZerosPolyDeflation( zViewType z,
694 const ordinal_type n,
700 const double dth = M_PI/(2.0*n);
701 const double one = 1.0, two = 2.0;
702 const double tol = tolerence();
704 typedef typename zViewType::value_type value_type;
705 typedef typename zViewType::pointer_type pointer_type;
707 value_type r_buf, poly_buf, pder_buf;
708 Kokkos::View<value_type*,Kokkos::AnonymousSpace,Kokkos::MemoryUnmanaged>
709 poly((pointer_type)&poly_buf, 1), pder((pointer_type)&pder_buf, 1), r((pointer_type)&r_buf, 1);
711 value_type rlast = 0.0;
712 for (
auto k = 0; k < n; ++k) {
713 r(0) = -cos((two*(
double)k + one) * dth);
715 r(0) = 0.5*(r(0) + rlast);
717 for (ordinal_type j = 1; j < MaxPolylibIteration; ++j) {
718 JacobiPolynomial(1, r, poly, pder, n, alpha, beta);
721 for (ordinal_type i = 0; i < k; ++i)
722 sum += one/(r(0) - z(i));
724 const value_type delr = -poly(0) / (pder(0) - sum * poly(0));
735 template<
typename aViewType>
736 KOKKOS_INLINE_FUNCTION
739 JacobiZerosTriDiagonal( aViewType a,
740 const ordinal_type n,
746 typedef typename aViewType::value_type value_type;
747 typedef typename aViewType::pointer_type pointer_type;
749 value_type b_buf[MaxPolylibPoint];
750 Kokkos::View<value_type*,Kokkos::AnonymousSpace,Kokkos::MemoryUnmanaged>
751 b((pointer_type)&b_buf[0], MaxPolylibPoint);
754 const double apb = alpha + beta;
755 double apbi = 2.0 + apb;
757 b(n-1) = pow(2.0,apb+1.0)*GammaFunction(alpha+1.0)*GammaFunction(beta+1.0)/GammaFunction(apbi);
758 a(0) = (beta-alpha)/apbi;
759 b(0) = sqrt(4.0*(1.0+alpha)*(1.0+beta)/((apbi+1.0)*apbi*apbi));
761 const double a2b2 = beta*beta-alpha*alpha;
762 for (ordinal_type i = 1; i < n-1; ++i) {
763 apbi = 2.0*(i+1) + apb;
764 a(i) = a2b2/((apbi-2.0)*apbi);
765 b(i) = sqrt(4.0*(i+1)*(i+1+alpha)*(i+1+beta)*(i+1+apb)/
766 ((apbi*apbi-1)*apbi*apbi));
771 if (n>1) a(n-1) = a2b2/((apbi-2.0)*apbi);
778 template<
typename dViewType,
780 KOKKOS_INLINE_FUNCTION
785 const ordinal_type n) {
786 ordinal_type m,l,iter,i,k;
788 typedef typename dViewType::value_type value_type;
789 value_type s,r,p,g,f,dd,c,b;
791 for (l=0; l<n; ++l) {
794 for (m=l; m<n-1; ++m) {
799 if (iter++ == MaxPolylibIteration) {
800 INTREPID2_TEST_FOR_ABORT(
true,
801 ">>> ERROR (Polylib::Serial): Too many iterations in TQLI.");
803 g=(d(l+1)-d(l))/(2.0*e(l));
809 for (i=m-1; i>=l; i--) {
824 r=(d(i)-g)*s+2.0*c*b;
837 for (i = 0; i < n-1; ++i) {
840 for (l = i+1; l < n; ++l)
850 KOKKOS_INLINE_FUNCTION
856 if (x == -0.5) gamma = -2.0*sqrt(M_PI);
857 else if (x == 0.0) gamma = 1.0;
858 else if ((x-(ordinal_type)x) == 0.5) {
859 ordinal_type n = (ordinal_type) x;
867 }
else if ((x-(ordinal_type)x) == 0.0) {
868 ordinal_type n = (ordinal_type) x;
877 INTREPID2_TEST_FOR_ABORT(
true,
878 ">>> 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.