APyCFixedArray
¶
-
class APyCFixedArray : public APyArray<apy_limb_t, APyCFixedArray>¶
Public Functions
-
inline APyCFixedArray create_array(const std::vector<std::size_t> &shape) const¶
-
inline bool is_same_spec(const APyCFixedArray &other) const noexcept¶
Test if two fixed-point vectors have the same bit specifiers.
-
inline bool is_same_spec(const APyCFixed &other) const noexcept¶
Test if
*this
has the same bit specifiers as anotherAPyCFixed
-
inline APyFixedSpec spec() const noexcept¶
Retrieve the bit specification.
-
APyCFixedArray() = delete¶
No default (empty) constructed
APyCFixedArray
objects. At least the bit-specifiers and shape has to be set during construction.
-
explicit APyCFixedArray(const nb::typed<nb::iterable, nb::any> &bit_pattern_sequence, std::optional<int> int_bits = std::nullopt, std::optional<int> frac_bits = std::nullopt, std::optional<int> bits = std::nullopt)¶
-
explicit APyCFixedArray(const std::vector<std::size_t> &shape, int bits, int int_bits)¶
Constructor: specify only shape and word-length. Zero data on construction.
-
explicit APyCFixedArray(const std::vector<std::size_t> &shape, int bits, int int_bits, vector_type &&v)¶
Constructor: specify shape and word-length and steal the data from vector.
-
explicit APyCFixedArray(const std::vector<std::size_t> &shape, std::optional<int> int_bits = std::nullopt, std::optional<int> frac_bits = std::nullopt, std::optional<int> bits = std::nullopt)¶
Constructor: specify only shape and word-length. Zero data on construction.
-
APyCFixedArray operator+(const APyCFixedArray &rhs) const¶
-
APyCFixedArray operator+(const APyCFixed &rhs) const¶
-
APyCFixedArray operator-(const APyCFixedArray &rhs) const¶
-
APyCFixedArray operator-(const APyCFixed &rhs) const¶
-
APyCFixedArray operator*(const APyCFixedArray &rhs) const¶
-
APyCFixedArray operator*(const APyCFixed &rhs) const¶
-
APyCFixedArray operator/(const APyCFixedArray &rhs) const¶
-
APyCFixedArray operator/(const APyCFixed &rhs) const¶
-
APyCFixedArray operator<<(const int shift_val) const¶
-
APyCFixedArray operator>>(const int shift_val) const¶
-
APyCFixedArray &operator<<=(const int shift_val)¶
-
APyCFixedArray &operator>>=(const int shift_val)¶
-
APyCFixedArray rsub(const APyCFixed &rhs) const¶
-
APyCFixedArray rdiv(const APyCFixed &rhs) const¶
-
APyCFixedArray operator-() const¶
Elementwise unary negation.
-
inline APyCFixedArray operator+() const¶
Elementwise unary positive.
-
APyCFixedArray operator~() const¶
Elementwise logic not.
-
std::variant<APyCFixedArray, APyCFixed> matmul(const APyCFixedArray &rhs) const¶
Matrix multiplication. If both arguments are 2-D tensors, this method performs the ordinary matrix multiplication. If input dimensions are greater than 2, this method performs stacked matrix multiplications, where the dimensions of last two dimensions are treated as matrices.
-
APyCFixed checked_inner_product(const APyCFixedArray &rhs, std::optional<APyFixedAccumulatorOption> mode) const¶
Evaluate the inner between two vectors. This method assumes that the shape of both
*this
andrhs
are equally long. Anything else is undefined behaviour.
-
APyCFixedArray checked_2d_matmul(const APyCFixedArray &rhs, std::optional<APyFixedAccumulatorOption> mode) const¶
Evaluate the matrix product between two 2D matrices. This method assumes that the shape of
*this
andrhs
have been checked to match a 2D matrix multiplication.
-
APyCFixedArray convolve(const APyCFixedArray &other, const std::string &mode) const¶
Perform a linear convolution with
other
usingmode
-
inline int bits() const noexcept¶
Number of bits.
-
inline int int_bits() const noexcept¶
Number of integer bits.
-
inline int frac_bits() const noexcept¶
Number of fractional bits.
-
std::string repr() const¶
Retrieve the string representation.
-
nb::ndarray<nb::numpy, std::complex<double>> to_numpy() const¶
Convert to a NumPy array.
-
std::variant<APyCFixedArray, APyCFixed> sum(const std::optional<PyShapeParam_t> &axis = std::nullopt) const¶
Sum over one or more axes.
-
APyCFixedArray cumsum(std::optional<nb::int_> axis = std::nullopt) const¶
Cumulative sum over one or more axes.
-
std::variant<APyCFixedArray, APyCFixed> prod(const std::optional<PyShapeParam_t> &axis = std::nullopt) const¶
Multiplication over one or more axes.
-
APyCFixedArray cumprod(std::optional<nb::int_> axis = std::nullopt) const¶
Cumulative multiplication over one or more axes.
-
APyFixedArray get_real() const¶
Retrieve real part.
-
APyFixedArray get_imag() const¶
Retrieve imaginary part.
-
APyCFixedArray 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¶
Construct a new
APyCFixedArray
tensor object with the sameshape
and fixed-point values as*this
, but with a new word-length. The underlying bit-pattern of each tensor element are copied into place, meaning that lowering the number of fractional bits may result in quantization, and lowering the number of integer bits may result in overflowing. Supports quantization and overflow options on narrowing casts.
-
std::string to_string(int base = 10) const¶
Retrieve a string of the stored values in this array.
-
std::string to_string_dec() const¶
Public Static Functions
-
static inline APyCFixedArray create_array_static(const std::vector<std::size_t> &shape, const APyCFixed &fix)¶
-
static APyCFixedArray from_complex(const nb::typed<nb::iterable, nb::any> &cplx_seq, std::optional<int> int_bits = std::nullopt, std::optional<int> frac_bits = std::nullopt, std::optional<int> bits = std::nullopt)¶
Create an
APyCFixedArray
tensor object initialized with values from a sequence ofcomplex
-
static APyCFixedArray from_numbers(const nb::typed<nb::iterable, nb::any> &number_seq, std::optional<int> int_bits = std::nullopt, std::optional<int> frac_bits = std::nullopt, std::optional<int> bits = std::nullopt)¶
Create an
APyCFixedArray
tensor object initialized with values from a sequence of numbers
-
static APyCFixedArray from_array(const nb::ndarray<nb::c_contig> &ndarray, std::optional<int> int_bits = std::nullopt, std::optional<int> frac_bits = std::nullopt, std::optional<int> bits = std::nullopt)¶
Create an
APyCFixedArray
tensor object initialized with values from an ndarray.
-
static APyCFixedArray zeros(const PyShapeParam_t &shape, std::optional<int> int_bits = std::nullopt, std::optional<int> frac_bits = std::nullopt, std::optional<int> bits = std::nullopt)¶
Create an
APyCFixedArray
initialized with zeros.
-
static APyCFixedArray ones(const PyShapeParam_t &shape, std::optional<int> int_bits = std::nullopt, std::optional<int> frac_bits = std::nullopt, std::optional<int> bits = std::nullopt)¶
Create an
APyCFixedArray
initialized with ones.
-
static APyCFixedArray eye(const nb::int_ &N, std::optional<nb::int_> M = std::nullopt, std::optional<int> int_bits = std::nullopt, std::optional<int> frac_bits = std::nullopt, std::optional<int> bits = std::nullopt)¶
Create an
APyCFixedArray
with ones on the diagonal and zeros elsewhere.
-
static APyCFixedArray identity(const nb::int_ &N, std::optional<int> int_bits = std::nullopt, std::optional<int> frac_bits = std::nullopt, std::optional<int> bits = std::nullopt)¶
Create a square
APyCFixedArray
with ones on the diagonal and zeros elsewhere.
-
static APyCFixedArray arange(const nb::object &start, const nb::object &stop, const nb::object &step, std::optional<int> int_bits = std::nullopt, std::optional<int> frac_bits = std::nullopt, std::optional<int> bits = std::nullopt)¶
Create an
APyCFixedArray
with evenly spaced values within a given interval.
Public Static Attributes
-
static constexpr auto ARRAY_NAME = std::string_view("APyCFixedArray")¶
Name of this array type (used when throwing errors)
-
inline APyCFixedArray create_array(const std::vector<std::size_t> &shape) const¶