lucid  0.0.1
Lifting-based Uncertain Control Invariant Dynamics
Loading...
Searching...
No Matches
lucid::TensorIterator< T > Class Template Reference

Utility class to iterate over all elements of a tensor. More...

#include <TensorIterator.h>

Public Member Functions

 TensorIterator (const TensorView< T > &tensor, bool end=false)
 Construct a new TensorIterator object.
 
const std::vector< Index > & indexes () const
 Get read-only access to the indexes of the tensor.
 
const IndexIterator< std::vector< Index > > & index_iterator () const
 Get read-only access to the index iterator of the tensor.
 

Private Attributes

IndexIterator< std::vector< Index > > indexes_
 Iterator used to go through all elements of the tensor.
 
const TensorView< T > & tensor_
 Tensor to iterate over.
 

Detailed Description

template<IsAnyOf< int, float, double, std::complex< double > > T>
class lucid::TensorIterator< T >

Utility class to iterate over all elements of a tensor.

They will be visited in order, avoiding the need to use nested loops and hiding the memory layout and strides.

Template Parameters
Ttype of the elements in the tensor

Constructor & Destructor Documentation

◆ TensorIterator()

template<IsAnyOf< int, float, double, std::complex< double > > T>
lucid::TensorIterator< T >::TensorIterator ( const TensorView< T > & tensor,
bool end = false )
explicit

Construct a new TensorIterator object.

Parameters
tensortensor to iterate over
endif true, the iterator will be exhausted immediately, indicating that there is nothing else to iterate

Member Function Documentation

◆ index_iterator()

template<IsAnyOf< int, float, double, std::complex< double > > T>
const IndexIterator< std::vector< Index > > & lucid::TensorIterator< T >::index_iterator ( ) const
inlinenodiscard

Get read-only access to the index iterator of the tensor.

Returns
index iterator of the tensor

◆ indexes()

template<IsAnyOf< int, float, double, std::complex< double > > T>
const std::vector< Index > & lucid::TensorIterator< T >::indexes ( ) const
inlinenodiscard

Get read-only access to the indexes of the tensor.

Returns
indexes of the tensor

The documentation for this class was generated from the following files: