42 #include "Teuchos_Assert.hpp" 44 template <
typename value_type>
51 Teuchos::ParameterList& solverParams) :
56 magnitude_type eps = solverParams.get(
"Bound Perturbation Size", 1e-6);
57 magnitude_type tol = solverParams.get(
"Nonlinear Solver Tolerance", 1e-10);
58 int max_it = solverParams.get(
"Maximum Nonlinear Solver Iterations", 100);
70 lambda = 2.0*
L/(
L*
L*omega*omega + 1.0);
78 lambda = 2.0*
L/(
L*
L*omega*omega + 1.0);
89 lambda = 2.0*
L/(
L*
L*omega*omega + 1.0);
96 template <
typename value_type>
106 while (Teuchos::ScalarTraits<value_type>::magnitude(
f) > tol &&
108 std::cout <<
"u = " << u <<
" f = " <<
f << std::endl;
114 TEUCHOS_TEST_FOR_EXCEPTION(nit >= max_num_its, std::logic_error,
115 "Nonlinear solver did not converge!" << std::endl);
120 template <
typename value_type>
121 template <
class Func>
130 TEUCHOS_TEST_FOR_EXCEPTION(fa*fb >
value_type(0.0), std::logic_error,
131 "Bounds [" << a <<
"," << b <<
"] must bracket the root!" << std::endl <<
132 "f(a) = " << fa <<
", f(b) = " << fb << std::endl)
146 while ((Teuchos::ScalarTraits<value_type>::magnitude(hi - low) > 2.0*tol ||
147 Teuchos::ScalarTraits<value_type>::magnitude(
f) > tol) &&
154 u = low + (hi - low)/2.0;
158 TEUCHOS_TEST_FOR_EXCEPTION(nit >= max_num_its, std::logic_error,
159 "Nonlinear solver did not converge!" << std::endl);
Teuchos::Array< eigen_pair_type > eig_pair
Eigenpairs.
value_type bisection(const Func &func, const value_type &a, const value_type &b, magnitude_type tol, int max_num_its)
A basic root finder based on bisection.
value_type newton(const Func &func, const value_type &a, const value_type &b, magnitude_type tol, int max_num_its)
A basic root finder based on Newton's method.
OneDExponentialCovarianceFunction(int M, const value_type &a, const value_type &b, const value_type &L, const int dim_name, Teuchos::ParameterList &solverParams)
Constructor.
Nonlinear function whose roots define eigenvalues for cos() eigenfunction.
Nonlinear function whose roots define eigenvalues for sin() eigenfunction.
KOKKOS_INLINE_FUNCTION PCE< Storage > atan(const PCE< Storage > &a)
Teuchos::ScalarTraits< value_type >::magnitudeType magnitude_type
ScalarType f(const Teuchos::Array< ScalarType > &x, double a, double b)
One-dimensional eigenfunction for exponential covariance function.
value_type L
Correlation length.