APyCFixed

class APyCFixed

Public Functions

template<typename RANDOM_ACCESS_ITERATOR>
inline void copy_n_from(RANDOM_ACCESS_ITERATOR src_it, std::size_t n) noexcept

Copy n items from it into *this

template<typename RANDOM_ACCESS_ITERATOR>
inline void copy_n_to(RANDOM_ACCESS_ITERATOR dst_it, std::size_t n) const noexcept

Copy n items from *this into it

inline bool same_type_as(const APyCFixed &other) const

Test if two fixed-point numbers have the same bit specifiers.

APyCFixed() = delete

No default (empty) constructed APyCFixed objects. At lesast the bit-specifiers has to be set during construction.

APyCFixed(const APyCFixed &other) = default

Construct a copy from other.

explicit APyCFixed(const nb::int_ &python_long_int_bit_pattern, std::optional<int> int_bits = std::nullopt, std::optional<int> frac_bits = std::nullopt, std::optional<int> bits = std::nullopt)

Main Python-exposed APyCFixed constructor.

explicit APyCFixed(const nb::tuple &python_long_int_bit_pattern, std::optional<int> int_bits = std::nullopt, std::optional<int> frac_bits = std::nullopt, std::optional<int> bits = std::nullopt)

Main Python-exposed APyCFixed constructor.

explicit APyCFixed(int bits, int int_bits)

Construct a zero-initialized number with bits and int_bits. Undefined behaviour if bits < 1.

explicit APyCFixed(std::optional<int> int_bits = std::nullopt, std::optional<int> frac_bits = std::nullopt, std::optional<int> bits = std::nullopt)

Construct a zero-initialized number from bit specification. Throws nanobind::value_error if not exactly two of three bit specifiers (bits, int_bits, frac_bits) are set, or if the resulting number of bits is less than one.

template<typename _IT>
explicit APyCFixed(int bits, int int_bits, _IT begin, _IT end)

Construct a number with bits and int_bits, and initialize underlying bit-pattern from iterator pair [ begin, end ).

explicit APyCFixed(int bits, int int_bits, std::initializer_list<apy_limb_t> list)

Construct a number with bits and int_bits, and initialize underlying bit-pattern from iterator pair [ begin, end ).

inline APyCFixed python_copy() const

Copy scalar.

inline APyCFixed python_deepcopy(nb::dict &memo) const

Deepcopy scalar (same as copy here)

APyCFixed operator+(const APyCFixed &rhs) const
APyCFixed operator-(const APyCFixed &rhs) const
APyCFixed operator*(const APyCFixed &rhs) const
APyCFixed operator/(const APyCFixed &rhs) const
APyCFixed operator<<(const int shift_val) const
APyCFixed operator>>(const int shift_val) const
APyCFixed &operator<<=(const int shift_val)
APyCFixed &operator>>=(const int shift_val)
APyCFixed operator+(const nb::int_ &rhs) const
APyCFixed operator-(const nb::int_ &rhs) const
APyCFixed operator*(const nb::int_ &rhs) const
APyCFixed operator/(const nb::int_ &rhs) const
bool operator==(const APyCFixed &rhs) const
bool operator!=(const APyCFixed &rhs) const
bool operator==(const APyFixed &rhs) const
bool operator!=(const APyFixed &rhs) const
bool operator==(const nb::int_ &rhs) const
bool operator!=(const nb::int_ &rhs) const
bool operator==(double rhs) const
bool operator!=(double rhs) const
bool operator==(const std::complex<double> &rhs) const
bool operator!=(const std::complex<double> &rhs) const
inline int bits() const noexcept

Return the bits specifier.

inline int int_bits() const noexcept

Return the int_bits specifier.

inline int frac_bits() const noexcept

Return the frac_bits specifier.

std::string repr() const

Python verbose string representation.

std::string bit_pattern_to_string_dec() const

Convert the underlying bit pattern to decimal and return in a string.

std::string to_string(int base = 10) const

Conversion to string.

std::string to_string_hex() const
std::string to_string_oct() const
std::string to_string_dec() const
bool is_identical(const APyCFixed &other) const

Test if two fixed-point numbers are identical, i.e., has the same values, the same number of integer bits, and the same number of fractional bits

bool is_zero() const noexcept

Test if fixed-point number is zero.

nb::tuple to_bits() const

Convert to a tuple of bits.

APyCFixed operator-() const

Unary negation.

inline APyCFixed operator+() const

Unary positive.

APyCFixed operator~() const

Logic not.

Unary negation.

APyFixed get_real() const

Retrieve real part.

APyFixed get_imag() const

Retrieve imaginary part.

std::complex<double> to_complex() const

Convert to built-in complex type over double-precision floating-point.

APyCFixed cast(std::optional<int> int_bits = std::nullopt, std::optional<int> frac_bits = std::nullopt, std::optional<QuantizationMode> quantization = std::nullopt, std::optional<OverflowMode> overflow = std::nullopt, std::optional<int> bits = std::nullopt) const

Publicly exposed cast method.

Public Static Functions

static APyCFixed from_number(const nb::object &py_obj, std::optional<int> int_bits = std::nullopt, std::optional<int> frac_bits = std::nullopt, std::optional<int> bits = std::nullopt)

Create APyCFixed from Python float or int.

static APyCFixed from_complex(std::complex<double> value, std::optional<int> int_bits = std::nullopt, std::optional<int> frac_bits = std::nullopt, std::optional<int> bits = std::nullopt)

Create APyCFixed from complex double.

static APyCFixed from_double(double value, std::optional<int> int_bits = std::nullopt, std::optional<int> frac_bits = std::nullopt, std::optional<int> bits = std::nullopt)

Create APyCFixed from double.

static APyCFixed from_integer(const nb::int_ &value, std::optional<int> int_bits = std::nullopt, std::optional<int> frac_bits = std::nullopt, std::optional<int> bits = std::nullopt)

Create APyCFixed from Python integer.

static APyCFixed from_apyfixed(const APyFixed &value, std::optional<int> int_bits = std::nullopt, std::optional<int> frac_bits = std::nullopt, std::optional<int> bits = std::nullopt)

Create APyCFixed from an APyFixed.

static APyCFixed one(int bits, int int_bits)

Get bit pattern for the complex-valued fixed-point one.

Friends

friend class APyCFixedArray