ProductSpaceElement.asarray

ProductSpaceElement.asarray(out=None, must_be_contiguous=False)[source]

Extract the data of this vector as a backend-specific array.

Only available if is_power_space is True.

The ordering is such that it commutes with indexing:

self[ind].asarray() == self.asarray()[ind]

Parameters

outArraylike, optional

Array in which the result should be written in-place. Has to be contiguous and of the correct backend, dtype and shape.

Raises

ValueError

If is_power_space is false.

Examples

>>> spc = odl.ProductSpace(odl.rn(3), 2)
>>> x = spc.element([[ 1.,  2.,  3.],
...                  [ 4.,  5.,  6.]])
>>> x.asarray()
array([[ 1.,  2.,  3.],
       [ 4.,  5.,  6.]])