We can also use the vector class to build a matrix. These matrices cannot be passed as arguments to Fortranencoded subroutines, however.

Here are the notable features.

Vec
be the
name of a vector class with vector components made from doubles. And
we are defining Mat
to be a vector the components of
which are themselves doubeprecision vectors. That is to say, we are
treating the matrix as a list of its row vectors, and we think of the
list as a kind of generalized vector. The vector class is general
enough, it is even possible for the row vectors to have varying
length, but we would probably not call them matrices in that case.

cin >> row[j]
, rather
than with push_back
. Of course, we can still add more
elements beyond the initial n
with push_back
, if we like.

