farray

class minkit.farray(array, dtype, ndim=1, length=None, backend=None)[source]

Bases: minkit.marray

Array of floats.

Parameters:

Attributes Summary

aop Associated object to do array operations.
backend Backend interface.
dtype Data type.
length Length as a numpy.int32 instance.
ndim Number of dimensions of the array.
shape Shape of the array.
size Size of the array.
ua Underlying array.

Methods Summary

as_ndarray() Return the underlying array as a numpy.ndarray instance.
astype(dtype) Convert the array into the given data type.
copy() Copy this array.
from_ndarray(a, backend) Create this class from a numpy.ndarray instance.
get(index) Get an element of the array.
to_backend(backend) Send the array to the given backend.

Attributes Documentation

aop

Associated object to do array operations.

backend

Backend interface.

dtype

Data type.

length

Length as a numpy.int32 instance.

ndim

Number of dimensions of the array.

shape

Shape of the array.

size

Size of the array.

ua

Underlying array.

Methods Documentation

as_ndarray()[source]

Return the underlying array as a numpy.ndarray instance. If the underlying array is already of this type, no copy is done.

Returns:underlying array as a numpy.ndarray.
Return type:numpy.ndarray
astype(dtype)[source]

Convert the array into the given data type. Only conversions from farray and carray objects are allowed.

Parameters:dtype (numpy.dtype) – data type.
Returns:Converted array.
Return type:farray or carray
Raises:ValueError – If the conversion is not allowed.
copy()[source]

Copy this array.

Returns:Copy of this array.
classmethod from_ndarray(a, backend)[source]

Create this class from a numpy.ndarray instance. If the number of dimensions is greater than one, the array is flattened, and each column is assumed to belong to a different parameter.

Parameters:
Returns:

Newly created array.

get(index)[source]

Get an element of the array. If the number of dimensions is greater than one, the output contains the value of each column in the array at the given index.

Parameters:index (int) – index to access.
Returns:value(s) at the given index.
Return type:numpy.ndarray
Raises:IndexError – If there is an attempt to access an element out of range.
to_backend(backend)[source]

Send the array to the given backend.

Parameters:backend (Backend) – backend where to transfer the array.
Returns:this array on a new backend.
Return type:marray