File ITensorItr.hpp¶
↰ Parent directory (DlSystem)
Contents
Definition (DlSystem/ITensorItr.hpp)¶
Includes¶
ITensorItrImpl.hpp(File ITensorItrImpl.hpp)algorithmiteratortype_traits
Included By¶
Classes¶
Typedefs¶
Full File Listing¶
-
namespace DlSystem
Functions
-
void fill(ITensorItr<false> first, ITensorItr<false> end, float val)¶
-
template<bool IS_CONST = true>
class ITensorItr¶ - #include <ITensorItr.hpp>
A bidirectional iterator (with limited random access capabilities) for the zdl::DlSystem::ITensor class.
This is a standard bidrectional iterator and is compatible with standard algorithm functions that operate on bidirectional access iterators (e.g., std::copy, std::fill, etc.). It uses a template parameter to create const and non-const iterators from the same code. Iterators are easiest to declare via the typedefs iterator and const_iterator in the ITensor class (e.g., zdl::DlSystem::ITensor::iterator).
Note that if the tensor the iterator is traversing was created with nondefault (i.e., nontrivial) strides, the iterator will obey the strides when traversing the tensor data.
Also note that nontrivial strides dramatically affect the performance of the iterator (on the order of 20x slower).
Public Types
-
using iterator_category = std::bidirectional_iterator_tag¶
-
using value_type = float¶
-
using difference_type = std::ptrdiff_t¶
Public Functions
-
ITensorItr() = delete¶
-
virtual ~ITensorItr() = default¶
-
explicit ITensorItr(pointer data) noexcept¶
Constructor of ITensorItr class.
- Parameters
data – [in] is pointer to data
-
ITensorItr(std::unique_ptr<ITensorItrImpl> impl, bool isTrivial = false, float *data = nullptr)¶
Constructor of ITensorItr class using member variables.
- Parameters
impl – [in] is Pointer to ITensorItrImpl
isTrivial – [in] is set to false by default
data – [in] is pointer to data
-
ITensorItr(const ITensorItr &itr)¶
Constructor of ITensorItr class using another object.
- Parameters
itr – [in] is reference to another object
-
ITensorItr(ITensorItr &&itr) noexcept¶
Constructor of ITensorItr class using move constructor.
- Parameters
itr – [in] is reference to another object
-
ITensorItr &operator=(const ITensorItr &other)¶
Constructor of ITensorItr class using assignment operator.
- Parameters
other – [in] is reference to another object
-
ITensorItr &operator=(ITensorItr &&other) noexcept¶
Constructor of ITensorItr class using assignment operator.
- Parameters
other – [in] is reference to another object
-
ITensorItr &operator++()¶
Overloading increment operator to parse through data.
-
ITensorItr operator++(int)¶
Overloading increment operator to parse through data.
- Parameters
int – [in] is unused
-
ITensorItr &operator--()¶
Overloading decrement operator to parse through data.
-
ITensorItr operator--(int)¶
Overloading decrement operator to parse through data.
- Parameters
int – [in] is unused
-
ITensorItr &operator+=(int rhs)¶
Overloading addition operator to parse through data.
- Parameters
Moves – [in] forward the data pointer by rhs elements
-
ITensorItr &operator-=(int rhs)¶
Overloading subtraction operator to parse through data.
- Parameters
Moves – [in] back the data pointer of the object by rhs elements
-
size_t operator-(const ITensorItr &rhs)¶
Overloading subtartion operator to get the offset between two objects.
- Parameters
rhs – [in] is reference to the object
- Returns
Offset between the two objects
-
bool operator==(const ITensorItr &rhs) const¶
Overloading == operator to work with ITensorItr objects.
- Parameters
lhs – [in] is reference to the first object
rhs – [in] is reference to the second object
- Returns
True if data pointer of first object equals the data pointer of second object, else false
-
bool operator!=(const ITensorItr &rhs) const¶
Overloading != operator to work with ITensorItr objects.
- Parameters
lhs – [in] is reference to the first object
rhs – [in] is reference to the second object
- Returns
True if data pointer of first object is not equal to the data pointer of second object, else false
-
reference operator[](size_t idx)¶
Overloading [] operator to work with ITensorItr objects.
- Parameters
idx – [in] is index of the data
- Returns
Data at idx index
-
reference operator*()¶
Overloading derefencing operator to work with ITensorItr objects.
- Returns
Data at 0th index
-
reference operator->()¶
Overloading -> operator to work with ITensorItr objects.
- Returns
reference of object
Friends
-
friend ITensorItr operator+(ITensorItr lhs, int rhs)¶
Overloading addition operator to parse through data.
- Parameters
lhs – [in] is reference to the object
Moves – [in] forward the data pointer of the object by rhs elements
-
friend ITensorItr operator-(ITensorItr lhs, int rhs)¶
Overloading subtraction operator to parse through data.
- Parameters
lhs – [in] is reference to the object
Moves – [in] back the data pointer of the object by rhs elements
-
friend bool operator<(const ITensorItr &lhs, const ITensorItr &rhs)¶
Overloading < operator to work with ITensorItr objects.
- Parameters
lhs – [in] is reference to the first object
rhs – [in] is reference to the second object
- Returns
True if data pointer of first object is lesser than the second object, else false
-
friend bool operator>(const ITensorItr &lhs, const ITensorItr &rhs)¶
Overloading < operator to work with ITensorItr objects.
- Parameters
lhs – [in] is reference to the first object
rhs – [in] is reference to the second object
- Returns
True if data pointer of first object is greater than the second object, else false
-
friend bool operator<=(const ITensorItr &lhs, const ITensorItr &rhs)¶
Overloading <= operator to work with ITensorItr objects.
- Parameters
lhs – [in] is reference to the first object
rhs – [in] is reference to the second object
- Returns
True if data pointer of first object is <= data pointer of second object, else false
-
friend bool operator>=(const ITensorItr &lhs, const ITensorItr &rhs)¶
Overloading >= operator to work with ITensorItr objects.
- Parameters
lhs – [in] is reference to the first object
rhs – [in] is reference to the second object
- Returns
True if data pointer of first object is >= data pointer of second object, else false
-
using iterator_category = std::bidirectional_iterator_tag¶
-
void fill(ITensorItr<false> first, ITensorItr<false> end, float val)¶
-
namespace zdl
-
namespace DlSystem
Typedefs
-
template<bool IS_CONST>
using ITensorItr = ::DlSystem::ITensorItr<IS_CONST>¶
-
template<bool IS_CONST>
-
namespace DlSystem