An Introduction to Numerical Methods in C++, Revised Edition

Many computations involve the solution of linear equations in several, perhaps many, variables, or can be transformed and approximated so as to do so. In this chapter we develop appropriate concepts for the solution of problems in linear algebra, especially the systematic definition of the classes vector and matrix. We shall regard a vector as a pointer to an array of floating point numbers, and a matrix as a pointer to an array of vectors. We shall be building directly on the work of chapter 5. We first define the class vector, then the class matrix. The chapter ends with a simple application to linear algebra.
As in the class string ( cf 5.2), we shall take the data members of the class vector to be a pointer to an array and the length of that array. We shall also need appropriate constructors as public members, and a destructor; the constructors should be able to create an initialized vector of given length, a vector converted from a given array, and a vector that is a copy of a given vector. To deal with these aspects first, we write:
class vector {private: int size; double *vec; ........public: vector (int); vector (const double*, int); vector (const vector&); ...