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 fromit
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
intoit
-
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.
-
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
andint_bits
. Undefined behaviour ifbits < 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 ofbits
is less than one.
-
template<typename _IT>
explicit APyCFixed(int bits, int int_bits, _IT begin, _IT end)¶ Construct a number with
bits
andint_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
andint_bits
, and initialize underlying bit-pattern from iterator pair [begin
,end
).
-
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.
-
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.
Friends
- friend class APyCFixedArray
-
template<typename RANDOM_ACCESS_ITERATOR>