Runtime Tensor Iterators#

This tensor iterator allows Python programs to iterate over the values of a tensor. In the same way that the RuntimeTensorX is defined, these iterators are defined here as PyTensorIteratorX, where X is either F for single-precision real values, D is for double-precision real values, C is for single-precision complex values, and Z is for double-precision complex values.

class einsums.core.PyTensorIteratorX#

Iterator for tensors and tensor views.

__next__()#

Get the next value in the tensor.

Returns:

The next value in the tensor.

Raises:

StopIteration – Raises this when there are no more values to give.

__iter__()#

Get the iterator for this object.

Returns:

Returns a copy of the object.

__reversed__()#

Get the reverse iterators starting from the current position.

Returns:

The reversed iterator.

reversed() bool#

Gives whether the iterator goes forward or backwards.

Returns:

True if the iterator is going in reverse, False if it is going forward.