real_mpfr.cpp
1 
6 #include <symengine/complex_mpc.h>
7 #include <symengine/eval_mpfr.h>
8 
9 #ifdef HAVE_SYMENGINE_MPFR
10 
11 namespace SymEngine
12 {
13 
14 RealMPFR::RealMPFR(mpfr_class i)
15  : i{std::move(i)} {SYMENGINE_ASSIGN_TYPEID()}
16 
17  hash_t RealMPFR::__hash__() const
18 {
19  hash_t seed = SYMENGINE_REAL_MPFR;
20  hash_combine_impl(seed, i.get_mpfr_t());
21  return seed;
22 }
23 
24 void hash_combine_impl(hash_t &seed, mpfr_srcptr s)
25 {
26  hash_combine(seed, mpfr_get_exp(s));
27  hash_combine(seed, mpfr_sgn(s));
28  hash_combine(seed, mpfr_get_prec(s));
29  hash_combine(seed, s->_mpfr_d[0]);
30 }
31 
32 bool RealMPFR::__eq__(const Basic &o) const
33 {
34  if (is_a<RealMPFR>(o)) {
35  const RealMPFR &s = down_cast<const RealMPFR &>(o);
36  if (get_prec() == s.get_prec()) {
37  return mpfr_cmp(this->i.get_mpfr_t(), s.i.get_mpfr_t()) == 0;
38  }
39  }
40  return false;
41 }
42 
43 int RealMPFR::compare(const Basic &o) const
44 {
45  SYMENGINE_ASSERT(is_a<RealMPFR>(o))
46  const RealMPFR &s = down_cast<const RealMPFR &>(o);
47  if (get_prec() == s.get_prec()) {
48  int cmp = mpfr_cmp(this->i.get_mpfr_t(), s.i.get_mpfr_t());
49  if (cmp == 0)
50  return 0;
51  return cmp > 0 ? 1 : -1;
52  } else {
53  return get_prec() > s.get_prec() ? 1 : -1;
54  }
55 }
56 
60 RCP<const Number> RealMPFR::addreal(const Integer &other) const
61 {
62  mpfr_class t(get_prec());
63  mpfr_add_z(t.get_mpfr_t(), i.get_mpfr_t(),
64  get_mpz_t(other.as_integer_class()), MPFR_RNDN);
65  return rcp(new RealMPFR(std::move(t)));
66 }
67 
71 RCP<const Number> RealMPFR::addreal(const Rational &other) const
72 {
73  mpfr_class t(get_prec());
74  mpfr_add_q(t.get_mpfr_t(), i.get_mpfr_t(),
75  get_mpq_t(other.as_rational_class()), MPFR_RNDN);
76  return rcp(new RealMPFR(std::move(t)));
77 }
78 
82 RCP<const Number> RealMPFR::addreal(const Complex &other) const
83 {
84 #ifdef HAVE_SYMENGINE_MPC
85  mpc_class t(get_prec());
86  mpc_set_q_q(t.get_mpc_t(), get_mpq_t(other.real_),
87  get_mpq_t(other.imaginary_), MPFR_RNDN);
88  mpc_add_fr(t.get_mpc_t(), t.get_mpc_t(), this->i.get_mpfr_t(), MPFR_RNDN);
89  return complex_mpc(std::move(t));
90 #else
91  throw SymEngineException("Result is complex. Recompile with MPC support.");
92 #endif
93 }
94 
98 RCP<const Number> RealMPFR::addreal(const RealDouble &other) const
99 {
100  mpfr_class t(get_prec());
101  mpfr_add_d(t.get_mpfr_t(), i.get_mpfr_t(), other.i, MPFR_RNDN);
102  return rcp(new RealMPFR(std::move(t)));
103 }
104 
108 RCP<const Number> RealMPFR::addreal(const ComplexDouble &other) const
109 {
110 #ifdef HAVE_SYMENGINE_MPC
111  mpc_class t(get_prec());
112  mpc_set_d_d(t.get_mpc_t(), other.i.real(), other.i.imag(), MPFR_RNDN);
113  mpc_add_fr(t.get_mpc_t(), t.get_mpc_t(), this->i.get_mpfr_t(), MPFR_RNDN);
114  return complex_mpc(std::move(t));
115 #else
116  throw SymEngineException("Result is complex. Recompile with MPC support.");
117 #endif
118 }
119 
123 RCP<const Number> RealMPFR::addreal(const RealMPFR &other) const
124 {
125  mpfr_class t(std::max(get_prec(), other.get_prec()));
126  mpfr_add(t.get_mpfr_t(), i.get_mpfr_t(), other.i.get_mpfr_t(), MPFR_RNDN);
127  return rcp(new RealMPFR(std::move(t)));
128 }
129 
133 RCP<const Number> RealMPFR::subreal(const Integer &other) const
134 {
135  mpfr_class t(get_prec());
136  mpfr_sub_z(t.get_mpfr_t(), i.get_mpfr_t(),
137  get_mpz_t(other.as_integer_class()), MPFR_RNDN);
138  return rcp(new RealMPFR(std::move(t)));
139 }
140 
144 RCP<const Number> RealMPFR::subreal(const Rational &other) const
145 {
146  mpfr_class t(get_prec());
147  mpfr_sub_q(t.get_mpfr_t(), i.get_mpfr_t(),
148  get_mpq_t(other.as_rational_class()), MPFR_RNDN);
149  return rcp(new RealMPFR(std::move(t)));
150 }
151 
155 RCP<const Number> RealMPFR::subreal(const Complex &other) const
156 {
157 #ifdef HAVE_SYMENGINE_MPC
158  mpc_class t(get_prec());
159  mpc_set_q_q(t.get_mpc_t(), get_mpq_t(other.real_),
160  get_mpq_t(other.imaginary_), MPFR_RNDN);
161  mpc_sub_fr(t.get_mpc_t(), t.get_mpc_t(), this->i.get_mpfr_t(), MPFR_RNDN);
162  return complex_mpc(std::move(t));
163 #else
164  throw SymEngineException("Result is complex. Recompile with MPC support.");
165 #endif
166 }
167 
171 RCP<const Number> RealMPFR::subreal(const RealDouble &other) const
172 {
173  mpfr_class t(get_prec());
174  mpfr_sub_d(t.get_mpfr_t(), i.get_mpfr_t(), other.i, MPFR_RNDN);
175  return rcp(new RealMPFR(std::move(t)));
176 }
177 
181 RCP<const Number> RealMPFR::subreal(const ComplexDouble &other) const
182 {
183 #ifdef HAVE_SYMENGINE_MPC
184  mpc_class t(get_prec());
185  mpc_set_d_d(t.get_mpc_t(), other.i.real(), other.i.imag(), MPFR_RNDN);
186  mpc_sub_fr(t.get_mpc_t(), t.get_mpc_t(), this->i.get_mpfr_t(), MPFR_RNDN);
187  return complex_mpc(std::move(t));
188 #else
189  throw SymEngineException("Result is complex. Recompile with MPC support.");
190 #endif
191 }
192 
196 RCP<const Number> RealMPFR::subreal(const RealMPFR &other) const
197 {
198  mpfr_class t(std::max(get_prec(), other.get_prec()));
199  mpfr_sub(t.get_mpfr_t(), i.get_mpfr_t(), other.i.get_mpfr_t(), MPFR_RNDN);
200  return rcp(new RealMPFR(std::move(t)));
201 }
202 
206 RCP<const Number> RealMPFR::rsubreal(const Integer &other) const
207 {
208  mpfr_class t(get_prec());
209  mpfr_z_sub(t.get_mpfr_t(), get_mpz_t(other.as_integer_class()),
210  i.get_mpfr_t(), MPFR_RNDN);
211  return rcp(new RealMPFR(std::move(t)));
212 }
213 
217 RCP<const Number> RealMPFR::rsubreal(const Rational &other) const
218 {
219  mpfr_class t(get_prec());
220  mpfr_sub_q(t.get_mpfr_t(), i.get_mpfr_t(),
221  get_mpq_t(other.as_rational_class()), MPFR_RNDN);
222  mpfr_neg(t.get_mpfr_t(), t.get_mpfr_t(), MPFR_RNDN);
223  return rcp(new RealMPFR(std::move(t)));
224 }
225 
229 RCP<const Number> RealMPFR::rsubreal(const Complex &other) const
230 {
231 #ifdef HAVE_SYMENGINE_MPC
232  mpc_class t(get_prec());
233  mpc_set_q_q(t.get_mpc_t(), get_mpq_t(other.real_),
234  get_mpq_t(other.imaginary_), MPFR_RNDN);
235  mpc_fr_sub(t.get_mpc_t(), this->i.get_mpfr_t(), t.get_mpc_t(), MPFR_RNDN);
236  return complex_mpc(std::move(t));
237 #else
238  throw SymEngineException("Result is complex. Recompile with MPC support.");
239 #endif
240 }
241 
245 RCP<const Number> RealMPFR::rsubreal(const RealDouble &other) const
246 {
247  mpfr_class t(get_prec());
248  mpfr_d_sub(t.get_mpfr_t(), other.i, i.get_mpfr_t(), MPFR_RNDN);
249  return rcp(new RealMPFR(std::move(t)));
250 }
251 
255 RCP<const Number> RealMPFR::rsubreal(const ComplexDouble &other) const
256 {
257 #ifdef HAVE_SYMENGINE_MPC
258  mpc_class t(get_prec());
259  mpc_set_d_d(t.get_mpc_t(), other.i.real(), other.i.imag(), MPFR_RNDN);
260  mpc_fr_sub(t.get_mpc_t(), this->i.get_mpfr_t(), t.get_mpc_t(), MPFR_RNDN);
261  return complex_mpc(std::move(t));
262 #else
263  throw SymEngineException("Result is complex. Recompile with MPC support.");
264 #endif
265 }
266 
270 RCP<const Number> RealMPFR::mulreal(const Integer &other) const
271 {
272  if (other.is_zero()) {
273  return zero;
274  }
275  mpfr_class t(get_prec());
276  mpfr_mul_z(t.get_mpfr_t(), i.get_mpfr_t(),
277  get_mpz_t(other.as_integer_class()), MPFR_RNDN);
278  return rcp(new RealMPFR(std::move(t)));
279 }
280 
284 RCP<const Number> RealMPFR::mulreal(const Rational &other) const
285 {
286  mpfr_class t(get_prec());
287  mpfr_mul_q(t.get_mpfr_t(), i.get_mpfr_t(),
288  get_mpq_t(other.as_rational_class()), MPFR_RNDN);
289  return rcp(new RealMPFR(std::move(t)));
290 }
291 
295 RCP<const Number> RealMPFR::mulreal(const Complex &other) const
296 {
297 #ifdef HAVE_SYMENGINE_MPC
298  mpc_class t(get_prec());
299  mpc_set_q_q(t.get_mpc_t(), get_mpq_t(other.real_),
300  get_mpq_t(other.imaginary_), MPFR_RNDN);
301  mpc_mul_fr(t.get_mpc_t(), t.get_mpc_t(), this->i.get_mpfr_t(), MPFR_RNDN);
302  return complex_mpc(std::move(t));
303 #else
304  throw SymEngineException("Result is complex. Recompile with MPC support.");
305 #endif
306 }
307 
311 RCP<const Number> RealMPFR::mulreal(const RealDouble &other) const
312 {
313  mpfr_class t(get_prec());
314  mpfr_mul_d(t.get_mpfr_t(), i.get_mpfr_t(), other.i, MPFR_RNDN);
315  return rcp(new RealMPFR(std::move(t)));
316 }
317 
321 RCP<const Number> RealMPFR::mulreal(const ComplexDouble &other) const
322 {
323 #ifdef HAVE_SYMENGINE_MPC
324  mpc_class t(get_prec());
325  mpc_set_d_d(t.get_mpc_t(), other.i.real(), other.i.imag(), MPFR_RNDN);
326  mpc_mul_fr(t.get_mpc_t(), t.get_mpc_t(), this->i.get_mpfr_t(), MPFR_RNDN);
327  return complex_mpc(std::move(t));
328 #else
329  throw SymEngineException("Result is complex. Recompile with MPC support.");
330 #endif
331 }
332 
336 RCP<const Number> RealMPFR::mulreal(const RealMPFR &other) const
337 {
338  mpfr_class t(std::max(get_prec(), other.get_prec()));
339  mpfr_mul(t.get_mpfr_t(), i.get_mpfr_t(), other.i.get_mpfr_t(), MPFR_RNDN);
340  return rcp(new RealMPFR(std::move(t)));
341 }
342 
346 RCP<const Number> RealMPFR::divreal(const Integer &other) const
347 {
348  mpfr_class t(get_prec());
349  mpfr_div_z(t.get_mpfr_t(), i.get_mpfr_t(),
350  get_mpz_t(other.as_integer_class()), MPFR_RNDN);
351  return rcp(new RealMPFR(std::move(t)));
352 }
353 
357 RCP<const Number> RealMPFR::divreal(const Rational &other) const
358 {
359  mpfr_class t(get_prec());
360  mpfr_div_q(t.get_mpfr_t(), i.get_mpfr_t(),
361  get_mpq_t(other.as_rational_class()), MPFR_RNDN);
362  return rcp(new RealMPFR(std::move(t)));
363 }
364 
368 RCP<const Number> RealMPFR::divreal(const Complex &other) const
369 {
370 #ifdef HAVE_SYMENGINE_MPC
371  mpc_class t(get_prec());
372  mpc_set_q_q(t.get_mpc_t(), get_mpq_t(other.real_),
373  get_mpq_t(other.imaginary_), MPFR_RNDN);
374  mpc_div_fr(t.get_mpc_t(), t.get_mpc_t(), this->i.get_mpfr_t(), MPFR_RNDN);
375  return complex_mpc(std::move(t));
376 #else
377  throw SymEngineException("Result is complex. Recompile with MPC support.");
378 #endif
379 }
380 
384 RCP<const Number> RealMPFR::divreal(const RealDouble &other) const
385 {
386  mpfr_class t(get_prec());
387  mpfr_div_d(t.get_mpfr_t(), i.get_mpfr_t(), other.i, MPFR_RNDN);
388  return rcp(new RealMPFR(std::move(t)));
389 }
390 
394 RCP<const Number> RealMPFR::divreal(const ComplexDouble &other) const
395 {
396 #ifdef HAVE_SYMENGINE_MPC
397  mpc_class t(get_prec());
398  mpc_set_d_d(t.get_mpc_t(), other.i.real(), other.i.imag(), MPFR_RNDN);
399  mpc_div_fr(t.get_mpc_t(), t.get_mpc_t(), this->i.get_mpfr_t(), MPFR_RNDN);
400  return complex_mpc(std::move(t));
401 #else
402  throw SymEngineException("Result is complex. Recompile with MPC support.");
403 #endif
404 }
405 
409 RCP<const Number> RealMPFR::divreal(const RealMPFR &other) const
410 {
411  mpfr_class t(std::max(get_prec(), other.get_prec()));
412  mpfr_div(t.get_mpfr_t(), i.get_mpfr_t(), other.i.get_mpfr_t(), MPFR_RNDN);
413  return rcp(new RealMPFR(std::move(t)));
414 }
415 
419 RCP<const Number> RealMPFR::rdivreal(const Integer &other) const
420 {
421  mpfr_class t(get_prec());
422  mpfr_div_z(t.get_mpfr_t(), i.get_mpfr_t(),
423  get_mpz_t(other.as_integer_class()), MPFR_RNDN);
424  mpfr_pow_si(t.get_mpfr_t(), t.get_mpfr_t(), -1, MPFR_RNDN);
425  return rcp(new RealMPFR(std::move(t)));
426 }
427 
431 RCP<const Number> RealMPFR::rdivreal(const Rational &other) const
432 {
433  mpfr_class t(get_prec());
434  mpfr_div_q(t.get_mpfr_t(), i.get_mpfr_t(),
435  get_mpq_t(other.as_rational_class()), MPFR_RNDN);
436  mpfr_pow_si(t.get_mpfr_t(), t.get_mpfr_t(), -1, MPFR_RNDN);
437  return rcp(new RealMPFR(std::move(t)));
438 }
439 
443 RCP<const Number> RealMPFR::rdivreal(const Complex &other) const
444 {
445 #ifdef HAVE_SYMENGINE_MPC
446  mpc_class t(get_prec());
447  mpc_set_q_q(t.get_mpc_t(), get_mpq_t(other.real_),
448  get_mpq_t(other.imaginary_), MPFR_RNDN);
449  mpc_fr_div(t.get_mpc_t(), this->i.get_mpfr_t(), t.get_mpc_t(), MPFR_RNDN);
450  return complex_mpc(std::move(t));
451 #else
452  throw SymEngineException("Result is complex. Recompile with MPC support.");
453 #endif
454 }
455 
459 RCP<const Number> RealMPFR::rdivreal(const RealDouble &other) const
460 {
461  mpfr_class t(get_prec());
462  mpfr_d_div(t.get_mpfr_t(), other.i, i.get_mpfr_t(), MPFR_RNDN);
463  return rcp(new RealMPFR(std::move(t)));
464 }
465 
469 RCP<const Number> RealMPFR::rdivreal(const ComplexDouble &other) const
470 {
471 #ifdef HAVE_SYMENGINE_MPC
472  mpc_class t(get_prec());
473  mpc_set_d_d(t.get_mpc_t(), other.i.real(), other.i.imag(), MPFR_RNDN);
474  mpc_fr_div(t.get_mpc_t(), this->i.get_mpfr_t(), t.get_mpc_t(), MPFR_RNDN);
475  return complex_mpc(std::move(t));
476 #else
477  throw SymEngineException("Result is complex. Recompile with MPC support.");
478 #endif
479 }
480 
484 RCP<const Number> RealMPFR::powreal(const Integer &other) const
485 {
486  mpfr_class t(get_prec());
487  mpfr_pow_z(t.get_mpfr_t(), i.get_mpfr_t(),
488  get_mpz_t(other.as_integer_class()), MPFR_RNDN);
489  return rcp(new RealMPFR(std::move(t)));
490 }
491 
495 RCP<const Number> RealMPFR::powreal(const Rational &other) const
496 {
497  if (mpfr_cmp_si(i.get_mpfr_t(), 0) < 0) {
498 #ifdef HAVE_SYMENGINE_MPC
499  mpc_class t(get_prec()), s(get_prec());
500  mpc_set_q(t.get_mpc_t(), get_mpq_t(other.as_rational_class()),
501  MPFR_RNDN);
502  mpc_set_fr(s.get_mpc_t(), this->i.get_mpfr_t(), MPFR_RNDN);
503  mpc_pow(t.get_mpc_t(), s.get_mpc_t(), t.get_mpc_t(), MPFR_RNDN);
504  return complex_mpc(std::move(t));
505 #else
506  throw SymEngineException(
507  "Result is complex. Recompile with MPC support.");
508 #endif
509  }
510  mpfr_class t(get_prec());
511  mpfr_set_q(t.get_mpfr_t(), get_mpq_t(other.as_rational_class()), MPFR_RNDN);
512  mpfr_pow(t.get_mpfr_t(), i.get_mpfr_t(), t.get_mpfr_t(), MPFR_RNDN);
513  return rcp(new RealMPFR(std::move(t)));
514 }
515 
519 RCP<const Number> RealMPFR::powreal(const Complex &other) const
520 {
521 #ifdef HAVE_SYMENGINE_MPC
522  mpc_class t(get_prec());
523  mpc_set_q_q(t.get_mpc_t(), get_mpq_t(other.real_),
524  get_mpq_t(other.imaginary_), MPFR_RNDN);
525  mpc_pow_fr(t.get_mpc_t(), t.get_mpc_t(), this->i.get_mpfr_t(), MPFR_RNDN);
526  return complex_mpc(std::move(t));
527 #else
528  throw SymEngineException("Result is complex. Recompile with MPC support.");
529 #endif
530 }
531 
535 RCP<const Number> RealMPFR::powreal(const RealDouble &other) const
536 {
537  if (mpfr_cmp_si(i.get_mpfr_t(), 0) < 0) {
538 #ifdef HAVE_SYMENGINE_MPC
539  mpc_class t(get_prec());
540  mpc_set_fr(t.get_mpc_t(), this->i.get_mpfr_t(), MPFR_RNDN);
541  mpc_pow_d(t.get_mpc_t(), t.get_mpc_t(), other.i, MPFR_RNDN);
542  return complex_mpc(std::move(t));
543 #else
544  throw SymEngineException(
545  "Result is complex. Recompile with MPC support.");
546 #endif
547  }
548  mpfr_class t(get_prec());
549  mpfr_set_d(t.get_mpfr_t(), other.i, MPFR_RNDN);
550  mpfr_pow(t.get_mpfr_t(), i.get_mpfr_t(), t.get_mpfr_t(), MPFR_RNDN);
551  return rcp(new RealMPFR(std::move(t)));
552 }
553 
557 RCP<const Number> RealMPFR::powreal(const ComplexDouble &other) const
558 {
559 #ifdef HAVE_SYMENGINE_MPC
560  mpc_class t(get_prec()), s(get_prec());
561  mpc_set_d_d(t.get_mpc_t(), other.i.real(), other.i.imag(), MPFR_RNDN);
562  mpc_set_fr(s.get_mpc_t(), this->i.get_mpfr_t(), MPFR_RNDN);
563  mpc_pow(t.get_mpc_t(), s.get_mpc_t(), t.get_mpc_t(), MPFR_RNDN);
564  return complex_mpc(std::move(t));
565 #else
566  throw SymEngineException("Result is complex. Recompile with MPC support.");
567 #endif
568 }
569 
573 RCP<const Number> RealMPFR::powreal(const RealMPFR &other) const
574 {
575  if (mpfr_cmp_si(i.get_mpfr_t(), 0) < 0) {
576 #ifdef HAVE_SYMENGINE_MPC
577  mpc_class t(get_prec());
578  mpc_set_fr(t.get_mpc_t(), this->i.get_mpfr_t(), MPFR_RNDN);
579  mpc_pow_fr(t.get_mpc_t(), t.get_mpc_t(), other.i.get_mpfr_t(),
580  MPFR_RNDN);
581  return complex_mpc(std::move(t));
582 #else
583  throw SymEngineException(
584  "Result is complex. Recompile with MPC support.");
585 #endif
586  }
587  mpfr_class t(std::max(get_prec(), other.get_prec()));
588  mpfr_pow(t.get_mpfr_t(), i.get_mpfr_t(), other.i.get_mpfr_t(), MPFR_RNDN);
589  return rcp(new RealMPFR(std::move(t)));
590 }
591 
595 RCP<const Number> RealMPFR::rpowreal(const Integer &other) const
596 {
597  if (other.is_negative()) {
598 #ifdef HAVE_SYMENGINE_MPC
599  mpc_class t(get_prec()), s(get_prec());
600  mpc_set_z(t.get_mpc_t(), get_mpz_t(other.as_integer_class()),
601  MPFR_RNDN);
602  mpc_set_fr(s.get_mpc_t(), this->i.get_mpfr_t(), MPFR_RNDN);
603  mpc_pow(t.get_mpc_t(), t.get_mpc_t(), s.get_mpc_t(), MPFR_RNDN);
604  return complex_mpc(std::move(t));
605 #else
606  throw SymEngineException(
607  "Result is complex. Recompile with MPC support.");
608 #endif
609  }
610  mpfr_class t(get_prec());
611  mpfr_set_z(t.get_mpfr_t(), get_mpz_t(other.as_integer_class()), MPFR_RNDN);
612  mpfr_pow(t.get_mpfr_t(), t.get_mpfr_t(), i.get_mpfr_t(), MPFR_RNDN);
613  return rcp(new RealMPFR(std::move(t)));
614 }
615 
619 RCP<const Number> RealMPFR::rpowreal(const Rational &other) const
620 {
621  if (other.is_negative()) {
622 #ifdef HAVE_SYMENGINE_MPC
623  mpc_class t(get_prec()), s(get_prec());
624  mpc_set_q(t.get_mpc_t(), get_mpq_t(other.as_rational_class()),
625  MPFR_RNDN);
626  mpc_set_fr(s.get_mpc_t(), this->i.get_mpfr_t(), MPFR_RNDN);
627  mpc_pow(t.get_mpc_t(), t.get_mpc_t(), s.get_mpc_t(), MPFR_RNDN);
628  return complex_mpc(std::move(t));
629 #else
630  throw SymEngineException(
631  "Result is complex. Recompile with MPC support.");
632 #endif
633  }
634  mpfr_class t(get_prec());
635  mpfr_set_q(t.get_mpfr_t(), get_mpq_t(other.as_rational_class()), MPFR_RNDN);
636  mpfr_pow(t.get_mpfr_t(), t.get_mpfr_t(), i.get_mpfr_t(), MPFR_RNDN);
637  return rcp(new RealMPFR(std::move(t)));
638 }
639 
643 RCP<const Number> RealMPFR::rpowreal(const Complex &other) const
644 {
645 #ifdef HAVE_SYMENGINE_MPC
646  mpc_class t(get_prec()), s(get_prec());
647  mpc_set_q_q(t.get_mpc_t(), get_mpq_t(other.real_),
648  get_mpq_t(other.imaginary_), MPFR_RNDN);
649  mpc_set_fr(s.get_mpc_t(), this->i.get_mpfr_t(), MPFR_RNDN);
650  mpc_pow(t.get_mpc_t(), s.get_mpc_t(), t.get_mpc_t(), MPFR_RNDN);
651  return complex_mpc(std::move(t));
652 #else
653  throw SymEngineException("Result is complex. Recompile with MPC support.");
654 #endif
655 }
656 
660 RCP<const Number> RealMPFR::rpowreal(const RealDouble &other) const
661 {
662  if (mpfr_cmp_si(i.get_mpfr_t(), 0) < 0) {
663 #ifdef HAVE_SYMENGINE_MPC
664  mpc_class t(get_prec()), s(get_prec());
665  mpc_set_d(t.get_mpc_t(), other.i, MPFR_RNDN);
666  mpc_set_fr(s.get_mpc_t(), this->i.get_mpfr_t(), MPFR_RNDN);
667  mpc_pow(t.get_mpc_t(), t.get_mpc_t(), s.get_mpc_t(), MPFR_RNDN);
668  return complex_mpc(std::move(t));
669 #else
670  throw SymEngineException(
671  "Result is complex. Recompile with MPC support.");
672 #endif
673  }
674  mpfr_class t(get_prec());
675  mpfr_set_d(t.get_mpfr_t(), other.i, MPFR_RNDN);
676  mpfr_pow(t.get_mpfr_t(), t.get_mpfr_t(), i.get_mpfr_t(), MPFR_RNDN);
677  return rcp(new RealMPFR(std::move(t)));
678 }
679 
683 RCP<const Number> RealMPFR::rpowreal(const ComplexDouble &other) const
684 {
685 #ifdef HAVE_SYMENGINE_MPC
686  mpc_class t(get_prec()), s(get_prec());
687  mpc_set_d_d(t.get_mpc_t(), other.i.real(), other.i.imag(), MPFR_RNDN);
688  mpc_set_fr(s.get_mpc_t(), this->i.get_mpfr_t(), MPFR_RNDN);
689  mpc_pow(t.get_mpc_t(), t.get_mpc_t(), s.get_mpc_t(), MPFR_RNDN);
690  return complex_mpc(std::move(t));
691 #else
692  throw SymEngineException("Result is complex. Recompile with MPC support.");
693 #endif
694 }
695 
697 class EvaluateMPFR : public Evaluate
698 {
699  virtual RCP<const Basic> sin(const Basic &x) const override
700  {
701  SYMENGINE_ASSERT(is_a<RealMPFR>(x))
702  mpfr_class t(down_cast<const RealMPFR &>(x).i.get_prec());
703  mpfr_sin(t.get_mpfr_t(), down_cast<const RealMPFR &>(x).i.get_mpfr_t(),
704  MPFR_RNDN);
705  return real_mpfr(std::move(t));
706  }
707  virtual RCP<const Basic> cos(const Basic &x) const override
708  {
709  SYMENGINE_ASSERT(is_a<RealMPFR>(x))
710  mpfr_class t(down_cast<const RealMPFR &>(x).i.get_prec());
711  mpfr_cos(t.get_mpfr_t(), down_cast<const RealMPFR &>(x).i.get_mpfr_t(),
712  MPFR_RNDN);
713  return real_mpfr(std::move(t));
714  }
715  virtual RCP<const Basic> tan(const Basic &x) const override
716  {
717  SYMENGINE_ASSERT(is_a<RealMPFR>(x))
718  mpfr_class t(down_cast<const RealMPFR &>(x).i.get_prec());
719  mpfr_tan(t.get_mpfr_t(), down_cast<const RealMPFR &>(x).i.get_mpfr_t(),
720  MPFR_RNDN);
721  return real_mpfr(std::move(t));
722  }
723  virtual RCP<const Basic> cot(const Basic &x) const override
724  {
725  SYMENGINE_ASSERT(is_a<RealMPFR>(x))
726  mpfr_class t(down_cast<const RealMPFR &>(x).i.get_prec());
727  mpfr_cot(t.get_mpfr_t(), down_cast<const RealMPFR &>(x).i.get_mpfr_t(),
728  MPFR_RNDN);
729  return real_mpfr(std::move(t));
730  }
731  virtual RCP<const Basic> sec(const Basic &x) const override
732  {
733  SYMENGINE_ASSERT(is_a<RealMPFR>(x))
734  mpfr_class t(down_cast<const RealMPFR &>(x).i.get_prec());
735  mpfr_sec(t.get_mpfr_t(), down_cast<const RealMPFR &>(x).i.get_mpfr_t(),
736  MPFR_RNDN);
737  return real_mpfr(std::move(t));
738  }
739  virtual RCP<const Basic> csc(const Basic &x) const override
740  {
741  SYMENGINE_ASSERT(is_a<RealMPFR>(x))
742  mpfr_class t(down_cast<const RealMPFR &>(x).i.get_prec());
743  mpfr_csc(t.get_mpfr_t(), down_cast<const RealMPFR &>(x).i.get_mpfr_t(),
744  MPFR_RNDN);
745  return real_mpfr(std::move(t));
746  }
747  virtual RCP<const Basic> asin(const Basic &x) const override
748  {
749  SYMENGINE_ASSERT(is_a<RealMPFR>(x))
750  mpfr_srcptr x_ = down_cast<const RealMPFR &>(x).i.get_mpfr_t();
751  if (mpfr_cmp_si(x_, 1) <= 0 and mpfr_cmp_si(x_, -1) >= 0) {
752  mpfr_class t(mpfr_get_prec(x_));
753  mpfr_asin(t.get_mpfr_t(), x_, MPFR_RNDN);
754  return real_mpfr(std::move(t));
755  }
756 #ifdef HAVE_SYMENGINE_MPC
757  mpc_class t(mpfr_get_prec(x_));
758  mpc_set_fr(t.get_mpc_t(), x_, MPFR_RNDN);
759  mpc_asin(t.get_mpc_t(), t.get_mpc_t(), MPFR_RNDN);
760  return complex_mpc(std::move(t));
761 #else
762  throw SymEngineException(
763  "Result is complex. Recompile with MPC support.");
764 #endif
765  }
766  virtual RCP<const Basic> acos(const Basic &x) const override
767  {
768  SYMENGINE_ASSERT(is_a<RealMPFR>(x))
769  mpfr_srcptr x_ = down_cast<const RealMPFR &>(x).i.get_mpfr_t();
770  if (mpfr_cmp_si(x_, 1) <= 0 and mpfr_cmp_si(x_, -1) >= 0) {
771  mpfr_class t(mpfr_get_prec(x_));
772  mpfr_acos(t.get_mpfr_t(), x_, MPFR_RNDN);
773  return real_mpfr(std::move(t));
774  }
775 #ifdef HAVE_SYMENGINE_MPC
776  mpc_class t(mpfr_get_prec(x_));
777  mpc_set_fr(t.get_mpc_t(), x_, MPFR_RNDN);
778  mpc_acos(t.get_mpc_t(), t.get_mpc_t(), MPFR_RNDN);
779  return complex_mpc(std::move(t));
780 #else
781  throw SymEngineException(
782  "Result is complex. Recompile with MPC support.");
783 #endif
784  }
785  virtual RCP<const Basic> atan(const Basic &x) const override
786  {
787  SYMENGINE_ASSERT(is_a<RealMPFR>(x))
788  mpfr_class t(down_cast<const RealMPFR &>(x).i.get_prec());
789  mpfr_atan(t.get_mpfr_t(), down_cast<const RealMPFR &>(x).i.get_mpfr_t(),
790  MPFR_RNDN);
791  return real_mpfr(std::move(t));
792  }
793  virtual RCP<const Basic> acot(const Basic &x) const override
794  {
795  SYMENGINE_ASSERT(is_a<RealMPFR>(x))
796  mpfr_class t(down_cast<const RealMPFR &>(x).i.get_prec());
797  mpfr_ui_div(t.get_mpfr_t(), 1,
798  down_cast<const RealMPFR &>(x).i.get_mpfr_t(), MPFR_RNDN);
799  mpfr_atan(t.get_mpfr_t(), t.get_mpfr_t(), MPFR_RNDN);
800  return real_mpfr(std::move(t));
801  }
802  virtual RCP<const Basic> asec(const Basic &x) const override
803  {
804  SYMENGINE_ASSERT(is_a<RealMPFR>(x))
805  mpfr_srcptr x_ = down_cast<const RealMPFR &>(x).i.get_mpfr_t();
806  if (mpfr_cmp_si(x_, 1) >= 0 or mpfr_cmp_si(x_, -1) <= 0) {
807  mpfr_class t(mpfr_get_prec(x_));
808  mpfr_ui_div(t.get_mpfr_t(), 1, x_, MPFR_RNDN);
809  mpfr_acos(t.get_mpfr_t(), t.get_mpfr_t(), MPFR_RNDN);
810  return real_mpfr(std::move(t));
811  }
812 #ifdef HAVE_SYMENGINE_MPC
813  mpc_class t(mpfr_get_prec(x_));
814  mpc_set_ui(t.get_mpc_t(), 1, MPFR_RNDN);
815  mpc_div_fr(t.get_mpc_t(), t.get_mpc_t(), x_, MPFR_RNDN);
816  mpc_acos(t.get_mpc_t(), t.get_mpc_t(), MPFR_RNDN);
817  return complex_mpc(std::move(t));
818 #else
819  throw SymEngineException(
820  "Result is complex. Recompile with MPC support.");
821 #endif
822  }
823  virtual RCP<const Basic> acsc(const Basic &x) const override
824  {
825  SYMENGINE_ASSERT(is_a<RealMPFR>(x))
826  mpfr_srcptr x_ = down_cast<const RealMPFR &>(x).i.get_mpfr_t();
827  if (mpfr_cmp_si(x_, 1) >= 0 or mpfr_cmp_si(x_, -1) <= 0) {
828  mpfr_class t(mpfr_get_prec(x_));
829  mpfr_ui_div(t.get_mpfr_t(), 1, x_, MPFR_RNDN);
830  mpfr_asin(t.get_mpfr_t(), t.get_mpfr_t(), MPFR_RNDN);
831  return real_mpfr(std::move(t));
832  }
833 #ifdef HAVE_SYMENGINE_MPC
834  mpc_class t(mpfr_get_prec(x_));
835  mpc_set_ui(t.get_mpc_t(), 1, MPFR_RNDN);
836  mpc_div_fr(t.get_mpc_t(), t.get_mpc_t(), x_, MPFR_RNDN);
837  mpc_asin(t.get_mpc_t(), t.get_mpc_t(), MPFR_RNDN);
838  return complex_mpc(std::move(t));
839 #else
840  throw SymEngineException(
841  "Result is complex. Recompile with MPC support.");
842 #endif
843  }
844  virtual RCP<const Basic> sinh(const Basic &x) const override
845  {
846  SYMENGINE_ASSERT(is_a<RealMPFR>(x))
847  mpfr_class t(down_cast<const RealMPFR &>(x).i.get_prec());
848  mpfr_sinh(t.get_mpfr_t(), down_cast<const RealMPFR &>(x).i.get_mpfr_t(),
849  MPFR_RNDN);
850  return real_mpfr(std::move(t));
851  }
852  virtual RCP<const Basic> csch(const Basic &x) const override
853  {
854  SYMENGINE_ASSERT(is_a<RealMPFR>(x))
855  mpfr_class t(down_cast<const RealMPFR &>(x).i.get_prec());
856  mpfr_csch(t.get_mpfr_t(), down_cast<const RealMPFR &>(x).i.get_mpfr_t(),
857  MPFR_RNDN);
858  return real_mpfr(std::move(t));
859  }
860  virtual RCP<const Basic> cosh(const Basic &x) const override
861  {
862  SYMENGINE_ASSERT(is_a<RealMPFR>(x))
863  mpfr_class t(down_cast<const RealMPFR &>(x).i.get_prec());
864  mpfr_cosh(t.get_mpfr_t(), down_cast<const RealMPFR &>(x).i.get_mpfr_t(),
865  MPFR_RNDN);
866  return real_mpfr(std::move(t));
867  }
868  virtual RCP<const Basic> sech(const Basic &x) const override
869  {
870  SYMENGINE_ASSERT(is_a<RealMPFR>(x))
871  mpfr_class t(down_cast<const RealMPFR &>(x).i.get_prec());
872  mpfr_sech(t.get_mpfr_t(), down_cast<const RealMPFR &>(x).i.get_mpfr_t(),
873  MPFR_RNDN);
874  return real_mpfr(std::move(t));
875  }
876  virtual RCP<const Basic> tanh(const Basic &x) const override
877  {
878  SYMENGINE_ASSERT(is_a<RealMPFR>(x))
879  mpfr_class t(down_cast<const RealMPFR &>(x).i.get_prec());
880  mpfr_tanh(t.get_mpfr_t(), down_cast<const RealMPFR &>(x).i.get_mpfr_t(),
881  MPFR_RNDN);
882  return real_mpfr(std::move(t));
883  }
884  virtual RCP<const Basic> coth(const Basic &x) const override
885  {
886  SYMENGINE_ASSERT(is_a<RealMPFR>(x))
887  mpfr_class t(down_cast<const RealMPFR &>(x).i.get_prec());
888  mpfr_coth(t.get_mpfr_t(), down_cast<const RealMPFR &>(x).i.get_mpfr_t(),
889  MPFR_RNDN);
890  return real_mpfr(std::move(t));
891  }
892  virtual RCP<const Basic> asinh(const Basic &x) const override
893  {
894  SYMENGINE_ASSERT(is_a<RealMPFR>(x))
895  mpfr_class t(down_cast<const RealMPFR &>(x).i.get_prec());
896  mpfr_asinh(t.get_mpfr_t(),
897  down_cast<const RealMPFR &>(x).i.get_mpfr_t(), MPFR_RNDN);
898  return real_mpfr(std::move(t));
899  }
900  virtual RCP<const Basic> acsch(const Basic &x) const override
901  {
902  SYMENGINE_ASSERT(is_a<RealMPFR>(x))
903  mpfr_srcptr x_ = down_cast<const RealMPFR &>(x).i.get_mpfr_t();
904  mpfr_class t(mpfr_get_prec(x_));
905  mpfr_ui_div(t.get_mpfr_t(), 1, x_, MPFR_RNDN);
906  mpfr_asinh(t.get_mpfr_t(), t.get_mpfr_t(), MPFR_RNDN);
907  return real_mpfr(std::move(t));
908  }
909  virtual RCP<const Basic> acosh(const Basic &x) const override
910  {
911  SYMENGINE_ASSERT(is_a<RealMPFR>(x))
912  mpfr_srcptr x_ = down_cast<const RealMPFR &>(x).i.get_mpfr_t();
913  if (mpfr_cmp_si(x_, 1) >= 0) {
914  mpfr_class t(mpfr_get_prec(x_));
915  mpfr_acosh(t.get_mpfr_t(), x_, MPFR_RNDN);
916  return real_mpfr(std::move(t));
917  }
918 #ifdef HAVE_SYMENGINE_MPC
919  mpc_class t(mpfr_get_prec(x_));
920  mpc_set_fr(t.get_mpc_t(), x_, MPFR_RNDN);
921  mpc_acosh(t.get_mpc_t(), t.get_mpc_t(), MPFR_RNDN);
922  return complex_mpc(std::move(t));
923 #else
924  throw SymEngineException(
925  "Result is complex. Recompile with MPC support.");
926 #endif
927  }
928  virtual RCP<const Basic> atanh(const Basic &x) const override
929  {
930  SYMENGINE_ASSERT(is_a<RealMPFR>(x))
931  mpfr_srcptr x_ = down_cast<const RealMPFR &>(x).i.get_mpfr_t();
932  if (mpfr_cmp_si(x_, 1) <= 0 and mpfr_cmp_si(x_, -1) >= 0) {
933  mpfr_class t(mpfr_get_prec(x_));
934  mpfr_atanh(t.get_mpfr_t(), x_, MPFR_RNDN);
935  return real_mpfr(std::move(t));
936  }
937 #ifdef HAVE_SYMENGINE_MPC
938  mpc_class t(mpfr_get_prec(x_));
939  mpc_set_fr(t.get_mpc_t(), x_, MPFR_RNDN);
940  mpc_atanh(t.get_mpc_t(), t.get_mpc_t(), MPFR_RNDN);
941  return complex_mpc(std::move(t));
942 #else
943  throw SymEngineException(
944  "Result is complex. Recompile with MPC support.");
945 #endif
946  }
947  virtual RCP<const Basic> acoth(const Basic &x) const override
948  {
949  SYMENGINE_ASSERT(is_a<RealMPFR>(x))
950  mpfr_srcptr x_ = down_cast<const RealMPFR &>(x).i.get_mpfr_t();
951  if (mpfr_cmp_si(x_, 1) >= 0 or mpfr_cmp_si(x_, -1) <= 0) {
952  mpfr_class t(mpfr_get_prec(x_));
953  mpfr_ui_div(t.get_mpfr_t(), 1, x_, MPFR_RNDN);
954  mpfr_atanh(t.get_mpfr_t(), t.get_mpfr_t(), MPFR_RNDN);
955  return real_mpfr(std::move(t));
956  }
957 #ifdef HAVE_SYMENGINE_MPC
958  mpc_class t(mpfr_get_prec(x_));
959  mpc_set_fr(t.get_mpc_t(), x_, MPFR_RNDN);
960  mpc_ui_div(t.get_mpc_t(), 1, t.get_mpc_t(), MPFR_RNDN);
961  mpc_atanh(t.get_mpc_t(), t.get_mpc_t(), MPFR_RNDN);
962  return complex_mpc(std::move(t));
963 #else
964  throw SymEngineException(
965  "Result is complex. Recompile with MPC support.");
966 #endif
967  }
968  virtual RCP<const Basic> asech(const Basic &x) const override
969  {
970  SYMENGINE_ASSERT(is_a<RealMPFR>(x))
971  mpfr_srcptr x_ = down_cast<const RealMPFR &>(x).i.get_mpfr_t();
972  if (mpfr_cmp_si(x_, 0) >= 0 and mpfr_cmp_si(x_, 1) <= 0) {
973  mpfr_class t(mpfr_get_prec(x_));
974  mpfr_ui_div(t.get_mpfr_t(), 1, x_, MPFR_RNDN);
975  mpfr_acosh(t.get_mpfr_t(), t.get_mpfr_t(), MPFR_RNDN);
976  return real_mpfr(std::move(t));
977  }
978 #ifdef HAVE_SYMENGINE_MPC
979  mpc_class t(mpfr_get_prec(x_));
980  mpc_set_fr(t.get_mpc_t(), x_, MPFR_RNDN);
981  mpc_ui_div(t.get_mpc_t(), 1, t.get_mpc_t(), MPFR_RNDN);
982  mpc_acosh(t.get_mpc_t(), t.get_mpc_t(), MPFR_RNDN);
983  return complex_mpc(std::move(t));
984 #else
985  throw SymEngineException(
986  "Result is complex. Recompile with MPC support.");
987 #endif
988  }
989  virtual RCP<const Basic> log(const Basic &x) const override
990  {
991  SYMENGINE_ASSERT(is_a<RealMPFR>(x))
992  mpfr_srcptr x_ = down_cast<const RealMPFR &>(x).i.get_mpfr_t();
993  if (mpfr_cmp_si(x_, 0) >= 0) {
994  mpfr_class t(mpfr_get_prec(x_));
995  mpfr_log(t.get_mpfr_t(), x_, MPFR_RNDN);
996  return real_mpfr(std::move(t));
997  }
998 #ifdef HAVE_SYMENGINE_MPC
999  mpc_class t(mpfr_get_prec(x_));
1000  mpc_set_fr(t.get_mpc_t(), x_, MPFR_RNDN);
1001  mpc_log(t.get_mpc_t(), t.get_mpc_t(), MPFR_RNDN);
1002  return complex_mpc(std::move(t));
1003 #else
1004  throw SymEngineException(
1005  "Result is complex. Recompile with MPC support.");
1006 #endif
1007  }
1008  virtual RCP<const Basic> abs(const Basic &x) const override
1009  {
1010  SYMENGINE_ASSERT(is_a<RealMPFR>(x))
1011  mpfr_class t(down_cast<const RealMPFR &>(x).i.get_prec());
1012  mpfr_abs(t.get_mpfr_t(), down_cast<const RealMPFR &>(x).i.get_mpfr_t(),
1013  MPFR_RNDN);
1014  return real_mpfr(std::move(t));
1015  }
1016 
1017  virtual RCP<const Basic> gamma(const Basic &x) const override
1018  {
1019  SYMENGINE_ASSERT(is_a<RealMPFR>(x))
1020  mpfr_srcptr x_ = down_cast<const RealMPFR &>(x).i.get_mpfr_t();
1021  if (mpfr_cmp_si(x_, 0) >= 0) {
1022  mpfr_class t(mpfr_get_prec(x_));
1023  mpfr_gamma(t.get_mpfr_t(), x_, MPFR_RNDN);
1024  return real_mpfr(std::move(t));
1025  } else {
1026  throw NotImplementedError("Not Implemented.");
1027  }
1028  }
1029  virtual RCP<const Basic> exp(const Basic &x) const override
1030  {
1031  SYMENGINE_ASSERT(is_a<RealMPFR>(x))
1032  mpfr_srcptr x_ = down_cast<const RealMPFR &>(x).i.get_mpfr_t();
1033  mpfr_class t(mpfr_get_prec(x_));
1034  mpfr_exp(t.get_mpfr_t(), x_, MPFR_RNDN);
1035  return real_mpfr(std::move(t));
1036  }
1037  virtual RCP<const Basic> floor(const Basic &x) const override
1038  {
1039  SYMENGINE_ASSERT(is_a<RealMPFR>(x))
1040  mpfr_srcptr x_ = down_cast<const RealMPFR &>(x).i.get_mpfr_t();
1041  integer_class i;
1042  mpfr_get_z(get_mpz_t(i), x_, MPFR_RNDD);
1043  mp_demote(i);
1044  return integer(std::move(i));
1045  }
1046  virtual RCP<const Basic> ceiling(const Basic &x) const override
1047  {
1048  SYMENGINE_ASSERT(is_a<RealMPFR>(x))
1049  mpfr_srcptr x_ = down_cast<const RealMPFR &>(x).i.get_mpfr_t();
1050  integer_class i;
1051  mpfr_get_z(get_mpz_t(i), x_, MPFR_RNDU);
1052  mp_demote(i);
1053  return integer(std::move(i));
1054  }
1055  virtual RCP<const Basic> truncate(const Basic &x) const override
1056  {
1057  SYMENGINE_ASSERT(is_a<RealMPFR>(x))
1058  mpfr_srcptr x_ = down_cast<const RealMPFR &>(x).i.get_mpfr_t();
1059  integer_class i;
1060  mpfr_get_z(get_mpz_t(i), x_, MPFR_RNDZ);
1061  mp_demote(i);
1062  return integer(std::move(i));
1063  }
1064  virtual RCP<const Basic> erf(const Basic &x) const override
1065  {
1066  SYMENGINE_ASSERT(is_a<RealMPFR>(x))
1067  mpfr_srcptr x_ = down_cast<const RealMPFR &>(x).i.get_mpfr_t();
1068  mpfr_class t(mpfr_get_prec(x_));
1069  mpfr_erf(t.get_mpfr_t(), x_, MPFR_RNDN);
1070  return real_mpfr(std::move(t));
1071  }
1072  virtual RCP<const Basic> erfc(const Basic &x) const override
1073  {
1074  SYMENGINE_ASSERT(is_a<RealMPFR>(x))
1075  mpfr_srcptr x_ = down_cast<const RealMPFR &>(x).i.get_mpfr_t();
1076  mpfr_class t(mpfr_get_prec(x_));
1077  mpfr_erfc(t.get_mpfr_t(), x_, MPFR_RNDN);
1078  return real_mpfr(std::move(t));
1079  }
1080 };
1081 
1082 Evaluate &RealMPFR::get_eval() const
1083 {
1084  static EvaluateMPFR evaluate_mpfr;
1085  return evaluate_mpfr;
1086 }
1087 
1088 } // namespace SymEngine
1089 #endif // HAVE_SYMENGINE_MPFR
T acos(T... args)
T acosh(T... args)
T asin(T... args)
T asinh(T... args)
T atan(T... args)
T atanh(T... args)
T cos(T... args)
T cosh(T... args)
T erf(T... args)
T erfc(T... args)
T exp(T... args)
T floor(T... args)
T log(T... args)
T max(T... args)
T move(T... args)
Main namespace for SymEngine package.
Definition: add.cpp:19
std::enable_if< std::is_integral< T >::value, RCP< const Integer > >::type integer(T i)
Definition: integer.h:200
RCP< const Basic > sec(const RCP< const Basic > &arg)
Canonicalize Sec:
Definition: functions.cpp:1159
RCP< const Basic > coth(const RCP< const Basic > &arg)
Canonicalize Coth:
Definition: functions.cpp:2290
RCP< const Basic > ceiling(const RCP< const Basic > &arg)
Canonicalize Ceiling:
Definition: functions.cpp:662
RCP< const Basic > abs(const RCP< const Basic > &arg)
Canonicalize Abs:
Definition: functions.cpp:3449
RCP< const Basic > acsc(const RCP< const Basic > &arg)
Canonicalize ACsc:
Definition: functions.cpp:1441
void hash_combine(hash_t &seed, const T &v)
Definition: basic-inl.h:137
RCP< const Basic > sech(const RCP< const Basic > &arg)
Canonicalize Sech:
Definition: functions.cpp:2208
RCP< const Basic > gamma(const RCP< const Basic > &arg)
Canonicalize Gamma:
Definition: functions.cpp:2971
RCP< const Basic > acoth(const RCP< const Basic > &arg)
Canonicalize ACoth:
Definition: functions.cpp:2491
RCP< const Basic > asec(const RCP< const Basic > &arg)
Canonicalize ASec:
Definition: functions.cpp:1401
RCP< const Basic > acsch(const RCP< const Basic > &arg)
Canonicalize ACsch:
Definition: functions.cpp:2379
RCP< const Basic > cot(const RCP< const Basic > &arg)
Canonicalize Cot:
Definition: functions.cpp:1030
RCP< const Basic > truncate(const RCP< const Basic > &arg)
Canonicalize Truncate:
Definition: functions.cpp:756
RCP< const Basic > csc(const RCP< const Basic > &arg)
Canonicalize Csc:
Definition: functions.cpp:1095
RCP< const Basic > csch(const RCP< const Basic > &arg)
Canonicalize Csch:
Definition: functions.cpp:2126
void hash_combine_impl(hash_t &seed, const T &v, typename std::enable_if< std::is_base_of< Basic, T >::value >::type *=nullptr)
Templatised version to combine hash.
Definition: basic-inl.h:103
RCP< const Basic > asech(const RCP< const Basic > &arg)
Canonicalize ASech:
Definition: functions.cpp:2528
RCP< const Basic > acot(const RCP< const Basic > &arg)
Canonicalize ACot:
Definition: functions.cpp:1523
STL namespace.
T sin(T... args)
T sinh(T... args)
T tan(T... args)
T tanh(T... args)