44 #include "Teuchos_UnitTestHarness.hpp" 45 #include "Teuchos_TestingHelpers.hpp" 46 #include "Teuchos_UnitTestRepository.hpp" 47 #include "Teuchos_GlobalMPISession.hpp" 52 #ifdef HAVE_STOKHOS_FORUQTK 76 Array< RCP<const OneDOrthogPolyBasis<int,double> > > qBases(1);
79 RCP<const CompletePolynomialBasis<int,double> > qBasis =
99 Array<Array<double> > qp = quad_->getQuadPoints();
100 Array<double> qw = quad_->getQuadWeights();
103 for (
int n=0; n<=nMax; n++)
105 double nFact = tgamma(n+1.0);
106 cout <<
"n=" << n << endl;
107 for (
double x=-1.0;
x<=1.0;
x+=0.25)
109 cout << setw(20) <<
x << setw(20) << basis.
evaluate(
x, n)
112 for (
int m=0; m<=nMax; m++)
115 for (
int q=0; q<qw.size(); q++)
118 double w = qw[q] *
pow(1-
x,alpha)*
pow(1+
x,beta);
125 exact =
pow(2.0, alpha+beta+1.0)/(2.0*n+alpha+beta+1.0)
126 * tgamma(n+alpha+1.0)*tgamma(n+beta+1.0)
127 /tgamma(n+alpha+beta+1.0)/nFact;
128 double err =
fabs(exact -
sum);
129 cout << setw(4) << n << setw(4) << m
130 << setw(20) << exact << setw(20) <<
sum << setw(20) << err
138 cout <<
"***** FAIL ******" << endl;
145 RCP<Quadrature<int, double> >
quad_;
154 Teuchos::GlobalMPISession mpiSession(&argc, &
argv);
159 for (
double alpha = 0.75; alpha <= 2.0; alpha += 0.25)
161 for (
double beta = 0.75; beta <= alpha; beta += 0.25)
163 cout <<
"alpha=" << setw(20) << alpha
164 <<
" beta=" << setw(20) << beta << endl;
172 cout <<
"Jacobi tests PASSED!" << endl;
173 cout <<
"End Result: TEST PASSED" << endl;
178 cout <<
"Jacobi tests FAILED ***" << endl;
KOKKOS_INLINE_FUNCTION PCE< Storage > fabs(const PCE< Storage > &a)
virtual value_type evaluate(const value_type &point, ordinal_type order) const
Evaluate basis polynomial given by order order at given point point.
RCP< Quadrature< int, double > > quad_
KOKKOS_INLINE_FUNCTION PCE< Storage > pow(const PCE< Storage > &a, const PCE< Storage > &b)
JacobiTester(int quadOrder)
std::enable_if< Kokkos::is_view_uq_pce< Kokkos::View< RD, RP... > >::value &&Kokkos::is_view_uq_pce< Kokkos::View< XD, XP... > >::value >::type sum(const Kokkos::View< RD, RP... > &r, const Kokkos::View< XD, XP... > &x)
const IndexType const IndexType const IndexType const IndexType const ValueType const ValueType * x
Top-level namespace for Stokhos classes and functions.
int main(int argc, char *argv[])
Multivariate orthogonal polynomial basis generated from a total-order complete-polynomial tensor prod...
Legendre polynomial basis.
bool testInnerProduct(double alpha, double beta, int nMax) const
Defines quadrature for a tensor product basis by tensor products of 1-D quadrature rules...