Boost logo

Boost :

From: Larry Evans (cppljevans_at_[hidden])
Date: 2005-03-10 07:58:39


On 03/10/2005 01:31 AM, Erik Wien wrote:
[snip]
>
> For what it's worth; If it turns out there is an interest in such a
> class, I have already written one (with that exact declaration in fact)
> I'd be more that willing to donate to boost. It can currently do
> addition, subtraction and multiplication of matrices, as well as provide
> functions for a lot of vector and matrix operations like generation of
> rotation matrices, taking the length of a vector and so on and so forth.
>
Isn't a matrix a "rank 2". I'm using the term "rank" because that's an
apl term, and I'm a fan ;) :

   http://www.aplusdev.org/APlusRefV2_4.html#17

Anyway, why not a template:

   template < typename T, typename Shape >
   class array
   {
   ...
   };

where Shape is a vector_c<unsigned, S1,S2,...,Sn>

to create a rank n array with S1 is length (or dimension)
of 1st axis, S2 the length of 2nd axis, ... ? The strides
of such a "compile-time specified shape" array could also
be calculated at compile time as shown in the test_partial_product
function of fold_seq_test.cpp in fold_seq_test.zip in
http://boost-sandbox.sourceforge.net/vault/.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk