PtMatrix Class

The PtMatrix base class is derived from the Message class so the programmer can work with matrices using Envelope class and message-handling system.

However, the MessageParticle class is not used by the PtMatrix class. Instead, there are special MatrixEnvParticle classes defined to handle the type checking between the various types of matrices. This allows the system to automatically detect incorrect connections between two primitives with different matrix type inputs and outputs. Also, the MatrixEnvParticle class has some special functions not found in the standard MessageParticle class to allow easier handling of PtMatrix class messages. A discussion of how to pass PtMatrix class objects using the MatrixEnvParticle can be found later in this documentation.

There are currently four data-specific matrix classes: ComplexMatrix, FixMatrix, FloatMatrix, and IntMatrix. Each of these classes stores its entries in a standard C array named data, which is an array of data objects corresponding to the PtMatrix type: Complex, Fix, double, or int. These four matrix classes implement a common set of operators and functions. In addition, the ComplexMatrix class has a few special methods such as conjugate() and hermitian() and the FixMatrix class has a number of special constructors that allow the programmer to specify the precision of the entries in the matrix. As a rule, all entries of a FixMatrix will have the same precision.

The matrix classes were designed to take full advantage of operator overloading in C++. The result is that matrix objects can be written much like operations on scalar ones. For example, the two-operand multiply operator * has been defined so that if A and B are matrices, A*B will return a third matrix that is the matrix product of A and B.