#include <quantum.h>
Collaboration diagram for TensorProductIndex:
Public Member Functions | |
TensorProductIndex (const TensorProductStructure &iTPS) | |
Constructor: constructs an index (initialized to zero) that will iterate over iTPS or an isomorphic TensorProductStructure. | |
TensorProductIndex (const TensorProductIndex &other) | |
Copy constructor: constructs an index that is an exact copy of other , and will iterate over an isomorphic TensorProductStructure. | |
~TensorProductIndex () | |
Destructor: de-allocates the private arrays that hold data. | |
bool | Valid () const |
Returns true if and only if the index has not overflowed. | |
operator itype () const | |
Converts the TensorProductIndex to a flat index. | |
operator int () const | |
Converts the TensorProductIndex to a flat index. | |
itype | operator[] (itype i) const |
Returns the current value of the i 'th component of the multi-index. | |
itype * | Indices () const |
Returns a array of the current multi-index values. | |
void | SetIndex (itype i, itype val) |
Set the value of one component of the multi-index (resets the flat index). | |
TensorProductIndex & | SetIndices (itype *new_indices) |
Set the value of the entire multi-index (resets the flat index). | |
itype | Limit () const |
Return the upper limit to the flat index (lower limit is always zero). | |
itype | Limit (itype i) const |
Return the upper limit to the i 'th component of the multi-index. | |
itype | Dimensions () const |
Return the total number of subsystems. | |
TensorProductIndex & | operator= (itype new_index) |
Set the value of the flat index (resets the multi-index). | |
TensorProductIndex & | Begin () |
Set the index to zero. | |
TensorProductIndex & | operator++ () |
Increment the index by one. Increments both multi- and flat indices; does skipping transparently if appropriate. | |
void | operator++ (int) |
Increment the index by one. Increments both multi- and flat indices; does skipping transparently if appropriate. | |
TensorProductIndex & | operator-- () |
Decrement the index by one. Decrements both multi- and flat indices. Does not do skipping! | |
void | operator-- (int) |
Decrement the index by one. Decrements both multi- and flat indices. Does not do skipping! | |
void | ConfigureSkipping (const ProductOperator &M, const TensorProductIndex &row, double err=1e-14) |
Highly specialized function to configure ``skipping'' prior to iterating over a ProductOperator. |
A TensorProductIndex is intended for iterating over the elements of a vector space endowed with a TensorProductStructure. If there is no need to correlate elements with their multi-indices, then this can be done by simply iterating over the flat index. TensorProductIndex is used when it is necessary to pay attention to the multi-index. In particular, TensorProductIndex can be configured to automatically skip certain indices -- i.e, the index for certain subsystems is fixed, and only the free ones will be iterated over. The functionality of a TensorProductIndex is much like that provided by a multidimensional array class.
|
Highly specialized function to configure ``skipping'' prior to iterating over a ProductOperator. Skipping is intended to speed up iterating over a tensor product structure when the object being iterated over is sparse. If an object (either a product vector or a product matrix) has a tensor factor with a zero, then many elements of the object will automatically be zero. As the TensorProductIndex iterates over the object, every time the index corresponding to the factor with a zero reaches the zero value, that value can be skipped over for summation.
The SkippingArray array, when properly configured, identifies all the values of indices that can be skipped this way. ConfigureSkipping() examines one row of a ProductOperator, finds the zeroes (to within the adjustable parameter |