Loading...
Searching...
No Matches
SymEngine::EvalDoubleVisitor< T, C > Class Template Reference
+ Inheritance diagram for SymEngine::EvalDoubleVisitor< T, C >:
+ Collaboration diagram for SymEngine::EvalDoubleVisitor< T, C >:

Public Member Functions

apply (const Basic &b)
 
void bvisit (const Integer &x)
 
void bvisit (const Rational &x)
 
void bvisit (const RealDouble &x)
 
void bvisit (const Add &x)
 
void bvisit (const Mul &x)
 
void bvisit (const Pow &x)
 
void bvisit (const Sin &x)
 
void bvisit (const Cos &x)
 
void bvisit (const Tan &x)
 
void bvisit (const Symbol &)
 
void bvisit (const Log &x)
 
void bvisit (const Cot &x)
 
void bvisit (const Csc &x)
 
void bvisit (const Sec &x)
 
void bvisit (const ASin &x)
 
void bvisit (const ACos &x)
 
void bvisit (const ASec &x)
 
void bvisit (const ACsc &x)
 
void bvisit (const ATan &x)
 
void bvisit (const ACot &x)
 
void bvisit (const Sinh &x)
 
void bvisit (const Csch &x)
 
void bvisit (const Cosh &x)
 
void bvisit (const Sech &x)
 
void bvisit (const Tanh &x)
 
void bvisit (const Coth &x)
 
void bvisit (const ASinh &x)
 
void bvisit (const ACsch &x)
 
void bvisit (const ACosh &x)
 
void bvisit (const ATanh &x)
 
void bvisit (const ACoth &x)
 
void bvisit (const ASech &x)
 
void bvisit (const Constant &x)
 
void bvisit (const Abs &x)
 
void bvisit (const Basic &)
 
void bvisit (const NumberWrapper &x)
 
void bvisit (const FunctionWrapper &x)
 
void bvisit (const UnevaluatedExpr &x)
 

Protected Attributes

result_
 

Detailed Description

template<typename T, typename C>
class SymEngine::EvalDoubleVisitor< T, C >

Definition at line 9 of file eval_double.cpp.

Member Function Documentation

◆ apply()

template<typename T , typename C >
T SymEngine::EvalDoubleVisitor< T, C >::apply ( const Basic b)
inline

Definition at line 22 of file eval_double.cpp.

23 {
24 b.accept(*down_cast<C *>(this));
25 return result_;
26 }

◆ bvisit() [1/38]

template<typename T , typename C >
void SymEngine::EvalDoubleVisitor< T, C >::bvisit ( const Abs x)
inline

Definition at line 253 of file eval_double.cpp.

254 {
255 T tmp = apply(*(x.get_arg()));
256 result_ = std::abs(tmp);
257 };

◆ bvisit() [2/38]

template<typename T , typename C >
void SymEngine::EvalDoubleVisitor< T, C >::bvisit ( const ACos x)
inline

Definition at line 132 of file eval_double.cpp.

133 {
134 T tmp = apply(*(x.get_arg()));
135 result_ = std::acos(tmp);
136 };
T acos(T... args)

◆ bvisit() [3/38]

template<typename T , typename C >
void SymEngine::EvalDoubleVisitor< T, C >::bvisit ( const ACosh x)
inline

Definition at line 210 of file eval_double.cpp.

211 {
212 T tmp = apply(*(x.get_arg()));
213 result_ = std::acosh(tmp);
214 };
T acosh(T... args)

◆ bvisit() [4/38]

template<typename T , typename C >
void SymEngine::EvalDoubleVisitor< T, C >::bvisit ( const ACot x)
inline

Definition at line 156 of file eval_double.cpp.

157 {
158 T tmp = apply(*(x.get_arg()));
159 result_ = std::atan(1.0 / tmp);
160 };
T atan(T... args)

◆ bvisit() [5/38]

template<typename T , typename C >
void SymEngine::EvalDoubleVisitor< T, C >::bvisit ( const ACoth x)
inline

Definition at line 222 of file eval_double.cpp.

223 {
224 T tmp = apply(*(x.get_arg()));
225 result_ = std::atanh(1.0 / tmp);
226 };
T atanh(T... args)

◆ bvisit() [6/38]

template<typename T , typename C >
void SymEngine::EvalDoubleVisitor< T, C >::bvisit ( const ACsc x)
inline

Definition at line 144 of file eval_double.cpp.

145 {
146 T tmp = apply(*(x.get_arg()));
147 result_ = std::asin(1.0 / tmp);
148 };
T asin(T... args)

◆ bvisit() [7/38]

template<typename T , typename C >
void SymEngine::EvalDoubleVisitor< T, C >::bvisit ( const ACsch x)
inline

Definition at line 204 of file eval_double.cpp.

205 {
206 T tmp = apply(*(x.get_arg()));
207 result_ = std::asinh(1.0 / tmp);
208 };
T asinh(T... args)

◆ bvisit() [8/38]

template<typename T , typename C >
void SymEngine::EvalDoubleVisitor< T, C >::bvisit ( const Add x)
inline

Definition at line 52 of file eval_double.cpp.

53 {
54 T tmp = 0;
55 for (const auto &p : x.get_args())
56 tmp += apply(*p);
57 result_ = tmp;
58 }

◆ bvisit() [9/38]

template<typename T , typename C >
void SymEngine::EvalDoubleVisitor< T, C >::bvisit ( const ASec x)
inline

Definition at line 138 of file eval_double.cpp.

139 {
140 T tmp = apply(*(x.get_arg()));
141 result_ = std::acos(1.0 / tmp);
142 };

◆ bvisit() [10/38]

template<typename T , typename C >
void SymEngine::EvalDoubleVisitor< T, C >::bvisit ( const ASech x)
inline

Definition at line 228 of file eval_double.cpp.

229 {
230 T tmp = apply(*(x.get_arg()));
231 result_ = std::acosh(1.0 / tmp);
232 };

◆ bvisit() [11/38]

template<typename T , typename C >
void SymEngine::EvalDoubleVisitor< T, C >::bvisit ( const ASin x)
inline

Definition at line 126 of file eval_double.cpp.

127 {
128 T tmp = apply(*(x.get_arg()));
129 result_ = std::asin(tmp);
130 };

◆ bvisit() [12/38]

template<typename T , typename C >
void SymEngine::EvalDoubleVisitor< T, C >::bvisit ( const ASinh x)
inline

Definition at line 198 of file eval_double.cpp.

199 {
200 T tmp = apply(*(x.get_arg()));
201 result_ = std::asinh(tmp);
202 };

◆ bvisit() [13/38]

template<typename T , typename C >
void SymEngine::EvalDoubleVisitor< T, C >::bvisit ( const ATan x)
inline

Definition at line 150 of file eval_double.cpp.

151 {
152 T tmp = apply(*(x.get_arg()));
153 result_ = std::atan(tmp);
154 };

◆ bvisit() [14/38]

template<typename T , typename C >
void SymEngine::EvalDoubleVisitor< T, C >::bvisit ( const ATanh x)
inline

Definition at line 216 of file eval_double.cpp.

217 {
218 T tmp = apply(*(x.get_arg()));
219 result_ = std::atanh(tmp);
220 };

◆ bvisit() [15/38]

template<typename T , typename C >
void SymEngine::EvalDoubleVisitor< T, C >::bvisit ( const Basic )
inline

Definition at line 259 of file eval_double.cpp.

260 {
261 throw NotImplementedError("Not Implemented");
262 };

◆ bvisit() [16/38]

template<typename T , typename C >
void SymEngine::EvalDoubleVisitor< T, C >::bvisit ( const Constant x)
inline

Definition at line 234 of file eval_double.cpp.

235 {
236 if (eq(x, *pi)) {
237 result_ = std::atan2(0, -1);
238 } else if (eq(x, *E)) {
239 result_ = std::exp(1);
240 } else if (eq(x, *EulerGamma)) {
241 result_ = 0.5772156649015328606065; // use until polygamma or
242 // digamma is implemented
243 } else if (eq(x, *Catalan)) {
244 result_ = 0.9159655941772190150546;
245 } else if (eq(x, *GoldenRatio)) {
246 result_ = 1.6180339887498948482045;
247 } else {
248 throw NotImplementedError("Constant " + x.get_name()
249 + " is not implemented.");
250 }
251 };
T atan2(T... args)
T exp(T... args)
bool eq(const Basic &a, const Basic &b)
Checks equality for a and b
Definition: basic-inl.h:21

◆ bvisit() [17/38]

template<typename T , typename C >
void SymEngine::EvalDoubleVisitor< T, C >::bvisit ( const Cos x)
inline

Definition at line 85 of file eval_double.cpp.

86 {
87 T tmp = apply(*(x.get_arg()));
88 result_ = std::cos(tmp);
89 }
T cos(T... args)

◆ bvisit() [18/38]

template<typename T , typename C >
void SymEngine::EvalDoubleVisitor< T, C >::bvisit ( const Cosh x)
inline

Definition at line 174 of file eval_double.cpp.

175 {
176 T tmp = apply(*(x.get_arg()));
177 result_ = std::cosh(tmp);
178 };
T cosh(T... args)

◆ bvisit() [19/38]

template<typename T , typename C >
void SymEngine::EvalDoubleVisitor< T, C >::bvisit ( const Cot x)
inline

Definition at line 108 of file eval_double.cpp.

109 {
110 T tmp = apply(*(x.get_arg()));
111 result_ = 1.0 / std::tan(tmp);
112 };
T tan(T... args)

◆ bvisit() [20/38]

template<typename T , typename C >
void SymEngine::EvalDoubleVisitor< T, C >::bvisit ( const Coth x)
inline

Definition at line 192 of file eval_double.cpp.

193 {
194 T tmp = apply(*(x.get_arg()));
195 result_ = 1.0 / std::tanh(tmp);
196 };
T tanh(T... args)

◆ bvisit() [21/38]

template<typename T , typename C >
void SymEngine::EvalDoubleVisitor< T, C >::bvisit ( const Csc x)
inline

Definition at line 114 of file eval_double.cpp.

115 {
116 T tmp = apply(*(x.get_arg()));
117 result_ = 1.0 / std::sin(tmp);
118 };
T sin(T... args)

◆ bvisit() [22/38]

template<typename T , typename C >
void SymEngine::EvalDoubleVisitor< T, C >::bvisit ( const Csch x)
inline

Definition at line 168 of file eval_double.cpp.

169 {
170 T tmp = apply(*(x.get_arg()));
171 result_ = 1.0 / std::sinh(tmp);
172 };
T sinh(T... args)

◆ bvisit() [23/38]

template<typename T , typename C >
void SymEngine::EvalDoubleVisitor< T, C >::bvisit ( const FunctionWrapper x)
inline

Definition at line 269 of file eval_double.cpp.

270 {
271 apply(*(x.eval(53)));
272 }

◆ bvisit() [24/38]

template<typename T , typename C >
void SymEngine::EvalDoubleVisitor< T, C >::bvisit ( const Integer x)
inline

Definition at line 28 of file eval_double.cpp.

29 {
30 T tmp = mp_get_d(x.as_integer_class());
31 result_ = tmp;
32 }

◆ bvisit() [25/38]

template<typename T , typename C >
void SymEngine::EvalDoubleVisitor< T, C >::bvisit ( const Log x)
inline

Definition at line 102 of file eval_double.cpp.

103 {
104 T tmp = apply(*(x.get_arg()));
105 result_ = std::log(tmp);
106 };
T log(T... args)

◆ bvisit() [26/38]

template<typename T , typename C >
void SymEngine::EvalDoubleVisitor< T, C >::bvisit ( const Mul x)
inline

Definition at line 60 of file eval_double.cpp.

61 {
62 T tmp = 1;
63 for (const auto &p : x.get_args())
64 tmp *= apply(*p);
65 result_ = tmp;
66 }

◆ bvisit() [27/38]

template<typename T , typename C >
void SymEngine::EvalDoubleVisitor< T, C >::bvisit ( const NumberWrapper x)
inline

Definition at line 264 of file eval_double.cpp.

265 {
266 apply(*(x.eval(53)));
267 }

◆ bvisit() [28/38]

template<typename T , typename C >
void SymEngine::EvalDoubleVisitor< T, C >::bvisit ( const Pow x)
inline

Definition at line 68 of file eval_double.cpp.

69 {
70 T exp_ = apply(*(x.get_exp()));
71 if (eq(*(x.get_base()), *E)) {
72 result_ = std::exp(exp_);
73 } else {
74 T base_ = apply(*(x.get_base()));
75 result_ = std::pow(base_, exp_);
76 }
77 }
T pow(T... args)

◆ bvisit() [29/38]

template<typename T , typename C >
void SymEngine::EvalDoubleVisitor< T, C >::bvisit ( const Rational x)
inline

Definition at line 34 of file eval_double.cpp.

35 {
36 T tmp = mp_get_d(x.as_rational_class());
37 result_ = tmp;
38 }

◆ bvisit() [30/38]

template<typename T , typename C >
void SymEngine::EvalDoubleVisitor< T, C >::bvisit ( const RealDouble x)
inline

Definition at line 40 of file eval_double.cpp.

41 {
42 T tmp = x.i;
43 result_ = tmp;
44 }

◆ bvisit() [31/38]

template<typename T , typename C >
void SymEngine::EvalDoubleVisitor< T, C >::bvisit ( const Sec x)
inline

Definition at line 120 of file eval_double.cpp.

121 {
122 T tmp = apply(*(x.get_arg()));
123 result_ = 1.0 / std::cos(tmp);
124 };

◆ bvisit() [32/38]

template<typename T , typename C >
void SymEngine::EvalDoubleVisitor< T, C >::bvisit ( const Sech x)
inline

Definition at line 180 of file eval_double.cpp.

181 {
182 T tmp = apply(*(x.get_arg()));
183 result_ = 1.0 / std::cosh(tmp);
184 };

◆ bvisit() [33/38]

template<typename T , typename C >
void SymEngine::EvalDoubleVisitor< T, C >::bvisit ( const Sin x)
inline

Definition at line 79 of file eval_double.cpp.

80 {
81 T tmp = apply(*(x.get_arg()));
82 result_ = std::sin(tmp);
83 }

◆ bvisit() [34/38]

template<typename T , typename C >
void SymEngine::EvalDoubleVisitor< T, C >::bvisit ( const Sinh x)
inline

Definition at line 162 of file eval_double.cpp.

163 {
164 T tmp = apply(*(x.get_arg()));
165 result_ = std::sinh(tmp);
166 };

◆ bvisit() [35/38]

template<typename T , typename C >
void SymEngine::EvalDoubleVisitor< T, C >::bvisit ( const Symbol )
inline

Definition at line 97 of file eval_double.cpp.

98 {
99 throw SymEngineException("Symbol cannot be evaluated.");
100 };

◆ bvisit() [36/38]

template<typename T , typename C >
void SymEngine::EvalDoubleVisitor< T, C >::bvisit ( const Tan x)
inline

Definition at line 91 of file eval_double.cpp.

92 {
93 T tmp = apply(*(x.get_arg()));
94 result_ = std::tan(tmp);
95 }

◆ bvisit() [37/38]

template<typename T , typename C >
void SymEngine::EvalDoubleVisitor< T, C >::bvisit ( const Tanh x)
inline

Definition at line 186 of file eval_double.cpp.

187 {
188 T tmp = apply(*(x.get_arg()));
189 result_ = std::tanh(tmp);
190 };

◆ bvisit() [38/38]

template<typename T , typename C >
void SymEngine::EvalDoubleVisitor< T, C >::bvisit ( const UnevaluatedExpr x)
inline

Definition at line 274 of file eval_double.cpp.

275 {
276 apply(*x.get_arg());
277 }

Field Documentation

◆ result_

template<typename T , typename C >
T SymEngine::EvalDoubleVisitor< T, C >::result_
protected

Definition at line 19 of file eval_double.cpp.


The documentation for this class was generated from the following file: