Boost logo

Boost :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2002-01-23 15:49:39

It is not important for the matrix dimension functions and the
multidimensional array dimension functions to have the same names, because
they are different abstractions. There have been many posts in the past,
by myself and other, about why matricies and arrays, though agonizingly
similar in representation, and really very different entities
mathematically, and should be treated differently in software (with which
we hope to model the mathematics).

If you think of a matrix as a linear operator (which I hope is what we are
aiming for with a linear algebra library), the number of columns is the
dimension of the range, and the number of rows is the dimension of the
domain. Half jokingly, I think domain_size() and range_size() would be
better names than number of rows and columns. However, the common usage is
the field is "number of rows" and "number of columns". If you don't name
the functions accordingly, you'll be forever answering emails about what
"size1" means.

On Thu, 17 Jan 2002, jhrwalter wrote:
walter> --- In boost_at_y..., Toon Knapen <toon.knapen_at_s...> wrote:
walter> > I find the size1() and size2() not very intuitive unless their
walter> names are
walter> > chosen to align with the storage (major-row ?) in which case I
walter> think the
walter> > name breaks encapsulation.
walter> size1() and size2() do not align with the storage order. size1()
walter> means the number of matrix rows and size2() means the number of
walter> matrix columns independent from the storage organization.
walter> >
walter> > Would'nt it be easier to just call them nrows() and ncols() for
walter> instance ?
walter> This could be a good question for a poll ;-). We opted for size1()
walter> and size2() because of compatibility to multidimensional arrays.
walter> BTW, the same question arises for index1()/index2() and
walter> iterator1/iterator2.
walter> Regards
walter> Joerg

 Jeremy Siek
 Ph.D. Student, Indiana Univ. B'ton email: jsiek_at_[hidden]
 C++ Booster ( office phone: (812) 855-3608

Boost list run by bdawes at, gregod at, cpdaniel at, john at