Rogue Wave banner
Previous fileTop of DocumentContentsIndexNext file

9.2 Matrix Entry Helper Classes

The two matrix classes RWGenMat<double> and DoubleSymMat return a regular C++ reference to a double, that is, a double&. For other matrix types, this is not always possible. For example, an element in class BandMat outside the band is defined to be 0; therefore, it is illegal to use an element like an lvalue. In class SkewMat, the elements below the main diagonal are not stored explicitly, but calculated as the negative of the element diagonally across the main diagonal. If you access one of these elements, you can't simply return a reference since there is no double type in memory to access.

Obviously, for types other than GenMat and SymMat, something must be done besides returning a simple reference to a memory location. In these cases, operator()(int,int) returns an instance of a helper class. This class provides the indirection needed so that the subscripting operator works correctly on both the right and left sides of the equal sign. The helper class contains a reference to a double, information on how that reference is to be modified, and whether or not it can be used as an lvalue. There are several different helper classes for the various matrix types:


Previous fileTop of DocumentContentsIndexNext file

©Copyright 1999, Rogue Wave Software, Inc.
Contact Rogue Wave about documentation or support issues.