4#include <boost/math/special_functions.hpp>
5#include <cusp/transpose.h>
6#include <cusp/array1d.h>
7#include <cusp/array2d.h>
10#include <cusp/lapack/lapack.h>
34template<
class UnaryOp>
37 return [f](
const auto& T)
39 using value_type =
typename std::decay_t<
decltype(T)>::value_type;
40 unsigned iter = T.num_rows;
41 cusp::array2d< value_type, cusp::host_memory> evecs(iter,iter);
42 cusp::array1d< value_type, cusp::host_memory> evals(iter);
49 cusp::lapack::stev(T.values.column(1), T.values.column(2),
53 cusp::coo_matrix<int, value_type, cusp::host_memory> EH, EHt;
62 catch(boost::exception& e)
91template<
class value_type>
94 return [=](
const auto& T)
96 unsigned size = T.num_rows;
97 thrust::host_vector<value_type> e1H(size, 0.), yH(e1H);
101 auto wTinv = [&w = cauchysqrtH.
w(), &T = T](
const auto&
y,
auto&
x)
106 cauchysqrtH(T, wTinv, e1H, yH, EVs, stepsCauchy, exp);
130template<
class value_type>
135 func = [](value_type
x){
return 1./sqrt(
x);};
139 return [=](
const auto& T)
141 unsigned size = T.num_rows;
162template<
class value_type>
164 value_type atol,
unsigned& number)
166 return [=, &num = number](
const auto& T)
168 unsigned size = T.num_rows;
169 HVec e1H(size, 0), yH(e1H);
173 tableau, rtol, atol, num);
192 return [= ](
const auto& T)
194 unsigned size = T.num_rows;
195 HVec e1H(size, 0), yH(e1H);
void apply(get_value_type< ContainerType1 > alpha, MatrixType &&M, const ContainerType1 &x, get_value_type< ContainerType1 > beta, ContainerType2 &y)
void transform(const ContainerType1 &x, ContainerType &y, UnaryOp op)
void pointwiseDot(get_value_type< ContainerType > alpha, const ContainerType1 &x1, const ContainerType2 &x2, get_value_type< ContainerType > beta, ContainerType &y)
void symv(MatrixType &&M, const ContainerType1 &x, ContainerType2 &y)
auto make_directODESolve(ExplicitRHS &&ode, std::string tableau, value_type epsTimerel, value_type epsTimeabs, unsigned &number, value_type t0=0., value_type t1=1.)
Operator that integrates an ODE from 0 to 1 with an adaptive ERK class as timestepper
Definition: sqrt_ode.h:38
void compute_Tinv_y(const cusp::dia_matrix< int, value_type, cusp::host_memory > &T, thrust::host_vector< value_type > &x, const thrust::host_vector< value_type > &y, value_type a=1., value_type d=0.)
Computes the value of via Thomas algorithm.
Definition: tridiaginv.h:58
void transpose(unsigned nx, unsigned ny, const ContainerType &in, ContainerType &out)
dg::MIHMatrix_t< real_type > convert(const dg::IHMatrix_t< real_type > &global, const ConversionPolicy &policy)
auto make_FuncEigen_Te1(UnaryOp f)
Create a functor that uses Eigenvalue decomposition to compute for symmetric tridiagonal T.
Definition: matrixfunction.h:35
static auto make_Linear_Te1(int exp)
Create a functor that computes directly.
Definition: matrixfunction.h:190
auto make_SqrtCauchy_Te1(int exp, std::array< value_type, 2 > EVs, unsigned stepsCauchy)
Create a functor that computes using SqrtCauchyInt.
Definition: matrixfunction.h:92
auto make_SqrtODE_Te1(int exp, std::string tableau, value_type rtol, value_type atol, unsigned &number)
Create a functor that computes using ODE solve.
Definition: matrixfunction.h:163
auto make_SqrtCauchyEigen_Te1(int exp, std::array< value_type, 2 > EVs, unsigned stepsCauchy)
Create a functor that computes using either Eigen or SqrtCauchy solve based on whichever is fastest ...
Definition: matrixfunction.h:131
thrust::host_vector< double > HVec
InvSqrtODE< Container > make_inv_sqrtodeTri(const Matrix &TH, const Container ©able)
Definition: sqrt_ode.h:167
Classes for Krylov space approximations of a Matrix-Vector product.
Cauchy integral
Definition: sqrt_cauchy.h:37
const double & w() const
The in .
Definition: sqrt_cauchy.h:60