Loading...
Searching...
No Matches
SymEngine::ComplexDouble Class Reference

Complex Double Class to hold std::complex<double> values. More...

#include <complex_double.h>

+ Inheritance diagram for SymEngine::ComplexDouble:
+ Collaboration diagram for SymEngine::ComplexDouble:

Public Member Functions

void accept (Visitor &v) const override
 
void accept (EvalRealDoubleVisitorFinal &v) const override
 
 ComplexDouble (std::complex< double > i)
 Constructor of ComplexDouble class.
 
hash_t __hash__ () const override
 
bool __eq__ (const Basic &o) const override
 
int compare (const Basic &o) const override
 
RCP< const Numberreal_part () const override
 Get the real part of the complex number.
 
RCP< const Numberimaginary_part () const override
 Get the imaginary part of the complex number.
 
RCP< const Basicconjugate () const override
 Get the conjugate of the complex number.
 
bool is_positive () const override
 
bool is_negative () const override
 
bool is_complex () const override
 
std::complex< doubleas_complex_double () const
 
bool is_exact () const override
 
Evaluateget_eval () const override
 Get Evaluate singleton to evaluate numerically.
 
bool is_zero () const override
 
bool is_one () const override
 
bool is_minus_one () const override
 
RCP< const Numberaddcomp (const Integer &other) const
 
RCP< const Numberaddcomp (const Rational &other) const
 
RCP< const Numberaddcomp (const Complex &other) const
 
RCP< const Numberaddcomp (const RealDouble &other) const
 
RCP< const Numberaddcomp (const ComplexDouble &other) const
 
RCP< const Numberadd (const Number &other) const override
 Converts the param other appropriately and then calls addcomp
 
RCP< const Numbersubcomp (const Integer &other) const
 
RCP< const Numbersubcomp (const Rational &other) const
 
RCP< const Numbersubcomp (const Complex &other) const
 
RCP< const Numbersubcomp (const RealDouble &other) const
 
RCP< const Numbersubcomp (const ComplexDouble &other) const
 
RCP< const Numbersub (const Number &other) const override
 Converts the param other appropriately and then calls subcomp
 
RCP< const Numberrsubcomp (const Integer &other) const
 
RCP< const Numberrsubcomp (const Rational &other) const
 
RCP< const Numberrsubcomp (const Complex &other) const
 
RCP< const Numberrsubcomp (const RealDouble &other) const
 
RCP< const Numberrsub (const Number &other) const override
 Converts the param other appropriately and then calls subcomp
 
RCP< const Numbermulcomp (const Integer &other) const
 
RCP< const Numbermulcomp (const Rational &other) const
 
RCP< const Numbermulcomp (const Complex &other) const
 
RCP< const Numbermulcomp (const RealDouble &other) const
 
RCP< const Numbermulcomp (const ComplexDouble &other) const
 
RCP< const Numbermul (const Number &other) const override
 Converts the param other appropriately and then calls mulcomp
 
RCP< const Numberdivcomp (const Integer &other) const
 
RCP< const Numberdivcomp (const Rational &other) const
 
RCP< const Numberdivcomp (const Complex &other) const
 
RCP< const Numberdivcomp (const RealDouble &other) const
 
RCP< const Numberdivcomp (const ComplexDouble &other) const
 
RCP< const Numberdiv (const Number &other) const override
 Converts the param other appropriately and then calls divcomp
 
RCP< const Numberrdivcomp (const Integer &other) const
 
RCP< const Numberrdivcomp (const Rational &other) const
 
RCP< const Numberrdivcomp (const Complex &other) const
 
RCP< const Numberrdivcomp (const RealDouble &other) const
 
RCP< const Numberrdiv (const Number &other) const override
 Converts the param other appropriately and then calls divcomp
 
RCP< const Numberpowcomp (const Integer &other) const
 
RCP< const Numberpowcomp (const Rational &other) const
 
RCP< const Numberpowcomp (const Complex &other) const
 
RCP< const Numberpowcomp (const RealDouble &other) const
 
RCP< const Numberpowcomp (const ComplexDouble &other) const
 
RCP< const Numberpow (const Number &other) const override
 Converts the param other appropriately and then calls powcomp
 
RCP< const Numberrpowcomp (const Integer &other) const
 
RCP< const Numberrpowcomp (const Rational &other) const
 
RCP< const Numberrpowcomp (const Complex &other) const
 
RCP< const Numberrpowcomp (const RealDouble &other) const
 
RCP< const Numberrpow (const Number &other) const override
 Converts the param other appropriately and then calls powcomp
 
- Public Member Functions inherited from SymEngine::ComplexBase
bool is_re_zero () const
 
- Public Member Functions inherited from SymEngine::Number
bool is_exact_zero () const
 
vec_basic get_args () const override
 Returns the list of arguments.
 
virtual bool is_perfect_power (bool is_expected=false) const
 
virtual bool nth_root (const Ptr< RCP< const Number > > &, unsigned long n) const
 
- Public Member Functions inherited from SymEngine::Basic
TypeID get_type_code () const
 
 Basic ()
 Constructor.
 
 Basic (const Basic &)=delete
 Delete the copy constructor and assignment.
 
Basicoperator= (const Basic &)=delete
 Assignment operator in continuation with above.
 
 Basic (Basic &&)=delete
 Delete the move constructor and assignment.
 
Basicoperator= (Basic &&)=delete
 Assignment operator in continuation with above.
 
hash_t hash () const
 
bool __neq__ (const Basic &o) const
 true if this is not equal to o.
 
int __cmp__ (const Basic &o) const
 Comparison operator.
 
std::string __str__ () const
 
std::string dumps () const
 Returns a string of the instance serialized.
 
RCP< const Basicsubs (const map_basic_basic &subs_dict) const
 Substitutes 'subs_dict' into 'self'.
 
RCP< const Basicxreplace (const map_basic_basic &subs_dict) const
 
virtual RCP< const Basicexpand_as_exp () const
 expands the special function in terms of exp function
 
RCP< const Basicdiff (const RCP< const Symbol > &x, bool cache=true) const
 
- Public Member Functions inherited from SymEngine::EnableRCPFromThis< Basic >
RCP< Basicrcp_from_this ()
 Get RCP<T> pointer to self (it will cast the pointer to T)
 
RCP< const Basicrcp_from_this () const
 Get RCP<const T> pointer to self (it will cast the pointer to const T)
 
RCP< const T2 > rcp_from_this_cast () const
 Get RCP<T2> pointer to self (it will cast the pointer to T2)
 
unsigned int use_count () const
 

Data Fields

std::complex< doublei
 
- Data Fields inherited from SymEngine::Basic
TypeID type_code_
 

Static Public Attributes

static const TypeID type_code_id = SYMENGINE_COMPLEX_DOUBLE
 

Additional Inherited Members

- Static Public Member Functions inherited from SymEngine::Basic
static RCP< const Basicloads (const std::string &)
 Creates an instance of a serialized string.
 

Detailed Description

Complex Double Class to hold std::complex<double> values.

Definition at line 15 of file complex_double.h.

Constructor & Destructor Documentation

◆ ComplexDouble()

SymEngine::ComplexDouble::ComplexDouble ( std::complex< double i)
explicit

Constructor of ComplexDouble class.

Definition at line 11 of file complex_double.cpp.

12{
13 SYMENGINE_ASSIGN_TYPEID()
14 this->i = i;
15}
void hash_combine(hash_t &seed, const T &v)
Definition basic-inl.h:95

Member Function Documentation

◆ __eq__()

bool SymEngine::ComplexDouble::__eq__ ( const Basic o) const
overridevirtual

Equality comparator

Parameters
o- Object to be compared with
Returns
whether the 2 objects are equal

Implements SymEngine::Basic.

Definition at line 41 of file complex_double.cpp.

42{
45 return this->i == s.i;
46 }
47 return false;
48}
ComplexDouble(std::complex< double > i)
Constructor of ComplexDouble class.

◆ __hash__()

hash_t SymEngine::ComplexDouble::__hash__ ( ) const
overridevirtual
Returns
size of the hash

Implements SymEngine::Basic.

Definition at line 33 of file complex_double.cpp.

34{
35 hash_t seed = SYMENGINE_COMPLEX_DOUBLE;
36 hash_combine<double>(seed, i.real());
37 hash_combine<double>(seed, i.imag());
38 return seed;
39}
T imag(T... args)
T real(T... args)

◆ accept() [1/2]

void SymEngine::ComplexDouble::accept ( EvalRealDoubleVisitorFinal v) const
overridevirtual

Implements SymEngine::Basic.

◆ accept() [2/2]

void SymEngine::ComplexDouble::accept ( Visitor v) const
overridevirtual

Implements SymEngine::Basic.

◆ add()

RCP< const Number > SymEngine::ComplexDouble::add ( const Number other) const
inlineoverridevirtual

Converts the param other appropriately and then calls addcomp

Implements SymEngine::Number.

Definition at line 133 of file complex_double.h.

134 {
135 if (is_a<Rational>(other)) {
137 } else if (is_a<Integer>(other)) {
139 } else if (is_a<Complex>(other)) {
141 } else if (is_a<RealDouble>(other)) {
143 } else if (is_a<ComplexDouble>(other)) {
145 } else {
146 return other.add(*this);
147 }
148 }
RCP< const Number > addcomp(const Integer &other) const

◆ addcomp() [1/5]

RCP< const Number > SymEngine::ComplexDouble::addcomp ( const Complex other) const
inline

Add ComplexDoubles

Parameters
otherof type Complex

Definition at line 108 of file complex_double.h.

109 {
111 i
112 + std::complex<double>(mp_get_d(other.real_),
113 mp_get_d(other.imaginary_)));
114 }

◆ addcomp() [2/5]

RCP< const Number > SymEngine::ComplexDouble::addcomp ( const ComplexDouble other) const
inline

Add ComplexDoubles

Parameters
otherof type ComplexDouble

Definition at line 127 of file complex_double.h.

128 {
130 }

◆ addcomp() [3/5]

RCP< const Number > SymEngine::ComplexDouble::addcomp ( const Integer other) const
inline

Add ComplexDoubles

Parameters
otherof type Integer

Definition at line 90 of file complex_double.h.

91 {
93 i + mp_get_d(other.as_integer_class()));
94 }

◆ addcomp() [4/5]

RCP< const Number > SymEngine::ComplexDouble::addcomp ( const Rational other) const
inline

Add ComplexDoubles

Parameters
otherof type Rational

Definition at line 99 of file complex_double.h.

100 {
102 i + mp_get_d(other.as_rational_class()));
103 }

◆ addcomp() [5/5]

RCP< const Number > SymEngine::ComplexDouble::addcomp ( const RealDouble other) const
inline

Add ComplexDoubles

Parameters
otherof type RealDouble

Definition at line 119 of file complex_double.h.

120 {
122 }

◆ as_complex_double()

std::complex< double > SymEngine::ComplexDouble::as_complex_double ( ) const
inline
Returns
self as a double

Definition at line 56 of file complex_double.h.

57 {
58 return i;
59 }

◆ compare()

int SymEngine::ComplexDouble::compare ( const Basic o) const
overridevirtual

Returns -1, 0, 1 for this < o, this == o, this > o. This method is used when you want to sort things like x+y+z into canonical order. This function assumes that o is the same type as this. Use __cmp__ if you want general comparison.

Implements SymEngine::Basic.

Definition at line 50 of file complex_double.cpp.

51{
52 SYMENGINE_ASSERT(is_a<ComplexDouble>(o))
54 if (i == s.i)
55 return 0;
56 if (i.real() == s.i.real()) {
57 return i.imag() < s.i.imag() ? -1 : 1;
58 }
59 return i.real() < s.i.real() ? -1 : 1;
60}

◆ conjugate()

RCP< const Basic > SymEngine::ComplexDouble::conjugate ( ) const
overridevirtual

Get the conjugate of the complex number.

Reimplemented from SymEngine::Number.

Definition at line 27 of file complex_double.cpp.

28{
29 double re = i.real();
30 double im = -i.imag();
31 return complex_double(std::complex<double>(re, im));
32}

◆ div()

RCP< const Number > SymEngine::ComplexDouble::div ( const Number other) const
inlineoverridevirtual

Converts the param other appropriately and then calls divcomp

Reimplemented from SymEngine::Number.

Definition at line 375 of file complex_double.h.

376 {
377 if (is_a<Rational>(other)) {
379 } else if (is_a<Integer>(other)) {
381 } else if (is_a<Complex>(other)) {
383 } else if (is_a<RealDouble>(other)) {
385 } else if (is_a<ComplexDouble>(other)) {
387 } else {
388 return other.rdiv(*this);
389 }
390 }
RCP< const Number > divcomp(const Integer &other) const

◆ divcomp() [1/5]

RCP< const Number > SymEngine::ComplexDouble::divcomp ( const Complex other) const
inline

Divide ComplexDoubles

Parameters
otherof type Complex

Definition at line 350 of file complex_double.h.

351 {
353 i
354 / std::complex<double>(mp_get_d(other.real_),
355 mp_get_d(other.imaginary_)));
356 }

◆ divcomp() [2/5]

RCP< const Number > SymEngine::ComplexDouble::divcomp ( const ComplexDouble other) const
inline

Divide ComplexDoubles

Parameters
otherof type ComplexDouble

Definition at line 369 of file complex_double.h.

370 {
372 }

◆ divcomp() [3/5]

RCP< const Number > SymEngine::ComplexDouble::divcomp ( const Integer other) const
inline

Divide ComplexDoubles

Parameters
otherof type Integer

Definition at line 332 of file complex_double.h.

333 {
335 i / mp_get_d(other.as_integer_class()));
336 }

◆ divcomp() [4/5]

RCP< const Number > SymEngine::ComplexDouble::divcomp ( const Rational other) const
inline

Divide ComplexDoubles

Parameters
otherof type Rational

Definition at line 341 of file complex_double.h.

342 {
344 i / mp_get_d(other.as_rational_class()));
345 }

◆ divcomp() [5/5]

RCP< const Number > SymEngine::ComplexDouble::divcomp ( const RealDouble other) const
inline

Divide ComplexDoubles

Parameters
otherof type RealDouble

Definition at line 361 of file complex_double.h.

362 {
364 }

◆ get_eval()

Evaluate & SymEngine::ComplexDouble::get_eval ( ) const
overridevirtual

Get Evaluate singleton to evaluate numerically.

Reimplemented from SymEngine::Number.

Definition at line 382 of file real_double.cpp.

383{
384 static EvaluateComplexDouble evaluate_complex_double;
386}

◆ imaginary_part()

RCP< const Number > SymEngine::ComplexDouble::imaginary_part ( ) const
overridevirtual

Get the imaginary part of the complex number.

Implements SymEngine::ComplexBase.

Definition at line 22 of file complex_double.cpp.

23{
24 return real_double(i.imag());
25}

◆ is_complex()

bool SymEngine::ComplexDouble::is_complex ( ) const
inlineoverridevirtual
Returns
true

Implements SymEngine::Number.

Definition at line 51 of file complex_double.h.

52 {
53 return true;
54 }

◆ is_exact()

bool SymEngine::ComplexDouble::is_exact ( ) const
inlineoverridevirtual
Returns
false

Reimplemented from SymEngine::Number.

Definition at line 62 of file complex_double.h.

63 {
64 return false;
65 }

◆ is_minus_one()

bool SymEngine::ComplexDouble::is_minus_one ( ) const
inlineoverridevirtual
Returns
false

Implements SymEngine::Number.

Definition at line 82 of file complex_double.h.

83 {
84 return false;
85 }

◆ is_negative()

bool SymEngine::ComplexDouble::is_negative ( ) const
inlineoverridevirtual
Returns
false

Implements SymEngine::Number.

Definition at line 46 of file complex_double.h.

47 {
48 return false;
49 }

◆ is_one()

bool SymEngine::ComplexDouble::is_one ( ) const
inlineoverridevirtual
Returns
false

Implements SymEngine::Number.

Definition at line 76 of file complex_double.h.

77 {
78 return false;
79 }

◆ is_positive()

bool SymEngine::ComplexDouble::is_positive ( ) const
inlineoverridevirtual
Returns
false

Implements SymEngine::Number.

Definition at line 40 of file complex_double.h.

41 {
42 return false;
43 }

◆ is_zero()

bool SymEngine::ComplexDouble::is_zero ( ) const
inlineoverridevirtual
Returns
true if equal to 0

Implements SymEngine::Number.

Definition at line 70 of file complex_double.h.

71 {
72 return i == 0.0;
73 }

◆ mul()

RCP< const Number > SymEngine::ComplexDouble::mul ( const Number other) const
inlineoverridevirtual

Converts the param other appropriately and then calls mulcomp

Implements SymEngine::Number.

Definition at line 312 of file complex_double.h.

313 {
314 if (is_a<Rational>(other)) {
316 } else if (is_a<Integer>(other)) {
318 } else if (is_a<Complex>(other)) {
320 } else if (is_a<RealDouble>(other)) {
322 } else if (is_a<ComplexDouble>(other)) {
324 } else {
325 return other.mul(*this);
326 }
327 }
RCP< const Number > mulcomp(const Integer &other) const

◆ mulcomp() [1/5]

RCP< const Number > SymEngine::ComplexDouble::mulcomp ( const Complex other) const
inline

Multiply ComplexDoubles

Parameters
otherof type Complex

Definition at line 287 of file complex_double.h.

288 {
290 i
291 * std::complex<double>(mp_get_d(other.real_),
292 mp_get_d(other.imaginary_)));
293 }

◆ mulcomp() [2/5]

RCP< const Number > SymEngine::ComplexDouble::mulcomp ( const ComplexDouble other) const
inline

Multiply ComplexDoubles

Parameters
otherof type ComplexDouble

Definition at line 306 of file complex_double.h.

307 {
309 }

◆ mulcomp() [3/5]

RCP< const Number > SymEngine::ComplexDouble::mulcomp ( const Integer other) const
inline

Multiply ComplexDoubles

Parameters
otherof type Integer

Definition at line 269 of file complex_double.h.

270 {
272 i * mp_get_d(other.as_integer_class()));
273 }

◆ mulcomp() [4/5]

RCP< const Number > SymEngine::ComplexDouble::mulcomp ( const Rational other) const
inline

Multiply ComplexDoubles

Parameters
otherof type Rational

Definition at line 278 of file complex_double.h.

279 {
281 i * mp_get_d(other.as_rational_class()));
282 }

◆ mulcomp() [5/5]

RCP< const Number > SymEngine::ComplexDouble::mulcomp ( const RealDouble other) const
inline

Multiply ComplexDoubles

Parameters
otherof type RealDouble

Definition at line 298 of file complex_double.h.

299 {
301 }

◆ pow()

RCP< const Number > SymEngine::ComplexDouble::pow ( const Number other) const
inlineoverridevirtual

Converts the param other appropriately and then calls powcomp

Implements SymEngine::Number.

Definition at line 491 of file complex_double.h.

492 {
493 if (is_a<Rational>(other)) {
495 } else if (is_a<Integer>(other)) {
497 } else if (is_a<Complex>(other)) {
499 } else if (is_a<RealDouble>(other)) {
501 } else if (is_a<ComplexDouble>(other)) {
503 } else {
504 return other.rpow(*this);
505 }
506 }
RCP< const Number > powcomp(const Integer &other) const

◆ powcomp() [1/5]

RCP< const Number > SymEngine::ComplexDouble::powcomp ( const Complex other) const
inline

Raise ComplexDouble to power other

Parameters
otherof type Complex

Definition at line 466 of file complex_double.h.

467 {
469 i, std::complex<double>(mp_get_d(other.real_),
470 mp_get_d(other.imaginary_))));
471 }
T pow(T... args)

◆ powcomp() [2/5]

RCP< const Number > SymEngine::ComplexDouble::powcomp ( const ComplexDouble other) const
inline

Raise ComplexDouble to power other

Parameters
otherof type ComplexDouble

Definition at line 484 of file complex_double.h.

485 {
488 }

◆ powcomp() [3/5]

RCP< const Number > SymEngine::ComplexDouble::powcomp ( const Integer other) const
inline

Raise ComplexDouble to power other

Parameters
otherof type Integer

Definition at line 448 of file complex_double.h.

449 {
451 i, mp_get_d(other.as_integer_class())));
452 }

◆ powcomp() [4/5]

RCP< const Number > SymEngine::ComplexDouble::powcomp ( const Rational other) const
inline

Raise ComplexDouble to power other

Parameters
otherof type Rational

Definition at line 457 of file complex_double.h.

458 {
460 i, mp_get_d(other.as_rational_class())));
461 }

◆ powcomp() [5/5]

RCP< const Number > SymEngine::ComplexDouble::powcomp ( const RealDouble other) const
inline

Raise ComplexDouble to power other

Parameters
otherof type RealDouble

Definition at line 475 of file complex_double.h.

476 {
479 }

◆ rdiv()

RCP< const Number > SymEngine::ComplexDouble::rdiv ( const Number other) const
inlineoverridevirtual

Converts the param other appropriately and then calls divcomp

Reimplemented from SymEngine::Number.

Definition at line 430 of file complex_double.h.

431 {
432 if (is_a<Rational>(other)) {
434 } else if (is_a<Integer>(other)) {
436 } else if (is_a<Complex>(other)) {
438 } else if (is_a<RealDouble>(other)) {
440 } else {
441 throw NotImplementedError("Not Implemented");
442 }
443 }
RCP< const Number > rdivcomp(const Integer &other) const

◆ rdivcomp() [1/4]

RCP< const Number > SymEngine::ComplexDouble::rdivcomp ( const Complex other) const
inline

Divide ComplexDoubles

Parameters
otherof type Complex

Definition at line 413 of file complex_double.h.

414 {
416 std::complex<double>(mp_get_d(other.real_),
417 mp_get_d(other.imaginary_))
418 / i);
419 }

◆ rdivcomp() [2/4]

RCP< const Number > SymEngine::ComplexDouble::rdivcomp ( const Integer other) const
inline

Divide ComplexDoubles

Parameters
otherof type Integer

Definition at line 395 of file complex_double.h.

396 {
397 return make_rcp<const ComplexDouble>(mp_get_d(other.as_integer_class())
398 / i);
399 }

◆ rdivcomp() [3/4]

RCP< const Number > SymEngine::ComplexDouble::rdivcomp ( const Rational other) const
inline

Divide ComplexDoubles

Parameters
otherof type Rational

Definition at line 404 of file complex_double.h.

405 {
406 return make_rcp<const ComplexDouble>(mp_get_d(other.as_rational_class())
407 / i);
408 }

◆ rdivcomp() [4/4]

RCP< const Number > SymEngine::ComplexDouble::rdivcomp ( const RealDouble other) const
inline

Divide ComplexDoubles

Parameters
otherof type RealDouble

Definition at line 424 of file complex_double.h.

425 {
427 }

◆ real_part()

RCP< const Number > SymEngine::ComplexDouble::real_part ( ) const
overridevirtual

Get the real part of the complex number.

Implements SymEngine::ComplexBase.

Definition at line 17 of file complex_double.cpp.

18{
19 return real_double(i.real());
20}

◆ rpow()

RCP< const Number > SymEngine::ComplexDouble::rpow ( const Number other) const
inlineoverridevirtual

Converts the param other appropriately and then calls powcomp

Implements SymEngine::Number.

Definition at line 547 of file complex_double.h.

548 {
549 if (is_a<Rational>(other)) {
551 } else if (is_a<Integer>(other)) {
553 } else if (is_a<Complex>(other)) {
555 } else if (is_a<RealDouble>(other)) {
557 } else {
558 throw NotImplementedError("Not Implemented");
559 }
560 }
RCP< const Number > rpowcomp(const Integer &other) const

◆ rpowcomp() [1/4]

RCP< const Number > SymEngine::ComplexDouble::rpowcomp ( const Complex other) const
inline

Raise other to power ComplexDouble

Parameters
otherof type Complex

Definition at line 529 of file complex_double.h.

530 {
532 std::complex<double>(mp_get_d(other.real_),
533 mp_get_d(other.imaginary_)),
534 i));
535 }

◆ rpowcomp() [2/4]

RCP< const Number > SymEngine::ComplexDouble::rpowcomp ( const Integer other) const
inline

Raise other to power ComplexDouble

Parameters
otherof type Integer

Definition at line 511 of file complex_double.h.

512 {
514 mp_get_d(other.as_integer_class()), i));
515 }

◆ rpowcomp() [3/4]

RCP< const Number > SymEngine::ComplexDouble::rpowcomp ( const Rational other) const
inline

Raise other to power ComplexDouble

Parameters
otherof type Rational

Definition at line 520 of file complex_double.h.

521 {
523 mp_get_d(other.as_rational_class()), i));
524 }

◆ rpowcomp() [4/4]

RCP< const Number > SymEngine::ComplexDouble::rpowcomp ( const RealDouble other) const
inline

Raise other to power ComplexDouble

Parameters
otherof type RealDouble

Definition at line 540 of file complex_double.h.

541 {
544 }

◆ rsub()

RCP< const Number > SymEngine::ComplexDouble::rsub ( const Number other) const
inlineoverridevirtual

Converts the param other appropriately and then calls subcomp

Reimplemented from SymEngine::Number.

Definition at line 251 of file complex_double.h.

252 {
253 if (is_a<Rational>(other)) {
255 } else if (is_a<Integer>(other)) {
257 } else if (is_a<Complex>(other)) {
259 } else if (is_a<RealDouble>(other)) {
261 } else {
262 throw NotImplementedError("Not Implemented");
263 }
264 }
RCP< const Number > rsubcomp(const Integer &other) const

◆ rsubcomp() [1/4]

RCP< const Number > SymEngine::ComplexDouble::rsubcomp ( const Complex other) const
inline

Subtract ComplexDoubles

Parameters
otherof type Complex

Definition at line 234 of file complex_double.h.

235 {
237 -i
238 + std::complex<double>(mp_get_d(other.real_),
239 mp_get_d(other.imaginary_)));
240 }

◆ rsubcomp() [2/4]

RCP< const Number > SymEngine::ComplexDouble::rsubcomp ( const Integer other) const
inline

Subtract ComplexDoubles

Parameters
otherof type Integer

Definition at line 216 of file complex_double.h.

217 {
218 return make_rcp<const ComplexDouble>(mp_get_d(other.as_integer_class())
219 - i);
220 }

◆ rsubcomp() [3/4]

RCP< const Number > SymEngine::ComplexDouble::rsubcomp ( const Rational other) const
inline

Subtract ComplexDoubles

Parameters
otherof type Rational

Definition at line 225 of file complex_double.h.

226 {
227 return make_rcp<const ComplexDouble>(mp_get_d(other.as_rational_class())
228 - i);
229 }

◆ rsubcomp() [4/4]

RCP< const Number > SymEngine::ComplexDouble::rsubcomp ( const RealDouble other) const
inline

Subtract ComplexDoubles

Parameters
otherof type RealDouble

Definition at line 245 of file complex_double.h.

246 {
248 }

◆ sub()

RCP< const Number > SymEngine::ComplexDouble::sub ( const Number other) const
inlineoverridevirtual

Converts the param other appropriately and then calls subcomp

Reimplemented from SymEngine::Number.

Definition at line 196 of file complex_double.h.

197 {
198 if (is_a<Rational>(other)) {
200 } else if (is_a<Integer>(other)) {
202 } else if (is_a<Complex>(other)) {
204 } else if (is_a<RealDouble>(other)) {
206 } else if (is_a<ComplexDouble>(other)) {
208 } else {
209 return other.rsub(*this);
210 }
211 }
RCP< const Number > subcomp(const Integer &other) const

◆ subcomp() [1/5]

RCP< const Number > SymEngine::ComplexDouble::subcomp ( const Complex other) const
inline

Subtract ComplexDoubles

Parameters
otherof type Complex

Definition at line 171 of file complex_double.h.

172 {
174 i
175 - std::complex<double>(mp_get_d(other.real_),
176 mp_get_d(other.imaginary_)));
177 }

◆ subcomp() [2/5]

RCP< const Number > SymEngine::ComplexDouble::subcomp ( const ComplexDouble other) const
inline

Subtract ComplexDoubles

Parameters
otherof type ComplexDouble

Definition at line 190 of file complex_double.h.

191 {
193 }

◆ subcomp() [3/5]

RCP< const Number > SymEngine::ComplexDouble::subcomp ( const Integer other) const
inline

Subtract ComplexDoubles

Parameters
otherof type Integer

Definition at line 153 of file complex_double.h.

154 {
156 i - mp_get_d(other.as_integer_class()));
157 }

◆ subcomp() [4/5]

RCP< const Number > SymEngine::ComplexDouble::subcomp ( const Rational other) const
inline

Subtract ComplexDoubles

Parameters
otherof type Rational

Definition at line 162 of file complex_double.h.

163 {
165 i - mp_get_d(other.as_rational_class()));
166 }

◆ subcomp() [5/5]

RCP< const Number > SymEngine::ComplexDouble::subcomp ( const RealDouble other) const
inline

Subtract ComplexDoubles

Parameters
otherof type RealDouble

Definition at line 182 of file complex_double.h.

183 {
185 }

Field Documentation

◆ i

std::complex<double> SymEngine::ComplexDouble::i

Definition at line 18 of file complex_double.h.

◆ type_code_id

const TypeID SymEngine::ComplexDouble::type_code_id = SYMENGINE_COMPLEX_DOUBLE
static

Type_code_id shared by all instances

Definition at line 21 of file complex_double.h.


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