Class Complex

Inheritance Relationships

Base Type

Class Documentation

class SymEngine::Complex : public SymEngine::ComplexBase

Complex Class.

Public Functions

Complex(rational_class real, rational_class imaginary)

Constructor of Complex class.

bool is_canonical(const rational_class &real, const rational_class &imaginary) const

Return

true if canonical

hash_t __hash__() const

Return

size of the hash

bool __eq__(const Basic &o) const

Equality comparator

Return

whether the 2 objects are equal

Parameters
  • o: - Object to be compared with

int compare(const Basic &o) const

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.

RCP<const Number> real_part() const

Get the real part of the complex number.

RCP<const Number> imaginary_part() const

Get the imaginary part of the complex number.

RCP<const Basic> conjugate() const

Get the conjugate of the complex number.

bool is_positive() const

Return

false

bool is_negative() const

Return

false

bool is_complex() const

Return

true

bool is_zero() const

Return

false since imaginary_ cannot be zero

bool is_one() const

Return

false since imaginary_ cannot be zero

bool is_minus_one() const

Return

false since imaginary_ cannot be zero

RCP<const Number> addcomp(const Complex &other) const

Add Complex

Parameters

RCP<const Number> addcomp(const Rational &other) const

Add Complex

Parameters

RCP<const Number> addcomp(const Integer &other) const

Add Complex

Parameters

RCP<const Number> subcomp(const Complex &other) const

Subtract Complex

Parameters

RCP<const Number> subcomp(const Rational &other) const

Subtract Complex

Parameters

RCP<const Number> subcomp(const Integer &other) const

Subtract Complex

Parameters

RCP<const Number> rsubcomp(const Complex &other) const

Subtract Complex from other

Parameters

RCP<const Number> rsubcomp(const Rational &other) const

Subtract Complex from other

Parameters

RCP<const Number> rsubcomp(const Integer &other) const

Subtract Complex from other

Parameters

RCP<const Number> mulcomp(const Complex &other) const

Multiply Complex

Parameters

RCP<const Number> mulcomp(const Rational &other) const

Multiply Complex

Parameters

RCP<const Number> mulcomp(const Integer &other) const

Multiply Complex

Parameters

RCP<const Number> divcomp(const Complex &other) const

Divide Complex

Parameters

RCP<const Number> divcomp(const Rational &other) const

Divide Complex

Parameters

RCP<const Number> divcomp(const Integer &other) const

Divide Complex

Parameters

RCP<const Number> rdivcomp(const Integer &other) const

Divide other by the Complex

Parameters

RCP<const Number> powcomp(const Integer &other) const

Pow Complex

Parameters

RCP<const Number> add(const Number &other) const

Converts the param other appropriately and then calls addcomp

RCP<const Number> sub(const Number &other) const

Converts the param other appropriately and then calls subcomp

RCP<const Number> rsub(const Number &other) const

Converts the param other appropriately and then calls rsubcomp

RCP<const Number> mul(const Number &other) const

Converts the param other appropriately and then calls mulcomp

RCP<const Number> div(const Number &other) const

Converts the param other appropriately and then calls divcomp

RCP<const Number> rdiv(const Number &other) const

Converts the param other appropriately and then calls rdivcomp

RCP<const Number> pow(const Number &other) const

Converts the param other appropriately and then calls powcomp

RCP<const Number> rpow(const Number &other) const

Public Members

rational_class real_

real_ : Real part of the complex Number imaginary_ : Imaginary part of the complex Number

rational_class imaginary_

Public Static Functions

RCP<const Number> from_mpq(const rational_class re, const rational_class im)

Creates an instance of Complex if imaginary part is non-zero

Return

Complex or Rational depending on imaginary part.

Parameters
  • <tt>re</tt>: must already be in rational_class canonical form

  • <tt>im</tt>: must already be in rational_class canonical form

RCP<const Number> from_two_rats(const Rational &re, const Rational &im)

Constructs Complex from re, im. If im is 0 it will return a Rational instead.

RCP<const Number> from_two_nums(const Number &re, const Number &im)

Constructs Complex from re, im. If im is 0 it will return a Rational instead.