|
Boost : |
From: Aleksey Gurtovoy (agurtovoy_at_[hidden])
Date: 2004-07-05 18:04:35
Jeremy Graham Siek writes:
> On Jul 5, 2004, at 11:54 AM, Peter Schmitteckert wrote:
> > Salut,
> >
> > (note that I only use the dense matrices of ublas)
> >
> > On Mon, 5 Jul 2004, Toon Knapen wrote:
> >
> >
> > > This is just a matter of documentation. AFAIK there is no accepted
> > > concept that demands 'num_rows' and 'num_columns'. The '1' and '2'
> > refer
> > > to the first and second index which is also a nice convention IMO.
> >
> > I prefer size1 and size2, since it fits to the sheme of having a
> > tensor
> > structure with a size3.
> >
> Mixing up abstractions is not a good idea. Matrices and tensors are
> different creatures. True, sometimes it is useful to think of a tensor
> as a matrix, and having adaptors or views that allow for this is
> a good thing.
>
> The names we use for operations should match
> the common terminology from the problem domain. In this case,
> the common terminology is rows and columns.
Neither 'size1' nor 'num_rows' are generic, though. What you want is
something like
template< int n > size(int_<n>);
The particular int_<n> specializations then can be typedef'ed to
something more mnemonic, e.g.
typedef int_<0> rows;
or even
extern int_<0> rows;
The lack of this genericity will force you, sooner or later, to resort
to code duplication. I believe Vesa made the same point a long time
ago... yep: http://thread.gmane.org/gmane.comp.lib.boost.devel/60338.
-- Aleksey Gurtovoy MetaCommunications Engineering
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk