Modifying the Iterator
The class allows the usage of it++
and it--
and the addition/subtraction of two BasisIterators instances:
-
BasisIterator<BasisU1> &danceq::internal::BasisIterator::operator++()
Incrementing of the iterator by one.
Function calls increment from the BasisU1. The last State is mapped to the first State.
auto it = basis.begin(); std::cout << "First element: " << *it << std::endl; ++it; std::cout << "Second element: " << *it << std::endl;
-
BasisIterator<BasisU1> &danceq::internal::BasisIterator::operator--()
Decrementing of the iterator by one.
Function calls decrement from the BasisU1. The first State is mapped to the last State.
auto it = basis.last(); std::cout << "Last element: " << *it << std::endl; --it; std::cout << "Penultimate element: " << *it << std::endl;
-
BasisIterator<BasisU1> danceq::internal::BasisIterator::operator+(const uint64_t index_) const
Adding an index to the BasisIterator.
Functions returns a BasisIterator pointing to the State, \(\vert\Psi_i\rangle\), with i = index (current index) + index_ (input index).
- Parameters:
index_ – Index to be added
- Returns:
BasisIterator pointing to i
-
BasisIterator<BasisU1> danceq::internal::BasisIterator::operator+(const BasisIterator<BasisU1> &basisiterator) const
Adding a BasisIterator to the BasisIterator.
Functions returns a BasisIterator pointing to the State, \(\vert\Psi_i\rangle\), with i = index (current index) + basisiterator.index (input index).
- Parameters:
basisiterator – BasisIterator to be added
- Returns:
BasisIterator pointing to i
-
BasisIterator<BasisU1> danceq::internal::BasisIterator::operator-(const uint64_t index_) const
Subtracting an index to the BasisIterator.
Functions returns a BasisIterator pointing to the State, \(\vert\Psi_i\rangle\), with i = index (current index) - index_ (input index).
- Parameters:
index_ – Index to be subtracted
- Returns:
BasisIterator pointing to i
-
BasisIterator<BasisU1> danceq::internal::BasisIterator::operator-(const BasisIterator<BasisU1> &basisiterator) const
Subtracting a BasisIterator to the BasisIterator.
Functions returns a BasisIterator pointing to the State, \(\vert\Psi_i\rangle\), with i = index (current index) - basisiterator.index (input index).
- Parameters:
basisiterator – BasisIterator to be subtracted
- Returns:
BasisIterator pointing to i
The BasisIterator can be set directly via:
-
int32_t danceq::internal::BasisIterator::set_index(uint64_t new_index)
Resets the BasisIterator.
- Parameters:
new_index – New index
- Returns:
error_code
-
int32_t danceq::internal::BasisIterator::set_state(typename BasisU1::state_class new_state)
Resets the BasisIterator.
- Parameters:
new_state – New state
- Returns:
error_code