PolyArrayΒΆ

class PolyArrayΒΆ

A NumPy-like multidimensional array of polynomials. Supports indexing, slicing, broadcast-compatible arithmetic, and utility methods for building optimization expressions.

Methods

__init__

__init__

copy

Return a copy of the array.

decode

Deprecated alias of evaluate().

diagonal

Return a diagonal extracted from the array.

evaluate

Evaluate each element by substituting variable values.

fill

Fill all elements with a single polynomial or scalar value.

flatten

Return a flattened 1D copy of the array.

nonzero

Return the indices of non-zero elements.

ravel

Return a flattened 1D view when possible.

repeat

Repeat elements of the array.

reshape

Return a reshaped view of the array.

roll

Roll array elements along an axis.

substitute

Substitute variables in all elements of the array.

sum

Sum array elements over the specified axis or axes.

swapaxes

Return a view with two axes swapped.

take

Take elements from the array along an axis.

to_list

Convert the polynomial array to nested Python lists.

to_numpy

Convert the polynomial array to a NumPy float64 ndarray.

tolist

Alias of to_list().

tonumpy

Alias of to_numpy().

transpose

Permute axes and return a transposed view.

view

Return a view of the same underlying data.

Attributes

T

A transposed view of the array.

flat

A 1D view of the array.

ndim

The number of dimensions of the array.

shape

The shape of the array.

size

The total number of elements in the array.

class IteratorΒΆ
__class_getitem__()ΒΆ
__init__(*args, **kwargs)ΒΆ
__iter__(self) SelfΒΆ

__iter__

Return type:

Self

__next__(self: Iterator[Dim1]) PolyΒΆ
__next__(self: Iterator[Dim2]) PolyArray[Dim1]
__next__(self: Iterator[Dim3]) PolyArray[Dim2]
__next__(self: Iterator[Dim4]) PolyArray[Dim3]
__next__(self) Poly | PolyArray[Dim]

__next__

Overload 1.

Args:
  • self (amplify.PolyArray.Iterator[Dim1])

Returns:

amplify.Poly:

Overload 2.

Args:
  • self (amplify.PolyArray.Iterator[Dim2])

Returns:

amplify.PolyArray[Dim1]:

Overload 3.

Args:
  • self (amplify.PolyArray.Iterator[Dim3])

Returns:

amplify.PolyArray[Dim2]:

Overload 4.

Args:
  • self (amplify.PolyArray.Iterator[Dim4])

Returns:

amplify.PolyArray[Dim3]:

Overload 5.

Returns:

Poly | PolyArray[Dim]:

__nb_signature__ = 'class Iterator(typing.Generic[__Dim])'ΒΆ
__add__(self, arg: Poly | float | int, /) PolyArray[_Dim]ΒΆ
__add__(self, arg: list | ndarray[], /) PolyArray[Dim]
__add__(self, arg: PolyArray[Dim]) PolyArray[Dim]
__add__(self: PolyArray[Dim0], arg: PolyArray[__Dim]) PolyArray[__Dim]
__add__(self, arg: PolyArray[Dim0]) PolyArray[_Dim]
__add__(self: PolyArray[Dim1], arg: PolyArray[__Dim]) PolyArray[__Dim]
__add__(self, arg: PolyArray[Dim1]) PolyArray[_Dim]
__add__(self: PolyArray[Dim2], arg: PolyArray[__Dim]) PolyArray[__Dim]
__add__(self, arg: PolyArray[Dim2]) PolyArray[_Dim]
__add__(self: PolyArray[Dim3], arg: PolyArray[__Dim]) PolyArray[__Dim]
__add__(self, arg: PolyArray[Dim3]) PolyArray[_Dim]
__add__(self: PolyArray[Dim4], arg: PolyArray[__Dim]) PolyArray[__Dim]
__add__(self, arg: PolyArray[Dim4]) PolyArray[_Dim]

Perform element-wise arithmetic between two polynomial arrays, or between a polynomial array and a scalar, using broadcasting rules. __add__ __add__ __add__ __add__ __add__ __add__ __add__ __add__ __add__ __add__ __add__ __add__

Overload 1.

Args:
  • arg (amplify.Poly | float | int)

Returns:

amplify.PolyArray[_Dim]:

Overload 2.

Args:
  • arg (list | ndarray)

Returns:

amplify.PolyArray[Dim]:

Overload 3.

Args:
  • arg (amplify.PolyArray[Dim])

Returns:

amplify.PolyArray[Dim]:

Overload 4.

Args:
  • self (amplify.PolyArray[Dim0])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 5.

Args:
  • arg (amplify.PolyArray[Dim0])

Returns:

amplify.PolyArray[_Dim]:

Overload 6.

Args:
  • self (amplify.PolyArray[Dim1])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 7.

Args:
  • arg (amplify.PolyArray[Dim1])

Returns:

amplify.PolyArray[_Dim]:

Overload 8.

Args:
  • self (amplify.PolyArray[Dim2])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 9.

Args:
  • arg (amplify.PolyArray[Dim2])

Returns:

amplify.PolyArray[_Dim]:

Overload 10.

Args:
  • self (amplify.PolyArray[Dim3])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 11.

Args:
  • arg (amplify.PolyArray[Dim3])

Returns:

amplify.PolyArray[_Dim]:

Overload 12.

Args:
  • self (amplify.PolyArray[Dim4])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 13.

Args:
  • arg (amplify.PolyArray[Dim4])

Returns:

amplify.PolyArray[_Dim]:

__and__(self, arg: Poly | bool, /) PolyArray[_Dim]ΒΆ
__and__(self, arg: list | ndarray[dtype=bool], /) PolyArray[Dim]
__and__(self, arg: PolyArray[Dim]) PolyArray[Dim]
__and__(self: PolyArray[Dim0], arg: PolyArray[__Dim]) PolyArray[__Dim]
__and__(self, arg: PolyArray[Dim0]) PolyArray[_Dim]
__and__(self: PolyArray[Dim1], arg: PolyArray[__Dim]) PolyArray[__Dim]
__and__(self, arg: PolyArray[Dim1]) PolyArray[_Dim]
__and__(self: PolyArray[Dim2], arg: PolyArray[__Dim]) PolyArray[__Dim]
__and__(self, arg: PolyArray[Dim2]) PolyArray[_Dim]
__and__(self: PolyArray[Dim3], arg: PolyArray[__Dim]) PolyArray[__Dim]
__and__(self, arg: PolyArray[Dim3]) PolyArray[_Dim]
__and__(self: PolyArray[Dim4], arg: PolyArray[__Dim]) PolyArray[__Dim]
__and__(self, arg: PolyArray[Dim4]) PolyArray[_Dim]

__and__

Overload 1.

Args:
  • arg (amplify.Poly | bool)

Returns:

amplify.PolyArray[_Dim]:

Overload 2.

Args:
  • arg (list | ndarray)

Returns:

amplify.PolyArray[Dim]:

Overload 3.

Args:
  • arg (amplify.PolyArray[Dim])

Returns:

amplify.PolyArray[Dim]:

Overload 4.

Args:
  • self (amplify.PolyArray[Dim0])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 5.

Args:
  • arg (amplify.PolyArray[Dim0])

Returns:

amplify.PolyArray[_Dim]:

Overload 6.

Args:
  • self (amplify.PolyArray[Dim1])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 7.

Args:
  • arg (amplify.PolyArray[Dim1])

Returns:

amplify.PolyArray[_Dim]:

Overload 8.

Args:
  • self (amplify.PolyArray[Dim2])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 9.

Args:
  • arg (amplify.PolyArray[Dim2])

Returns:

amplify.PolyArray[_Dim]:

Overload 10.

Args:
  • self (amplify.PolyArray[Dim3])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 11.

Args:
  • arg (amplify.PolyArray[Dim3])

Returns:

amplify.PolyArray[_Dim]:

Overload 12.

Args:
  • self (amplify.PolyArray[Dim4])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 13.

Args:
  • arg (amplify.PolyArray[Dim4])

Returns:

amplify.PolyArray[_Dim]:

__bool__(self) boolΒΆ

Cast a polynomial array to a number. This is valid only when the array has exactly one element and that element is a constant polynomial.

Return type:

bool

__class_getitem__()ΒΆ
__copy__(self) PolyArray[_Dim]ΒΆ

Copy the array.

Each polynomial in the array is copied as well. Equivalent to copy().

Return type:

PolyArray[_Dim]

__deepcopy__(self, arg: dict, /) PolyArray[_Dim]ΒΆ

Copy the array.

Each polynomial in the array is copied as well. Equivalent to copy().

Parameters:

arg (dict)

Return type:

PolyArray[_Dim]

__eq__(self, arg: amplify.PolyArray | amplify.Poly | float | int | list | ndarray[], /) numpy.ndarray[dtype=bool]ΒΆ
__eq__(self, arg: object, /) bool

Perform element-wise comparisons between two polynomial arrays, or between a polynomial array and a scalar, using broadcasting rules. __eq__

Overload 1.

Args:
  • arg (amplify.PolyArray | amplify.Poly | float | int | list | ndarray)

Returns:

numpy.ndarray:

Overload 2.

Args:
  • arg (object)

Returns:

bool:

__float__(self) floatΒΆ

Cast a polynomial array to a number. This is valid only when the array has exactly one element and that element is a constant polynomial.

Return type:

float

__getitem__(self: PolyArray[Dim0], arg: tuple[()]) PolyΒΆ
__getitem__(self: PolyArray[Dim0], arg: types.EllipsisType) PolyArray[Dim0]
__getitem__(self: PolyArray[Dim1], arg: tuple[int] | int) Poly
__getitem__(self: PolyArray[Dim1], arg: types.EllipsisType | tuple[()] | slice | tuple[slice]) PolyArray[Dim1]
__getitem__(self: PolyArray[Dim2], arg: tuple[int, int]) Poly
__getitem__(
self: PolyArray[Dim2],
arg: int | tuple[int] | tuple[slice, int] | tuple[int, slice],
) PolyArray[Dim1]
__getitem__(
self: PolyArray[Dim2],
arg: types.EllipsisType | tuple[()] | slice | tuple[slice] | tuple[slice, slice],
) PolyArray[Dim2]
__getitem__(self: PolyArray[Dim3], arg: tuple[int, int, int]) Poly
__getitem__(
self: PolyArray[Dim3],
arg: tuple[int, int] | tuple[slice, int, int] | tuple[int, slice, int] | tuple[int, int, slice],
) PolyArray[Dim1]
__getitem__(
self: PolyArray[Dim3],
arg: int | tuple[int] | tuple[slice, int] | tuple[int, slice] | tuple[slice, slice, int] | tuple[slice, int, slice] | tuple[int, slice, slice],
) PolyArray[Dim2]
__getitem__(
self: PolyArray[Dim3],
arg: types.EllipsisType | tuple[()] | slice | tuple[slice] | tuple[slice, slice] | tuple[slice, slice, slice],
) PolyArray[Dim3]
__getitem__(self: PolyArray[Dim4], arg: tuple[int, int, int, int]) Poly
__getitem__(
self: PolyArray[Dim4],
arg: tuple[int, int, int] | tuple[slice, int, int, int] | tuple[int, slice, int, int] | tuple[int, int, slice, int] | tuple[int, int, int, slice],
) PolyArray[Dim1]
__getitem__(
self: PolyArray[Dim4],
arg: tuple[int, int] | tuple[slice, int, int] | tuple[int, slice, int] | tuple[int, int, slice] | tuple[slice, slice, int, int] | tuple[slice, int, slice, int] | tuple[slice, int, int, slice] | tuple[int, slice, slice, int] | tuple[int, slice, int, slice] | tuple[int, int, slice, slice],
) PolyArray[Dim2]
__getitem__(
self: PolyArray[Dim4],
arg: int | tuple[int] | tuple[slice, int] | tuple[int, slice] | tuple[slice, slice, int] | tuple[int, slice, slice] | tuple[slice, int, slice] | tuple[slice, slice, slice, int] | tuple[slice, slice, int, slice] | tuple[slice, int, slice, slice] | tuple[int, slice, slice, slice],
) PolyArray[Dim3]
__getitem__(
self: PolyArray[Dim4],
arg: types.EllipsisType | tuple[()] | slice | tuple[slice] | tuple[slice, slice] | tuple[slice, slice, slice] | tuple[slice, slice, slice, slice],
) PolyArray[Dim4]
__getitem__(self: PolyArray[Dim], arg: tuple | slice | types.EllipsisType | int | None) PolyArray[Dim]

Return a polynomial or a polynomial subarray. __getitem__ __getitem__ __getitem__ __getitem__ __getitem__ __getitem__ __getitem__ __getitem__ __getitem__ __getitem__ __getitem__ __getitem__ __getitem__ __getitem__ __getitem__ __getitem__

Supports indexing with integers, slices, ellipsis, and newaxis. Advanced indexing with arrays of indices is not supported.

Overload 1.

Args:
  • self (amplify.PolyArray[Dim0]): self

  • arg (tuple[()]): An index specified as an integer, slice, ellipsis, or newaxis.

Returns:

amplify.Poly: Selected element or slice, depending on the index.

Raises:

IndexError: If any index is out of bounds. TypeError: If index type is invalid.

Overload 2.

Args:
  • self (amplify.PolyArray[Dim0])

  • arg (types.EllipsisType)

Returns:

amplify.PolyArray[Dim0]:

Overload 3.

Args:
  • self (amplify.PolyArray[Dim1])

  • arg (tuple[int] | int)

Returns:

amplify.Poly:

Overload 4.

Args:
  • self (amplify.PolyArray[Dim1])

  • arg (types.EllipsisType | tuple[()] | slice | tuple[slice])

Returns:

amplify.PolyArray[Dim1]:

Overload 5.

Args:
  • self (amplify.PolyArray[Dim2])

  • arg (tuple[int, int])

Returns:

amplify.Poly:

Overload 6.

Args:
  • self (amplify.PolyArray[Dim2])

  • arg (int | tuple[int] | tuple[slice, int] | tuple[int, slice])

Returns:

amplify.PolyArray[Dim1]:

Overload 7.

Args:
  • self (amplify.PolyArray[Dim2])

  • arg (types.EllipsisType | tuple[()] | slice | tuple[slice] | tuple[slice, slice])

Returns:

amplify.PolyArray[Dim2]:

Overload 8.

Args:
  • self (amplify.PolyArray[Dim3])

  • arg (tuple[int, int, int])

Returns:

amplify.Poly:

Overload 9.

Args:
  • self (amplify.PolyArray[Dim3])

  • arg (tuple[int, int] | tuple[slice, int, int] | tuple[int, slice, int] | tuple[int, int, slice])

Returns:

amplify.PolyArray[Dim1]:

Overload 10.

Args:
  • self (amplify.PolyArray[Dim3])

  • arg (int | tuple[int] | tuple[slice, int] | tuple[int, slice] | tuple[slice, slice, int] | tuple[slice, int, slice] | tuple[int, slice, slice])

Returns:

amplify.PolyArray[Dim2]:

Overload 11.

Args:
  • self (amplify.PolyArray[Dim3])

  • arg (types.EllipsisType | tuple[()] | slice | tuple[slice] | tuple[slice, slice] | tuple[slice, slice, slice])

Returns:

amplify.PolyArray[Dim3]:

Overload 12.

Args:
  • self (amplify.PolyArray[Dim4])

  • arg (tuple[int, int, int, int])

Returns:

amplify.Poly:

Overload 13.

Args:
  • self (amplify.PolyArray[Dim4])

  • arg (tuple[int, int, int] | tuple[slice, int, int, int] | tuple[int, slice, int, int] | tuple[int, int, slice, int] | tuple[int, int, int, slice])

Returns:

amplify.PolyArray[Dim1]:

Overload 14.

Args:
  • self (amplify.PolyArray[Dim4])

  • arg (tuple[int, int] | tuple[slice, int, int] | tuple[int, slice, int] | tuple[int, int, slice] | tuple[slice, slice, int, int] | tuple[slice, int, slice, int] | tuple[slice, int, int, slice] | tuple[int, slice, slice, int] | tuple[int, slice, int, slice] | tuple[int, int, slice, slice])

Returns:

amplify.PolyArray[Dim2]:

Overload 15.

Args:
  • self (amplify.PolyArray[Dim4])

  • arg (int | tuple[int] | tuple[slice, int] | tuple[int, slice] | tuple[slice, slice, int] | tuple[int, slice, slice] | tuple[slice, int, slice] | tuple[slice, slice, slice, int] | tuple[slice, slice, int, slice] | tuple[slice, int, slice, slice] | tuple[int, slice, slice, slice])

Returns:

amplify.PolyArray[Dim3]:

Overload 16.

Args:
  • self (amplify.PolyArray[Dim4])

  • arg (types.EllipsisType | tuple[()] | slice | tuple[slice] | tuple[slice, slice] | tuple[slice, slice, slice] | tuple[slice, slice, slice, slice])

Returns:

amplify.PolyArray[Dim4]:

Overload 17.

Args:
  • self (amplify.PolyArray[Dim])

  • arg (tuple | slice | types.EllipsisType | int | None)

Returns:

amplify.PolyArray[Dim]:

Example

``` from amplify import VariableGenerator, newaxis

q = VariableGenerator().array(β€œBinary”, (3, 4)) print(q[1, 2]) # Output: Poly(q_{1,2}) print(q[0]) # Output: PolyArray([q_{0,0}, q_{0,1}, q_{0,2}, q_{0,3}]) print(q[:, 0]) # Output: PolyArray([q_{0,0}, q_{1,0}, q_{2,0}]) print(q[…, 0]) # Output: PolyArray([q_{0,0}, q_{1,0}, q_{2,0}]) print(q[1, newaxis]) # Output: PolyArray([[q_{1,0}, q_{1,1}, q_{1,2}, q_{1,3}]]) ```

__iadd__(self, arg: Poly | float | int, /) PolyArray[_Dim]ΒΆ
__iadd__(self, arg: list | ndarray[], /) PolyArray[_Dim]
__iadd__(self: PolyArray[Dim], arg: PolyArray[__Dim]) PolyArray[Dim]
__iadd__(self: PolyArray[Dim0], arg: PolyArray[Dim0]) PolyArray[Dim0]
__iadd__(self: PolyArray[Dim1], arg: PolyArray[Dim0 | Dim1]) PolyArray[Dim1]
__iadd__(self: PolyArray[Dim2], arg: PolyArray[Dim0 | Dim1 | Dim2]) PolyArray[Dim2]
__iadd__(self: PolyArray[Dim3], arg: PolyArray[Dim0 | Dim1 | Dim2 | Dim3]) PolyArray[Dim3]
__iadd__(self: PolyArray[Dim4], arg: PolyArray[Dim0 | Dim1 | Dim2 | Dim3 | Dim4]) PolyArray[Dim4]

__iadd__

Overload 1.

Args:
  • arg (amplify.Poly | float | int)

Returns:

amplify.PolyArray[_Dim]:

Overload 2.

Args:
  • arg (list | ndarray)

Returns:

amplify.PolyArray[_Dim]:

Overload 3.

Args:
  • self (amplify.PolyArray[Dim])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[Dim]:

Overload 4.

Args:
  • self (amplify.PolyArray[Dim0])

  • arg (amplify.PolyArray[Dim0])

Returns:

amplify.PolyArray[Dim0]:

Overload 5.

Args:
  • self (amplify.PolyArray[Dim1])

  • arg (PolyArray[Dim0 | Dim1])

Returns:

amplify.PolyArray[Dim1]:

Overload 6.

Args:
  • self (amplify.PolyArray[Dim2])

  • arg (PolyArray[Dim0 | Dim1 | Dim2])

Returns:

amplify.PolyArray[Dim2]:

Overload 7.

Args:
  • self (amplify.PolyArray[Dim3])

  • arg (PolyArray[Dim0 | Dim1 | Dim2 | Dim3])

Returns:

amplify.PolyArray[Dim3]:

Overload 8.

Args:
  • self (amplify.PolyArray[Dim4])

  • arg (PolyArray[Dim0 | Dim1 | Dim2 | Dim3 | Dim4])

Returns:

amplify.PolyArray[Dim4]:

__iand__(self, arg: Poly | bool, /) PolyArray[_Dim]ΒΆ
__iand__(self, arg: list | ndarray[dtype=bool], /) PolyArray[Dim]
__iand__(self, arg: PolyArray[Dim]) PolyArray[Dim]
__iand__(self: PolyArray[Dim0], arg: PolyArray[__Dim]) PolyArray[__Dim]
__iand__(self, arg: PolyArray[Dim0]) PolyArray[_Dim]
__iand__(self: PolyArray[Dim1], arg: PolyArray[__Dim]) PolyArray[__Dim]
__iand__(self, arg: PolyArray[Dim1]) PolyArray[_Dim]
__iand__(self: PolyArray[Dim2], arg: PolyArray[__Dim]) PolyArray[__Dim]
__iand__(self, arg: PolyArray[Dim2]) PolyArray[_Dim]
__iand__(self: PolyArray[Dim3], arg: PolyArray[__Dim]) PolyArray[__Dim]
__iand__(self, arg: PolyArray[Dim3]) PolyArray[_Dim]
__iand__(self: PolyArray[Dim4], arg: PolyArray[__Dim]) PolyArray[__Dim]
__iand__(self, arg: PolyArray[Dim4]) PolyArray[_Dim]

__iand__

Overload 1.

Args:
  • arg (amplify.Poly | bool)

Returns:

amplify.PolyArray[_Dim]:

Overload 2.

Args:
  • arg (list | ndarray)

Returns:

amplify.PolyArray[Dim]:

Overload 3.

Args:
  • arg (amplify.PolyArray[Dim])

Returns:

amplify.PolyArray[Dim]:

Overload 4.

Args:
  • self (amplify.PolyArray[Dim0])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 5.

Args:
  • arg (amplify.PolyArray[Dim0])

Returns:

amplify.PolyArray[_Dim]:

Overload 6.

Args:
  • self (amplify.PolyArray[Dim1])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 7.

Args:
  • arg (amplify.PolyArray[Dim1])

Returns:

amplify.PolyArray[_Dim]:

Overload 8.

Args:
  • self (amplify.PolyArray[Dim2])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 9.

Args:
  • arg (amplify.PolyArray[Dim2])

Returns:

amplify.PolyArray[_Dim]:

Overload 10.

Args:
  • self (amplify.PolyArray[Dim3])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 11.

Args:
  • arg (amplify.PolyArray[Dim3])

Returns:

amplify.PolyArray[_Dim]:

Overload 12.

Args:
  • self (amplify.PolyArray[Dim4])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 13.

Args:
  • arg (amplify.PolyArray[Dim4])

Returns:

amplify.PolyArray[_Dim]:

__imul__(self, arg: Poly | float | int, /) PolyArray[_Dim]ΒΆ
__imul__(self, arg: list | ndarray[], /) PolyArray[_Dim]
__imul__(self: PolyArray[Dim], arg: PolyArray[__Dim]) PolyArray[Dim]
__imul__(self: PolyArray[Dim0], arg: PolyArray[Dim0]) PolyArray[Dim0]
__imul__(self: PolyArray[Dim1], arg: PolyArray[Dim0 | Dim1]) PolyArray[Dim1]
__imul__(self: PolyArray[Dim2], arg: PolyArray[Dim0 | Dim1 | Dim2]) PolyArray[Dim2]
__imul__(self: PolyArray[Dim3], arg: PolyArray[Dim0 | Dim1 | Dim2 | Dim3]) PolyArray[Dim3]
__imul__(self: PolyArray[Dim4], arg: PolyArray[Dim0 | Dim1 | Dim2 | Dim3 | Dim4]) PolyArray[Dim4]

__imul__

Overload 1.

Args:
  • arg (amplify.Poly | float | int)

Returns:

amplify.PolyArray[_Dim]:

Overload 2.

Args:
  • arg (list | ndarray)

Returns:

amplify.PolyArray[_Dim]:

Overload 3.

Args:
  • self (amplify.PolyArray[Dim])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[Dim]:

Overload 4.

Args:
  • self (amplify.PolyArray[Dim0])

  • arg (amplify.PolyArray[Dim0])

Returns:

amplify.PolyArray[Dim0]:

Overload 5.

Args:
  • self (amplify.PolyArray[Dim1])

  • arg (PolyArray[Dim0 | Dim1])

Returns:

amplify.PolyArray[Dim1]:

Overload 6.

Args:
  • self (amplify.PolyArray[Dim2])

  • arg (PolyArray[Dim0 | Dim1 | Dim2])

Returns:

amplify.PolyArray[Dim2]:

Overload 7.

Args:
  • self (amplify.PolyArray[Dim3])

  • arg (PolyArray[Dim0 | Dim1 | Dim2 | Dim3])

Returns:

amplify.PolyArray[Dim3]:

Overload 8.

Args:
  • self (amplify.PolyArray[Dim4])

  • arg (PolyArray[Dim0 | Dim1 | Dim2 | Dim3 | Dim4])

Returns:

amplify.PolyArray[Dim4]:

__index__(self) intΒΆ

Cast a polynomial array to a number. This is valid only when the array has exactly one element and that element is a constant polynomial.

Return type:

int

__init__(self, object: ndarray[] | list | amplify.Poly) NoneΒΆ

__init__

Parameters:

object (ndarray)

__int__(self) intΒΆ

Cast a polynomial array to a number. This is valid only when the array has exactly one element and that element is a constant polynomial.

Return type:

int

__invert__(self) PolyArray[_Dim]ΒΆ

Perform an element-wise arithmetic operation.

Return type:

PolyArray[_Dim]

__ior__(self, arg: Poly | bool, /) PolyArray[_Dim]ΒΆ
__ior__(self, arg: list | ndarray[dtype=bool], /) PolyArray[Dim]
__ior__(self, arg: PolyArray[Dim]) PolyArray[Dim]
__ior__(self: PolyArray[Dim0], arg: PolyArray[__Dim]) PolyArray[__Dim]
__ior__(self, arg: PolyArray[Dim0]) PolyArray[_Dim]
__ior__(self: PolyArray[Dim1], arg: PolyArray[__Dim]) PolyArray[__Dim]
__ior__(self, arg: PolyArray[Dim1]) PolyArray[_Dim]
__ior__(self: PolyArray[Dim2], arg: PolyArray[__Dim]) PolyArray[__Dim]
__ior__(self, arg: PolyArray[Dim2]) PolyArray[_Dim]
__ior__(self: PolyArray[Dim3], arg: PolyArray[__Dim]) PolyArray[__Dim]
__ior__(self, arg: PolyArray[Dim3]) PolyArray[_Dim]
__ior__(self: PolyArray[Dim4], arg: PolyArray[__Dim]) PolyArray[__Dim]
__ior__(self, arg: PolyArray[Dim4]) PolyArray[_Dim]

__ior__

Overload 1.

Args:
  • arg (amplify.Poly | bool)

Returns:

amplify.PolyArray[_Dim]:

Overload 2.

Args:
  • arg (list | ndarray)

Returns:

amplify.PolyArray[Dim]:

Overload 3.

Args:
  • arg (amplify.PolyArray[Dim])

Returns:

amplify.PolyArray[Dim]:

Overload 4.

Args:
  • self (amplify.PolyArray[Dim0])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 5.

Args:
  • arg (amplify.PolyArray[Dim0])

Returns:

amplify.PolyArray[_Dim]:

Overload 6.

Args:
  • self (amplify.PolyArray[Dim1])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 7.

Args:
  • arg (amplify.PolyArray[Dim1])

Returns:

amplify.PolyArray[_Dim]:

Overload 8.

Args:
  • self (amplify.PolyArray[Dim2])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 9.

Args:
  • arg (amplify.PolyArray[Dim2])

Returns:

amplify.PolyArray[_Dim]:

Overload 10.

Args:
  • self (amplify.PolyArray[Dim3])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 11.

Args:
  • arg (amplify.PolyArray[Dim3])

Returns:

amplify.PolyArray[_Dim]:

Overload 12.

Args:
  • self (amplify.PolyArray[Dim4])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 13.

Args:
  • arg (amplify.PolyArray[Dim4])

Returns:

amplify.PolyArray[_Dim]:

__ipow__(self, arg: int, /) PolyArray[_Dim]ΒΆ

__ipow__

Parameters:

arg (int)

Return type:

PolyArray[_Dim]

__isub__(self, arg: Poly | float | int, /) PolyArray[_Dim]ΒΆ
__isub__(self, arg: list | ndarray[], /) PolyArray[_Dim]
__isub__(self: PolyArray[Dim], arg: PolyArray[__Dim]) PolyArray[Dim]
__isub__(self: PolyArray[Dim0], arg: PolyArray[Dim0]) PolyArray[Dim0]
__isub__(self: PolyArray[Dim1], arg: PolyArray[Dim0 | Dim1]) PolyArray[Dim1]
__isub__(self: PolyArray[Dim2], arg: PolyArray[Dim0 | Dim1 | Dim2]) PolyArray[Dim2]
__isub__(self: PolyArray[Dim3], arg: PolyArray[Dim0 | Dim1 | Dim2 | Dim3]) PolyArray[Dim3]
__isub__(self: PolyArray[Dim4], arg: PolyArray[Dim0 | Dim1 | Dim2 | Dim3 | Dim4]) PolyArray[Dim4]

__isub__

Overload 1.

Args:
  • arg (amplify.Poly | float | int)

Returns:

amplify.PolyArray[_Dim]:

Overload 2.

Args:
  • arg (list | ndarray)

Returns:

amplify.PolyArray[_Dim]:

Overload 3.

Args:
  • self (amplify.PolyArray[Dim])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[Dim]:

Overload 4.

Args:
  • self (amplify.PolyArray[Dim0])

  • arg (amplify.PolyArray[Dim0])

Returns:

amplify.PolyArray[Dim0]:

Overload 5.

Args:
  • self (amplify.PolyArray[Dim1])

  • arg (PolyArray[Dim0 | Dim1])

Returns:

amplify.PolyArray[Dim1]:

Overload 6.

Args:
  • self (amplify.PolyArray[Dim2])

  • arg (PolyArray[Dim0 | Dim1 | Dim2])

Returns:

amplify.PolyArray[Dim2]:

Overload 7.

Args:
  • self (amplify.PolyArray[Dim3])

  • arg (PolyArray[Dim0 | Dim1 | Dim2 | Dim3])

Returns:

amplify.PolyArray[Dim3]:

Overload 8.

Args:
  • self (amplify.PolyArray[Dim4])

  • arg (PolyArray[Dim0 | Dim1 | Dim2 | Dim3 | Dim4])

Returns:

amplify.PolyArray[Dim4]:

__iter__(self) Iterator[_Dim]ΒΆ

Iterate over the first axis of the polynomial array.

If the array has one or fewer dimensions, each yielded item is a polynomial. If the array has two or more dimensions, each yielded item is a subarray with one fewer dimension.

Return type:

Iterator[_Dim]

__itruediv__(self, arg: float | int | list | ndarray[], /) PolyArray[_Dim]ΒΆ

__itruediv__

Parameters:

arg (float | int | list | ndarray)

Return type:

PolyArray[_Dim]

__ixor__(self, arg: Poly | bool, /) PolyArray[_Dim]ΒΆ
__ixor__(self, arg: list | ndarray[dtype=bool], /) PolyArray[Dim]
__ixor__(self, arg: PolyArray[Dim]) PolyArray[Dim]
__ixor__(self: PolyArray[Dim0], arg: PolyArray[__Dim]) PolyArray[__Dim]
__ixor__(self, arg: PolyArray[Dim0]) PolyArray[_Dim]
__ixor__(self: PolyArray[Dim1], arg: PolyArray[__Dim]) PolyArray[__Dim]
__ixor__(self, arg: PolyArray[Dim1]) PolyArray[_Dim]
__ixor__(self: PolyArray[Dim2], arg: PolyArray[__Dim]) PolyArray[__Dim]
__ixor__(self, arg: PolyArray[Dim2]) PolyArray[_Dim]
__ixor__(self: PolyArray[Dim3], arg: PolyArray[__Dim]) PolyArray[__Dim]
__ixor__(self, arg: PolyArray[Dim3]) PolyArray[_Dim]
__ixor__(self: PolyArray[Dim4], arg: PolyArray[__Dim]) PolyArray[__Dim]
__ixor__(self, arg: PolyArray[Dim4]) PolyArray[_Dim]

__ixor__

Overload 1.

Args:
  • arg (amplify.Poly | bool)

Returns:

amplify.PolyArray[_Dim]:

Overload 2.

Args:
  • arg (list | ndarray)

Returns:

amplify.PolyArray[Dim]:

Overload 3.

Args:
  • arg (amplify.PolyArray[Dim])

Returns:

amplify.PolyArray[Dim]:

Overload 4.

Args:
  • self (amplify.PolyArray[Dim0])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 5.

Args:
  • arg (amplify.PolyArray[Dim0])

Returns:

amplify.PolyArray[_Dim]:

Overload 6.

Args:
  • self (amplify.PolyArray[Dim1])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 7.

Args:
  • arg (amplify.PolyArray[Dim1])

Returns:

amplify.PolyArray[_Dim]:

Overload 8.

Args:
  • self (amplify.PolyArray[Dim2])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 9.

Args:
  • arg (amplify.PolyArray[Dim2])

Returns:

amplify.PolyArray[_Dim]:

Overload 10.

Args:
  • self (amplify.PolyArray[Dim3])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 11.

Args:
  • arg (amplify.PolyArray[Dim3])

Returns:

amplify.PolyArray[_Dim]:

Overload 12.

Args:
  • self (amplify.PolyArray[Dim4])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 13.

Args:
  • arg (amplify.PolyArray[Dim4])

Returns:

amplify.PolyArray[_Dim]:

__len__(self) intΒΆ

Return the number of elements along the first axis.

Return type:

int

__matmul__(self, arg: amplify.PolyArray | ndarray[], /) Poly | PolyArray[_Dim]ΒΆ

Perform matrix multiplication on two polynomial arrays. For arrays with three or more dimensions, the last two dimensions are treated as matrices and the remaining dimensions as batch dimensions. Broadcasting is applied to the batch dimensions.

Parameters:

arg (PolyArray | ndarray)

Return type:

Poly | PolyArray[_Dim]

__mul__(self, arg: Poly | float | int, /) PolyArray[_Dim]ΒΆ
__mul__(self, arg: list | ndarray[], /) PolyArray[Dim]
__mul__(self, arg: PolyArray[Dim]) PolyArray[Dim]
__mul__(self: PolyArray[Dim0], arg: PolyArray[__Dim]) PolyArray[__Dim]
__mul__(self, arg: PolyArray[Dim0]) PolyArray[_Dim]
__mul__(self: PolyArray[Dim1], arg: PolyArray[__Dim]) PolyArray[__Dim]
__mul__(self, arg: PolyArray[Dim1]) PolyArray[_Dim]
__mul__(self: PolyArray[Dim2], arg: PolyArray[__Dim]) PolyArray[__Dim]
__mul__(self, arg: PolyArray[Dim2]) PolyArray[_Dim]
__mul__(self: PolyArray[Dim3], arg: PolyArray[__Dim]) PolyArray[__Dim]
__mul__(self, arg: PolyArray[Dim3]) PolyArray[_Dim]
__mul__(self: PolyArray[Dim4], arg: PolyArray[__Dim]) PolyArray[__Dim]
__mul__(self, arg: PolyArray[Dim4]) PolyArray[_Dim]

Perform element-wise arithmetic between two polynomial arrays, or between a polynomial array and a scalar, using broadcasting rules. __mul__ __mul__ __mul__ __mul__ __mul__ __mul__ __mul__ __mul__ __mul__ __mul__ __mul__ __mul__

Overload 1.

Args:
  • arg (amplify.Poly | float | int)

Returns:

amplify.PolyArray[_Dim]:

Overload 2.

Args:
  • arg (list | ndarray)

Returns:

amplify.PolyArray[Dim]:

Overload 3.

Args:
  • arg (amplify.PolyArray[Dim])

Returns:

amplify.PolyArray[Dim]:

Overload 4.

Args:
  • self (amplify.PolyArray[Dim0])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 5.

Args:
  • arg (amplify.PolyArray[Dim0])

Returns:

amplify.PolyArray[_Dim]:

Overload 6.

Args:
  • self (amplify.PolyArray[Dim1])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 7.

Args:
  • arg (amplify.PolyArray[Dim1])

Returns:

amplify.PolyArray[_Dim]:

Overload 8.

Args:
  • self (amplify.PolyArray[Dim2])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 9.

Args:
  • arg (amplify.PolyArray[Dim2])

Returns:

amplify.PolyArray[_Dim]:

Overload 10.

Args:
  • self (amplify.PolyArray[Dim3])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 11.

Args:
  • arg (amplify.PolyArray[Dim3])

Returns:

amplify.PolyArray[_Dim]:

Overload 12.

Args:
  • self (amplify.PolyArray[Dim4])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 13.

Args:
  • arg (amplify.PolyArray[Dim4])

Returns:

amplify.PolyArray[_Dim]:

__ne__(self, arg: amplify.PolyArray | amplify.Poly | float | int | list | ndarray[], /) numpy.ndarray[dtype=bool]ΒΆ
__ne__(self, arg: object, /) bool

Perform element-wise comparisons between two polynomial arrays, or between a polynomial array and a scalar, using broadcasting rules. __ne__

Overload 1.

Args:
  • arg (amplify.PolyArray | amplify.Poly | float | int | list | ndarray)

Returns:

numpy.ndarray:

Overload 2.

Args:
  • arg (object)

Returns:

bool:

__neg__(self) PolyArray[_Dim]ΒΆ

Perform an element-wise arithmetic operation.

Return type:

PolyArray[_Dim]

__or__(self, arg: Poly | bool, /) PolyArray[_Dim]ΒΆ
__or__(self, arg: list | ndarray[dtype=bool], /) PolyArray[Dim]
__or__(self, arg: PolyArray[Dim]) PolyArray[Dim]
__or__(self: PolyArray[Dim0], arg: PolyArray[__Dim]) PolyArray[__Dim]
__or__(self, arg: PolyArray[Dim0]) PolyArray[_Dim]
__or__(self: PolyArray[Dim1], arg: PolyArray[__Dim]) PolyArray[__Dim]
__or__(self, arg: PolyArray[Dim1]) PolyArray[_Dim]
__or__(self: PolyArray[Dim2], arg: PolyArray[__Dim]) PolyArray[__Dim]
__or__(self, arg: PolyArray[Dim2]) PolyArray[_Dim]
__or__(self: PolyArray[Dim3], arg: PolyArray[__Dim]) PolyArray[__Dim]
__or__(self, arg: PolyArray[Dim3]) PolyArray[_Dim]
__or__(self: PolyArray[Dim4], arg: PolyArray[__Dim]) PolyArray[__Dim]
__or__(self, arg: PolyArray[Dim4]) PolyArray[_Dim]

__or__

Overload 1.

Args:
  • arg (amplify.Poly | bool)

Returns:

amplify.PolyArray[_Dim]:

Overload 2.

Args:
  • arg (list | ndarray)

Returns:

amplify.PolyArray[Dim]:

Overload 3.

Args:
  • arg (amplify.PolyArray[Dim])

Returns:

amplify.PolyArray[Dim]:

Overload 4.

Args:
  • self (amplify.PolyArray[Dim0])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 5.

Args:
  • arg (amplify.PolyArray[Dim0])

Returns:

amplify.PolyArray[_Dim]:

Overload 6.

Args:
  • self (amplify.PolyArray[Dim1])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 7.

Args:
  • arg (amplify.PolyArray[Dim1])

Returns:

amplify.PolyArray[_Dim]:

Overload 8.

Args:
  • self (amplify.PolyArray[Dim2])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 9.

Args:
  • arg (amplify.PolyArray[Dim2])

Returns:

amplify.PolyArray[_Dim]:

Overload 10.

Args:
  • self (amplify.PolyArray[Dim3])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 11.

Args:
  • arg (amplify.PolyArray[Dim3])

Returns:

amplify.PolyArray[_Dim]:

Overload 12.

Args:
  • self (amplify.PolyArray[Dim4])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 13.

Args:
  • arg (amplify.PolyArray[Dim4])

Returns:

amplify.PolyArray[_Dim]:

__pos__(self) PolyArray[_Dim]ΒΆ

Perform an element-wise arithmetic operation.

Return type:

PolyArray[_Dim]

__pow__(self, arg: int, /) PolyArray[_Dim]ΒΆ

__pow__

Parameters:

arg (int)

Return type:

PolyArray[_Dim]

__radd__(self, arg: Poly | float | int, /) PolyArray[_Dim]ΒΆ
__radd__(self, arg: list | ndarray[], /) PolyArray[Dim]

__radd__

Overload 1.

Args:
  • arg (amplify.Poly | float | int)

Returns:

amplify.PolyArray[_Dim]:

Overload 2.

Args:
  • arg (list | ndarray)

Returns:

amplify.PolyArray[Dim]:

__rand__(self, arg: Poly | bool, /) PolyArray[_Dim]ΒΆ
__rand__(self, arg: list | ndarray[dtype=bool], /) PolyArray[Dim]

__rand__

Overload 1.

Args:
  • arg (amplify.Poly | bool)

Returns:

amplify.PolyArray[_Dim]:

Overload 2.

Args:
  • arg (list | ndarray)

Returns:

amplify.PolyArray[Dim]:

__repr__(self) strΒΆ

__repr__

Return type:

str

__rmatmul__(self, arg: NDArray | PolyArray[__Dim]) Poly | PolyArray[__Dim]ΒΆ

__rmatmul__

Parameters:

arg (NDArray | PolyArray[__Dim])

Return type:

Poly | PolyArray[__Dim]

__rmul__(self, arg: Poly | float | int, /) PolyArray[_Dim]ΒΆ
__rmul__(self, arg: list | ndarray[], /) PolyArray[Dim]

__rmul__

Overload 1.

Args:
  • arg (amplify.Poly | float | int)

Returns:

amplify.PolyArray[_Dim]:

Overload 2.

Args:
  • arg (list | ndarray)

Returns:

amplify.PolyArray[Dim]:

__ror__(self, arg: Poly | bool, /) PolyArray[_Dim]ΒΆ
__ror__(self, arg: list | ndarray[dtype=bool], /) PolyArray[Dim]

__ror__

Overload 1.

Args:
  • arg (amplify.Poly | bool)

Returns:

amplify.PolyArray[_Dim]:

Overload 2.

Args:
  • arg (list | ndarray)

Returns:

amplify.PolyArray[Dim]:

__rsub__(self, arg: Poly | float | int, /) PolyArray[_Dim]ΒΆ
__rsub__(self, arg: list | ndarray[], /) PolyArray[Dim]

__rsub__

Overload 1.

Args:
  • arg (amplify.Poly | float | int)

Returns:

amplify.PolyArray[_Dim]:

Overload 2.

Args:
  • arg (list | ndarray)

Returns:

amplify.PolyArray[Dim]:

__rxor__(self, arg: Poly | bool, /) PolyArray[_Dim]ΒΆ
__rxor__(self, arg: list | ndarray[dtype=bool], /) PolyArray[Dim]

__rxor__

Overload 1.

Args:
  • arg (amplify.Poly | bool)

Returns:

amplify.PolyArray[_Dim]:

Overload 2.

Args:
  • arg (list | ndarray)

Returns:

amplify.PolyArray[Dim]:

__setitem__(
self,
arg: tuple | slice | types.EllipsisType | int | None,
value: amplify.Poly | float | int | list | ndarray[] | amplify.PolyArray,
) NoneΒΆ

Assign a polynomial or a polynomial subarray.

Supports indexing with integers, slices, ellipsis, and newaxis. Advanced indexing with arrays of indices is not supported.

Parameters:
  • arg (tuple | slice | types.EllipsisType | int | None) – An index specified as an integer, slice, ellipsis, or newaxis.

  • value (Poly | float | int | list | ndarray) – Value to assign, compatible with the indexed shape.

Raises:
  • IndexError – If any index is out of bounds.

  • TypeError – If index type is invalid or value shape is incompatible.

__str__(self) strΒΆ

__str__

Return type:

str

__sub__(self, arg: Poly | float | int, /) PolyArray[_Dim]ΒΆ
__sub__(self, arg: list | ndarray[], /) PolyArray[Dim]
__sub__(self, arg: PolyArray[Dim]) PolyArray[Dim]
__sub__(self: PolyArray[Dim0], arg: PolyArray[__Dim]) PolyArray[__Dim]
__sub__(self, arg: PolyArray[Dim0]) PolyArray[_Dim]
__sub__(self: PolyArray[Dim1], arg: PolyArray[__Dim]) PolyArray[__Dim]
__sub__(self, arg: PolyArray[Dim1]) PolyArray[_Dim]
__sub__(self: PolyArray[Dim2], arg: PolyArray[__Dim]) PolyArray[__Dim]
__sub__(self, arg: PolyArray[Dim2]) PolyArray[_Dim]
__sub__(self: PolyArray[Dim3], arg: PolyArray[__Dim]) PolyArray[__Dim]
__sub__(self, arg: PolyArray[Dim3]) PolyArray[_Dim]
__sub__(self: PolyArray[Dim4], arg: PolyArray[__Dim]) PolyArray[__Dim]
__sub__(self, arg: PolyArray[Dim4]) PolyArray[_Dim]

Perform element-wise arithmetic between two polynomial arrays, or between a polynomial array and a scalar, using broadcasting rules. __sub__ __sub__ __sub__ __sub__ __sub__ __sub__ __sub__ __sub__ __sub__ __sub__ __sub__ __sub__

Overload 1.

Args:
  • arg (amplify.Poly | float | int)

Returns:

amplify.PolyArray[_Dim]:

Overload 2.

Args:
  • arg (list | ndarray)

Returns:

amplify.PolyArray[Dim]:

Overload 3.

Args:
  • arg (amplify.PolyArray[Dim])

Returns:

amplify.PolyArray[Dim]:

Overload 4.

Args:
  • self (amplify.PolyArray[Dim0])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 5.

Args:
  • arg (amplify.PolyArray[Dim0])

Returns:

amplify.PolyArray[_Dim]:

Overload 6.

Args:
  • self (amplify.PolyArray[Dim1])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 7.

Args:
  • arg (amplify.PolyArray[Dim1])

Returns:

amplify.PolyArray[_Dim]:

Overload 8.

Args:
  • self (amplify.PolyArray[Dim2])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 9.

Args:
  • arg (amplify.PolyArray[Dim2])

Returns:

amplify.PolyArray[_Dim]:

Overload 10.

Args:
  • self (amplify.PolyArray[Dim3])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 11.

Args:
  • arg (amplify.PolyArray[Dim3])

Returns:

amplify.PolyArray[_Dim]:

Overload 12.

Args:
  • self (amplify.PolyArray[Dim4])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 13.

Args:
  • arg (amplify.PolyArray[Dim4])

Returns:

amplify.PolyArray[_Dim]:

__truediv__(self, arg: float | int, /) PolyArray[_Dim]ΒΆ
__truediv__(self, arg: list | ndarray[], /) PolyArray[Dim]

Perform element-wise arithmetic between two polynomial arrays, or between a polynomial array and a scalar, using broadcasting rules. __truediv__

Overload 1.

Args:
  • arg (float | int)

Returns:

amplify.PolyArray[_Dim]:

Overload 2.

Args:
  • arg (list | ndarray)

Returns:

amplify.PolyArray[Dim]:

__xor__(self, arg: Poly | bool, /) PolyArray[_Dim]ΒΆ
__xor__(self, arg: list | ndarray[dtype=bool], /) PolyArray[Dim]
__xor__(self, arg: PolyArray[Dim]) PolyArray[Dim]
__xor__(self: PolyArray[Dim0], arg: PolyArray[__Dim]) PolyArray[__Dim]
__xor__(self, arg: PolyArray[Dim0]) PolyArray[_Dim]
__xor__(self: PolyArray[Dim1], arg: PolyArray[__Dim]) PolyArray[__Dim]
__xor__(self, arg: PolyArray[Dim1]) PolyArray[_Dim]
__xor__(self: PolyArray[Dim2], arg: PolyArray[__Dim]) PolyArray[__Dim]
__xor__(self, arg: PolyArray[Dim2]) PolyArray[_Dim]
__xor__(self: PolyArray[Dim3], arg: PolyArray[__Dim]) PolyArray[__Dim]
__xor__(self, arg: PolyArray[Dim3]) PolyArray[_Dim]
__xor__(self: PolyArray[Dim4], arg: PolyArray[__Dim]) PolyArray[__Dim]
__xor__(self, arg: PolyArray[Dim4]) PolyArray[_Dim]

__xor__

Overload 1.

Args:
  • arg (amplify.Poly | bool)

Returns:

amplify.PolyArray[_Dim]:

Overload 2.

Args:
  • arg (list | ndarray)

Returns:

amplify.PolyArray[Dim]:

Overload 3.

Args:
  • arg (amplify.PolyArray[Dim])

Returns:

amplify.PolyArray[Dim]:

Overload 4.

Args:
  • self (amplify.PolyArray[Dim0])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 5.

Args:
  • arg (amplify.PolyArray[Dim0])

Returns:

amplify.PolyArray[_Dim]:

Overload 6.

Args:
  • self (amplify.PolyArray[Dim1])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 7.

Args:
  • arg (amplify.PolyArray[Dim1])

Returns:

amplify.PolyArray[_Dim]:

Overload 8.

Args:
  • self (amplify.PolyArray[Dim2])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 9.

Args:
  • arg (amplify.PolyArray[Dim2])

Returns:

amplify.PolyArray[_Dim]:

Overload 10.

Args:
  • self (amplify.PolyArray[Dim3])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 11.

Args:
  • arg (amplify.PolyArray[Dim3])

Returns:

amplify.PolyArray[_Dim]:

Overload 12.

Args:
  • self (amplify.PolyArray[Dim4])

  • arg (amplify.PolyArray[__Dim])

Returns:

amplify.PolyArray[__Dim]:

Overload 13.

Args:
  • arg (amplify.PolyArray[Dim4])

Returns:

amplify.PolyArray[_Dim]:

copy(self) PolyArray[_Dim]ΒΆ

Return a copy of the array.

Each polynomial in the array is copied as well.

Returns:

Copy of the array.

Return type:

PolyArray[_Dim]

decode(self, values: Values) numpy.ndarray[dtype=float64]ΒΆ
decode(self, values: Values, default: float) numpy.ndarray[dtype=float64]
decode(self, values: Values, default: None) PolyArray[_Dim]

Deprecated alias of evaluate(). decode decode

This method is deprecated since Amplify v1.0.0 and will be removed in a future version.

Overload 1.

Args:
  • values (amplify.Values): Values from optimization results, such as result.best.values.

Returns:

numpy.ndarray: Evaluated numeric values with the same shape.

Overload 2.

Args:
  • values (amplify.Values): Values from optimization results, such as result.best.values.

  • default (float): The default numeric value used for variables not present in values.

Returns:

numpy.ndarray: Evaluated numeric values with the same shape.

Overload 3.

Args:
  • values (amplify.Values): Values from optimization results, such as result.best.values.

  • default (None): Set to None to keep unassigned variables symbolic.

Returns:

amplify.PolyArray[_Dim]: Array with substitutions applied.

diagonal(self: PolyArray[Dim], offset: int = 0, axis1: int = 0, axis2: int = 1) PolyArray[Dim]ΒΆ
diagonal(self: PolyArray[Dim2], offset: int = 0, axis1: int = 0, axis2: int = 1) PolyArray[Dim1]
diagonal(self: PolyArray[Dim3], offset: int = 0, axis1: int = 0, axis2: int = 1) PolyArray[Dim2]
diagonal(self: PolyArray[Dim4], offset: int = 0, axis1: int = 0, axis2: int = 1) PolyArray[Dim3]

Return a diagonal extracted from the array. diagonal diagonal diagonal

Take the diagonal along axis1 and axis2 with optional offset. Unlike NumPy, return a copy.

Overload 1.

Args:
  • self (amplify.PolyArray[Dim]): self

  • offset (int): Offset of the diagonal. Defaults to 0. Defaults to 0.

  • axis1 (int): First axis. Defaults to 0. Defaults to 0.

  • axis2 (int): Second axis. Defaults to 1. Defaults to 1.

Returns:

amplify.PolyArray[Dim]: Diagonal extracted along the specified axes.

Raises:

ValueError: If axes are out of bounds or identical.

Overload 2.

Args:
  • self (amplify.PolyArray[Dim2]): self

  • offset (int): Offset of the diagonal. Defaults to 0. Defaults to 0.

  • axis1 (int): First axis. Defaults to 0. Defaults to 0.

  • axis2 (int): Second axis. Defaults to 1. Defaults to 1.

Returns:

amplify.PolyArray[Dim1]: Diagonal extracted along the specified axes.

Raises:

ValueError: If axes are out of bounds or identical.

Overload 3.

Args:
  • self (amplify.PolyArray[Dim3]): self

  • offset (int): Offset of the diagonal. Defaults to 0. Defaults to 0.

  • axis1 (int): First axis. Defaults to 0. Defaults to 0.

  • axis2 (int): Second axis. Defaults to 1. Defaults to 1.

Returns:

amplify.PolyArray[Dim2]: Diagonal extracted along the specified axes.

Raises:

ValueError: If axes are out of bounds or identical.

Overload 4.

Args:
  • self (amplify.PolyArray[Dim4]): self

  • offset (int): Offset of the diagonal. Defaults to 0. Defaults to 0.

  • axis1 (int): First axis. Defaults to 0. Defaults to 0.

  • axis2 (int): Second axis. Defaults to 1. Defaults to 1.

Returns:

amplify.PolyArray[Dim3]: Diagonal extracted along the specified axes.

Raises:

ValueError: If axes are out of bounds or identical.

evaluate(self, values: Values) numpy.ndarray[dtype=float64]ΒΆ
evaluate(self, values: Values, default: float) numpy.ndarray[dtype=float64]
evaluate(self, values: Values, default: None) PolyArray[_Dim]

Evaluate each element by substituting variable values. evaluate evaluate

Pass optimization result values to get a NumPy array with the same shape. The behavior for unassigned variables can be controlled by default.

When default=None, keep variables not present in values symbolic and return a PolyArray.

Overload 1.

Args:
  • values (amplify.Values): Values from optimization results, such as result.best.values.

Returns:

numpy.ndarray: Evaluated numeric values with the same shape.

Overload 2.

Args:
  • values (amplify.Values): Values from optimization results, such as result.best.values.

  • default (float): The default numeric value used for variables not present in values.

Returns:

numpy.ndarray: Evaluated numeric values with the same shape.

Overload 3.

Args:
  • values (amplify.Values): Values from optimization results, such as result.best.values.

  • default (None): Set to None to keep unassigned variables symbolic.

Returns:

amplify.PolyArray[_Dim]: Array with substitutions applied.

fill(self, value: Poly | float | int) NoneΒΆ

Fill all elements with a single polynomial or scalar value.

Parameters:

value (Poly | float | int) – The value to assign to all elements.

flatten(self) PolyArray[Dim1]ΒΆ

Return a flattened 1D copy of the array.

Returns:

Flattened copy.

Return type:

PolyArray[Dim1]

nonzero(self) tuple[numpy.ndarray[dtype=uint64], ...]ΒΆ

Return the indices of non-zero elements.

Returns:

Tuple of index arrays, one for each dimension.

Return type:

tuple[ndarray[dtype=uint64], …]

ravel(self) PolyArray[Dim1]ΒΆ

Return a flattened 1D view when possible.

Returns:

Flattened view when possible.

Return type:

PolyArray[Dim1]

repeat(self, repeats: int | list[int], axis: Literal[None] = None) PolyArray[Dim1]ΒΆ
repeat(self, repeats: int | list[int], axis: int) PolyArray[_Dim]

Repeat elements of the array. repeat

When axis is None, repetitions are applied to the flattened array, and a 1D array is returned.

Overload 1.

Args:
  • repeats (int | list[int]): The number of repetitions for each element, or a list of repetitions.

  • axis (typing.Literal[None]): Axis along which to repeat. If None, the array is repeated as a flattened array. Defaults to None.

Returns:

amplify.PolyArray[Dim1]: Array with repeated elements.

Raises:

ValueError: If repeats contains negative values, axis is out of bounds, or shapes are incompatible. TypeError: If repeats is not an integer or list of integers.

Overload 2.

Args:
  • repeats (int | list[int]): The number of repetitions for each element, or a list of repetitions.

  • axis (int): Axis along which to repeat. If None, the array is repeated as a flattened array.

Returns:

amplify.PolyArray[_Dim]: Array with repeated elements.

Raises:

ValueError: If repeats contains negative values, axis is out of bounds, or shapes are incompatible. TypeError: If repeats is not an integer or list of integers.

reshape(self, shape: int | tuple[int]) PolyArray[Dim1]ΒΆ
reshape(self, shape: tuple[int, int]) PolyArray[Dim2]
reshape(self, shape: tuple[int, int, int]) PolyArray[Dim3]
reshape(self, shape: tuple[int, int, int, int]) PolyArray[Dim4]
reshape(self, arg0: int, arg1: int) PolyArray[Dim2]
reshape(self, arg0: int, arg1: int, arg2: int) PolyArray[Dim3]
reshape(self, arg0: int, arg1: int, arg2: int, arg3: int) PolyArray[Dim4]
reshape(self, shape: tuple[int, int, int, int, int, *tuple[int, ...]]) PolyArray[Dim]
reshape(self, *shape: int) PolyArray[Dim]

Return a reshaped view of the array. reshape reshape reshape reshape reshape reshape reshape reshape

The new shape must be compatible with the current size. At most one -1 is allowed to infer an unknown dimension.

Overload 1.

Args:
  • shape (int | tuple[int]): The new shape specified as a tuple.

Returns:

amplify.PolyArray[Dim1]: Reshaped array.

Raises:

ValueError: If shape is incompatible with current size. TypeError: If shape is not int/tuple of ints.

Overload 2.

Args:
  • shape (tuple[int, int]): The new shape specified as a tuple.

Returns:

amplify.PolyArray[Dim2]: Reshaped array.

Raises:

ValueError: If shape is incompatible with current size. TypeError: If shape is not int/tuple of ints.

Overload 3.

Args:
  • shape (tuple[int, int, int]): The new shape specified as a tuple.

Returns:

amplify.PolyArray[Dim3]: Reshaped array.

Raises:

ValueError: If shape is incompatible with current size. TypeError: If shape is not int/tuple of ints.

Overload 4.

Args:
  • shape (tuple[int, int, int, int]): The new shape specified as a tuple.

Returns:

amplify.PolyArray[Dim4]: Reshaped array.

Raises:

ValueError: If shape is incompatible with current size. TypeError: If shape is not int/tuple of ints.

Overload 5.

Args:
  • arg0 (int): First dimension of the new shape.

  • arg1 (int): Second dimension of the new shape.

Returns:

amplify.PolyArray[Dim2]: Reshaped array.

Raises:

ValueError: If shape is incompatible with current size. TypeError: If shape is not int/tuple of ints.

Overload 6.

Args:
  • arg0 (int): First dimension of the new shape.

  • arg1 (int): Second dimension of the new shape.

  • arg2 (int): Third dimension of the new shape.

Returns:

amplify.PolyArray[Dim3]: Reshaped array.

Raises:

ValueError: If shape is incompatible with current size. TypeError: If shape is not int/tuple of ints.

Overload 7.

Args:
  • arg0 (int): First dimension of the new shape.

  • arg1 (int): Second dimension of the new shape.

  • arg2 (int): Third dimension of the new shape.

  • arg3 (int): Fourth dimension of the new shape.

Returns:

amplify.PolyArray[Dim4]: Reshaped array.

Raises:

ValueError: If shape is incompatible with current size. TypeError: If shape is not int/tuple of ints.

Overload 8.

Args:
  • shape (tuple[int, int, int, int, int, *tuple[int, …]]): The new shape specified as a tuple.

Returns:

amplify.PolyArray[Dim]: Reshaped array.

Raises:

ValueError: If shape is incompatible with current size. TypeError: If shape is not int/tuple of ints.

Overload 9.

Args:
  • *shape (int): The new shape specified as a tuple.

Returns:

amplify.PolyArray[Dim]: Reshaped array.

Raises:

ValueError: If shape is incompatible with current size. TypeError: If shape is not int/tuple of ints.

roll(self, shift: int, axis: int | None = None) PolyArray[_Dim]ΒΆ

Roll array elements along an axis.

If axis is None, the array is rolled in flattened order. Unlike NumPy, roll is provided as a method, and cannot roll multiple axes simultaneously.

Parameters:
  • shift (int) – The shift amount.

  • axis (int | None) – Axis to roll. If None, the array is rolled as a flattened array. Defaults to None.

Returns:

Array with rolled elements.

Return type:

PolyArray[_Dim]

Raises:

ValueError – If axis is out of bounds.

substitute(
self,
mapping: Mapping[Poly, Poly | float | int] | Mapping[Variable, Poly | float | int],
) PolyArray[_Dim]ΒΆ

Substitute variables in all elements of the array.

Parameters:

mapping (Mapping[Poly, Poly | float | int] | Mapping[Variable, Poly | float | int]) – A mapping from variables to numeric values or polynomials.

Returns:

Array after substitution.

Return type:

PolyArray[_Dim]

sum(self, axis: Literal[None] = None) PolyΒΆ
sum(self: PolyArray[Dim1], axis: int | tuple[int]) Poly
sum(self: PolyArray[Dim2], axis: tuple[int, int]) Poly
sum(self: PolyArray[Dim2], axis: int | tuple[int]) PolyArray[Dim1]
sum(self: PolyArray[Dim3], axis: tuple[int, int, int]) Poly
sum(self: PolyArray[Dim3], axis: tuple[int, int]) PolyArray[Dim1]
sum(self: PolyArray[Dim3], axis: int | tuple[int]) PolyArray[Dim2]
sum(self: PolyArray[Dim4], axis: tuple[int, int, int, int]) Poly
sum(self: PolyArray[Dim4], axis: tuple[int, int, int]) PolyArray[Dim1]
sum(self: PolyArray[Dim4], axis: tuple[int, int]) PolyArray[Dim2]
sum(self: PolyArray[Dim4], axis: int | tuple[int]) PolyArray[Dim3]
sum(self: PolyArray[_Dim], axis: tuple[()]) PolyArray[_Dim]
sum(self: PolyArray[Dim], axis: int | tuple[int, ...]) Poly | PolyArray[Dim]

Sum array elements over the specified axis or axes. sum sum sum sum sum sum sum sum sum sum sum sum

Without axis, all elements are summed into a single polynomial. With axis, the output type depends on the reduced dimensions.

Overload 1.

Args:
  • axis (typing.Literal[None]): The axis or axes to reduce. Defaults to None.

Returns:

amplify.Poly: Summation result. Shape depends on axis.

Overload 2.

Args:
  • self (amplify.PolyArray[Dim1]): self

  • axis (int | tuple[int]): The axis or axes to reduce.

Returns:

amplify.Poly: Summation result. Shape depends on axis.

Overload 3.

Args:
  • self (amplify.PolyArray[Dim2]): self

  • axis (tuple[int, int]): The axis or axes to reduce.

Returns:

amplify.Poly: Summation result. Shape depends on axis.

Overload 4.

Args:
  • self (amplify.PolyArray[Dim2]): self

  • axis (int | tuple[int]): The axis or axes to reduce.

Returns:

amplify.PolyArray[Dim1]: Summation result. Shape depends on axis.

Overload 5.

Args:
  • self (amplify.PolyArray[Dim3]): self

  • axis (tuple[int, int, int]): The axis or axes to reduce.

Returns:

amplify.Poly: Summation result. Shape depends on axis.

Overload 6.

Args:
  • self (amplify.PolyArray[Dim3]): self

  • axis (tuple[int, int]): The axis or axes to reduce.

Returns:

amplify.PolyArray[Dim1]: Summation result. Shape depends on axis.

Overload 7.

Args:
  • self (amplify.PolyArray[Dim3]): self

  • axis (int | tuple[int]): The axis or axes to reduce.

Returns:

amplify.PolyArray[Dim2]: Summation result. Shape depends on axis.

Overload 8.

Args:
  • self (amplify.PolyArray[Dim4]): self

  • axis (tuple[int, int, int, int]): The axis or axes to reduce.

Returns:

amplify.Poly: Summation result. Shape depends on axis.

Overload 9.

Args:
  • self (amplify.PolyArray[Dim4]): self

  • axis (tuple[int, int, int]): The axis or axes to reduce.

Returns:

amplify.PolyArray[Dim1]: Summation result. Shape depends on axis.

Overload 10.

Args:
  • self (amplify.PolyArray[Dim4]): self

  • axis (tuple[int, int]): The axis or axes to reduce.

Returns:

amplify.PolyArray[Dim2]: Summation result. Shape depends on axis.

Overload 11.

Args:
  • self (amplify.PolyArray[Dim4]): self

  • axis (int | tuple[int]): The axis or axes to reduce.

Returns:

amplify.PolyArray[Dim3]: Summation result. Shape depends on axis.

Overload 12.

Args:
  • self (amplify.PolyArray[_Dim]): self

  • axis (tuple[()]): The axis or axes to reduce.

Returns:

amplify.PolyArray[_Dim]: Summation result. Shape depends on axis.

Overload 13.

Args:
  • self (amplify.PolyArray[Dim]): self

  • axis (int | tuple[int, …]): The axis or axes to reduce.

Returns:

Poly | PolyArray[Dim]: Summation result. Shape depends on axis.

swapaxes(self, axis1: int, axis2: int) PolyArray[_Dim]ΒΆ

Return a view with two axes swapped.

Parameters:
  • axis1 (int) – The first axis.

  • axis2 (int) – The second axis.

Returns:

Array with the two axes swapped.

Return type:

PolyArray[_Dim]

Raises:

ValueError – If either axis is out of bounds.

take(self, indices: int, axis: Literal[None] = None) PolyΒΆ
take(self, indices: list[int], axis: Literal[None] = None) PolyArray[Dim1]
take(self: PolyArray[Dim], indices: int | list[int], axis: int | None = None) PolyArray[Dim]
take(self: PolyArray[Dim2], indices: int, axis: int) PolyArray[Dim1]
take(self: PolyArray[Dim2], indices: list[int], axis: int) PolyArray[Dim2]
take(self: PolyArray[Dim3], indices: int, axis: int) PolyArray[Dim2]
take(self: PolyArray[Dim3], indices: list[int], axis: int) PolyArray[Dim3]
take(self: PolyArray[Dim4], indices: int, axis: int) PolyArray[Dim3]
take(self: PolyArray[Dim4], indices: list[int], axis: int) PolyArray[Dim4]

Take elements from the array along an axis. take take take take take take take take

If axis is None, indices are interpreted on the flattened array. Elements are always copied, even when a view could be returned.

Overload 1.

Args:
  • indices (int): A single index or a list of indices.

  • axis (typing.Literal[None]): Axis to take from. If None, flattened indexing is used. Defaults to None.

Returns:

amplify.Poly: Selected elements. Shape depends on indices and axis.

Raises:

IndexError: If any index is out of bounds. ValueError: If axis is out of bounds. TypeError: If indices is not int or list of ints.

Overload 2.

Args:
  • indices (list[int]): A single index or a list of indices.

  • axis (typing.Literal[None]): Axis to take from. If None, flattened indexing is used. Defaults to None.

Returns:

amplify.PolyArray[Dim1]: Selected elements. Shape depends on indices and axis.

Raises:

IndexError: If any index is out of bounds. ValueError: If axis is out of bounds. TypeError: If indices is not int or list of ints.

Overload 3.

Args:
  • self (amplify.PolyArray[Dim]): self

  • indices (int | list[int]): A single index or a list of indices.

  • axis (int | None): Axis to take from. If None, flattened indexing is used. Defaults to None.

Returns:

amplify.PolyArray[Dim]: Selected elements. Shape depends on indices and axis.

Raises:

IndexError: If any index is out of bounds. ValueError: If axis is out of bounds. TypeError: If indices is not int or list of ints.

Overload 4.

Args:
  • self (amplify.PolyArray[Dim2]): self

  • indices (int): A single index or a list of indices.

  • axis (int): Axis to take from. If None, flattened indexing is used.

Returns:

amplify.PolyArray[Dim1]: Selected elements. Shape depends on indices and axis.

Raises:

IndexError: If any index is out of bounds. ValueError: If axis is out of bounds. TypeError: If indices is not int or list of ints.

Overload 5.

Args:
  • self (amplify.PolyArray[Dim2]): self

  • indices (list[int]): A single index or a list of indices.

  • axis (int): Axis to take from. If None, flattened indexing is used.

Returns:

amplify.PolyArray[Dim2]: Selected elements. Shape depends on indices and axis.

Raises:

IndexError: If any index is out of bounds. ValueError: If axis is out of bounds. TypeError: If indices is not int or list of ints.

Overload 6.

Args:
  • self (amplify.PolyArray[Dim3]): self

  • indices (int): A single index or a list of indices.

  • axis (int): Axis to take from. If None, flattened indexing is used.

Returns:

amplify.PolyArray[Dim2]: Selected elements. Shape depends on indices and axis.

Raises:

IndexError: If any index is out of bounds. ValueError: If axis is out of bounds. TypeError: If indices is not int or list of ints.

Overload 7.

Args:
  • self (amplify.PolyArray[Dim3]): self

  • indices (list[int]): A single index or a list of indices.

  • axis (int): Axis to take from. If None, flattened indexing is used.

Returns:

amplify.PolyArray[Dim3]: Selected elements. Shape depends on indices and axis.

Raises:

IndexError: If any index is out of bounds. ValueError: If axis is out of bounds. TypeError: If indices is not int or list of ints.

Overload 8.

Args:
  • self (amplify.PolyArray[Dim4]): self

  • indices (int): A single index or a list of indices.

  • axis (int): Axis to take from. If None, flattened indexing is used.

Returns:

amplify.PolyArray[Dim3]: Selected elements. Shape depends on indices and axis.

Raises:

IndexError: If any index is out of bounds. ValueError: If axis is out of bounds. TypeError: If indices is not int or list of ints.

Overload 9.

Args:
  • self (amplify.PolyArray[Dim4]): self

  • indices (list[int]): A single index or a list of indices.

  • axis (int): Axis to take from. If None, flattened indexing is used.

Returns:

amplify.PolyArray[Dim4]: Selected elements. Shape depends on indices and axis.

Raises:

IndexError: If any index is out of bounds. ValueError: If axis is out of bounds. TypeError: If indices is not int or list of ints.

to_list(self: PolyArray[Dim0]) PolyΒΆ
to_list(self: PolyArray[Dim1]) list[Poly]
to_list(self: PolyArray[Dim2]) list[list[Poly]]
to_list(self: PolyArray[Dim3]) list[list[list[Poly]]]
to_list(self: PolyArray[Dim4]) list[list[list[list[Poly]]]]
to_list(self: PolyArray[Dim]) list

Convert the polynomial array to nested Python lists. to_list to_list to_list to_list to_list

For 0D arrays, return the scalar polynomial itself.

Overload 1.

Args:
  • self (amplify.PolyArray[Dim0])

Returns:

amplify.Poly: Nested representation of elements, or the scalar polynomial itself for 0D arrays.

Overload 2.

Args:
  • self (amplify.PolyArray[Dim1])

Returns:

list[amplify.Poly]: Nested representation of elements, or the scalar polynomial itself for 0D arrays.

Overload 3.

Args:
  • self (amplify.PolyArray[Dim2])

Returns:

list[list[amplify.Poly]]: Nested representation of elements, or the scalar polynomial itself for 0D arrays.

Overload 4.

Args:
  • self (amplify.PolyArray[Dim3])

Returns:

list[list[list[amplify.Poly]]]: Nested representation of elements, or the scalar polynomial itself for 0D arrays.

Overload 5.

Args:
  • self (amplify.PolyArray[Dim4])

Returns:

list[list[list[list[amplify.Poly]]]]: Nested representation of elements, or the scalar polynomial itself for 0D arrays.

Overload 6.

Args:
  • self (amplify.PolyArray[Dim])

Returns:

list: Nested representation of elements, or the scalar polynomial itself for 0D arrays.

to_numpy(self) numpy.ndarray[dtype=float64]ΒΆ

Convert the polynomial array to a NumPy float64 ndarray.

Returns:

Converted NumPy array.

Return type:

ndarray

tolist(self: PolyArray[Dim0]) PolyΒΆ
tolist(self: PolyArray[Dim1]) list[Poly]
tolist(self: PolyArray[Dim2]) list[list[Poly]]
tolist(self: PolyArray[Dim3]) list[list[list[Poly]]]
tolist(self: PolyArray[Dim4]) list[list[list[list[Poly]]]]
tolist(self: PolyArray[Dim]) list

Alias of to_list(). tolist tolist tolist tolist tolist

Overload 1.

Args:
  • self (amplify.PolyArray[Dim0])

Returns:

amplify.Poly: Nested representation of elements, or the scalar polynomial itself for 0D arrays.

Overload 2.

Args:
  • self (amplify.PolyArray[Dim1])

Returns:

list[amplify.Poly]: Nested representation of elements, or the scalar polynomial itself for 0D arrays.

Overload 3.

Args:
  • self (amplify.PolyArray[Dim2])

Returns:

list[list[amplify.Poly]]: Nested representation of elements, or the scalar polynomial itself for 0D arrays.

Overload 4.

Args:
  • self (amplify.PolyArray[Dim3])

Returns:

list[list[list[amplify.Poly]]]: Nested representation of elements, or the scalar polynomial itself for 0D arrays.

Overload 5.

Args:
  • self (amplify.PolyArray[Dim4])

Returns:

list[list[list[list[amplify.Poly]]]]: Nested representation of elements, or the scalar polynomial itself for 0D arrays.

Overload 6.

Args:
  • self (amplify.PolyArray[Dim])

Returns:

list: Nested representation of elements, or the scalar polynomial itself for 0D arrays.

tonumpy(self) numpy.ndarray[dtype=float64]ΒΆ

Alias of to_numpy().

Returns:

Converted NumPy array.

Return type:

ndarray

transpose(self, axes: tuple[int, ...] | None = None) PolyArray[_Dim]ΒΆ
transpose(self, *axes: int) PolyArray[_Dim]

Permute axes and return a transposed view. transpose

If axes is not specified, the axis order is reversed. Negative axes are supported and are normalized using the array dimension.

Overload 1.

Args:
  • axes (tuple[int, …] | None): Axis permutation. If None, the axis order is reversed. Defaults to None.

Returns:

amplify.PolyArray[_Dim]: Array with permuted axes.

Raises:

ValueError: If any axis is out of bounds or permutation is invalid. TypeError: If axes is not a tuple of integers.

Overload 2.

Args:
  • *axes (int): Axis permutation specified as positional arguments.

Returns:

amplify.PolyArray[_Dim]: Array with permuted axes.

Raises:

ValueError: If any axis is out of bounds or permutation is invalid. TypeError: If axes is not a tuple of integers.

view(self) PolyArray[_Dim]ΒΆ

Return a view of the same underlying data.

Returns:

View of the same underlying data.

Return type:

PolyArray[_Dim]

property TΒΆ

A transposed view of the array.

Equivalent to transpose() with default axis order.

Return type:

PolyArray[_Dim]

__nb_signature__ = 'class PolyArray(typing.Generic[_Dim])'ΒΆ
property flatΒΆ

A 1D view of the array.

Unlike flatten(), this property is a view.

Return type:

PolyArray[Dim1]

property ndimΒΆ

The number of dimensions of the array.

Return type:

int

property shapeΒΆ

The shape of the array.

Read this property to get the current shape as a tuple. Set this property to reshape the array in-place if the requested shape is compatible with the current size.

Return type:

tuple[int, …]

property sizeΒΆ

The total number of elements in the array.

Return type:

int