Constructors and Destructors

There are three constructors for VMatrices. The default constructor takes a void argument. Note that since a VMatrix is a sub-class of a vdoub, the vdoub constructor is called first. The extra VMatrix elements are supplied next. The default constructor sets the name to 't', and allocates a 1x1 matrix.

The second form of the constructor is given in the code below:

VMatrix::VMatrix( const char *str, int rr, int cc):
    vdoub( ((long )((long) rr)*((long) cc)) )
  {
    r=rr;
    c=cc;
    curvecind = 0;
    Nameit( str );
    signature = SIGNATURE;
  }
The second line of this constructor calls the vdoub constructor with a default vector length of rr*cc. The casts avoid type promotion problems. The constructor sets the name to the supplied string.

The third constructor is a copy constructor. This allows statements like VMatrix c = b; to be used. This creates the new matrix c, and then copies b into it. The assignment may also be a function call, or repeated operations. Matrix pointers can also be created by functions such as VMatrix *Mat = new VMatrix;. Note that the copy constructor calls cleanstack(), so the stack is cleared after the constructor is called. Thus, you must use Dispatch->Inclevel() and Dispatch->Declevel() pairs in functions that call the copy constructor.

The destructor first calls the destructor for the vdoub, returns, and sets the signature to zero.