ProductSpaceElement.asarray

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

Extract the data of this vector as a numpy 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
outnumpy.ndarray, optional

Array in which the result should be written in-place. Has to be contiguous and of the correct 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.]])