This storage type gives an "array of pointers" style
implementation of a matrix. Each row or column of the matrix
is allocated separately. The type of vector used for the rows
or columns is very flexible, and one can choose from any of the
OneD storage types, which include dense,
compressed, sparse_pair, tree,
and linked_list.
matrix < double,
rectangle<>,
array< dense<> >,
row_major >::type
[ ] > [ 1 0 0 4 0 ]
[ ] > [ 0 7 8 0 0 ]
[ ] > [ 11 0 13 14 0 ]
[ ] > [ 16 0 18 0 20 ]
[ ] > [ 0 22 0 24 0 ]
matrix < double,
rectangle<>,
array< sparse_pair<> >,
row_major >::type
[ ] > [ (1,0) (4,3) ]
[ ] > [ (7,1) (8,2) ]
[ ] > [ (11,0) (13,2) (14,3) ]
[ ] > [ (16,0) (18,2) (20,4) ]
[ ] > [ (22,1) (24,3) ]
One advantage of this type of storage is that rows can be
swapped in constant time. For instance, one could swap the
row 3 and 4 of a matrix in the following way.
Matrix::OneD tmp = A[3];
A[3] = A[4];
A[4] = tmp;
The rows are individually reference counted so that the user
does not have to worry about deallocating the rows.
