tensor_space

odl.tensor_space(shape, dtype='float64', impl='numpy', device='cpu', **kwargs)

Return a tensor space with arbitrary scalar data type.

Parameters

shapepositive int or sequence of positive ints

Number of entries per axis for elements in this space. A single integer results in a space with 1 axis.

dtype (str)optional

Data type of each element. Defaults to float64

implstr, optional

Impmlementation back-end for the space. See tensor_space_impl_names for available options.

kwargs :

Extra keyword arguments passed to the space constructor.

Returns

space : TensorSpace

Examples

Space of 3-tuples with uint64 entries (although not strictly a vector space):

>>> odl.tensor_space(3, dtype='uint64')
tensor_space(3, 'uint64')

2x3 tensors with same data type:

>>> odl.tensor_space((2, 3), dtype='uint64')
tensor_space((2, 3), 'uint64')

The default data type is 'float64'. How that is represented as a dtype-object depends on the backend.

>>> ts = odl.tensor_space((2, 3))
>>> ts
rn((2, 3))
>>> ts.dtype
dtype('float64')

See Also

rn, cn : Constructors for real and complex spaces