Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

TensorProductIndex Class Reference
[Objects with a TPS]

Defines an index for iterating over a tensor product structure. More...

#include <quantum.h>

Collaboration diagram for TensorProductIndex:

Collaboration graph
[legend]
List of all members.

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.
itypeIndices () 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).
TensorProductIndexSetIndices (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.
TensorProductIndexoperator= (itype new_index)
 Set the value of the flat index (resets the multi-index).
TensorProductIndexBegin ()
 Set the index to zero.
TensorProductIndexoperator++ ()
 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.
TensorProductIndexoperator-- ()
 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.

Detailed Description

Defines an index for iterating over a tensor product structure.

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.


Member Function Documentation

void TensorProductIndex::ConfigureSkipping const ProductOperator M,
const TensorProductIndex row,
double  err = 1e-14
[inline]
 

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 err), and sets SkippingArray appropriately. It also initializes FirstNonSkippableIndex to hold the lowest value of each index for which the row being examined is not zero, and if all entries are zero (which only requires all values of one index to yield zero), sets SkipEntirely to reflect this.


The documentation for this class was generated from the following files:
Generated on Wed Jun 14 22:25:29 2006 for linalg by  doxygen 1.4.4