
| Member Functions | |
| RWGenMat<To>() |
template <class From, class To> class RWConvertGenMat;
Class RWConvertGenMat<From,To> converts between RWGenMats with different datatypes. It assumes that there is a conversion operator from
From to To.
#include <rw/math/genmat.h>
main()
{
// create a 2x2 matrix
RWGenMat<int> d("2x2[1 2 3 4]");
// convert int matrix d to DComplex
// matrix c with imag part 0
RWGenMat<DComplex> c = RWConvertGenMat<int,DComplex>(d);
// convert int matrix d to a double
// matrix and then call sin
function RWGenMat<double> s = RWConvertGenMat<int,double>(d);
s = sin(s);
}
RWConvertGenMat<From,To>(const RWGenMat<From>& M);
Constructs a new matrix of type RWGenMat<To> that can be used anywhere as a type RWGenMat<To>. Note that a temporary matrix is created every time this constructor is invoked, but the conversion operator below can be used repeatedly without creating additional temporary matrices.
operator RWGenMat<To>();
Automatic conversion operator that enables class RWConvertGenMat<From,To> to be used as an RWGenMat<To>. While the actual conversion takes place in the constructor, this operator provides a reference to that converted matrix.
©Copyright 1999, Rogue Wave Software, Inc.
Send mail to report errors or comment on the documentation.