Boost logo

Boost :

From: jhrwalter (walter_at_[hidden])
Date: 2002-01-25 05:16:40

--- In boost_at_y..., Jeremy Siek <jsiek_at_c...> wrote:
> On Thu, 24 Jan 2002, jhrwalter wrote:
> walter> --- In boost_at_y..., Jeremy Siek <jsiek_at_c...> wrote:
> walter> >
> walter> > It is not important for the matrix dimension functions
and the
> walter> > multidimensional array dimension functions to have the
same names,
> walter> because
> walter> > they are different abstractions. There have been many
posts in the
> walter> past,
> walter> > by myself and other, about why matricies and arrays,
> walter> agonizingly
> walter> > similar in representation, and really very different
> walter> > mathematically, and should be treated differently in
software (with
> walter> which
> walter> > we hope to model the mathematics).
> walter>
> walter> May be that's correct for matrices and multidimensional
arrays. But
> walter> I'm not sure, if the same holds for matrices and tensors.
> Ok, that may be, but I haven't seen any posts regarding concept
> definitions for tensors yet. If you have a tensor abstraction in
> could you do up a quick sketch of what it would look like?

Sorry, I'm currently busy with other things. May be I'll have the
time some day.
> walter> > If you think of a matrix as a linear operator (which I
hope is what
> walter> we are
> walter> > aiming for with a linear algebra library), the number of
columns is
> walter> the
> walter> > dimension of the range, and the number of rows is the
dimension of
> walter> the
> walter> > domain. Half jokingly, I think domain_size() and
range_size() would
> walter> be
> walter> > better names than number of rows and columns.
> walter>
> walter> Interesting idea, but I'm not sure, if this is ok for left
> walter> multiplication with a vector.
> Sure it does. Isn't x * A really A^T * x. When you transpose a
matrix, the
> number of rows and columns get swapped. Therefore, with the matrix
> transposed, the new number of columns (the old num rows)
corresponds to
> the size of x, and the new number of rows matches the result vector.

Sure, we could eliminate x * A and force the user to always write
(A^t * x^t)^t instead ;-). But if we would not, we could get code
like the following for right and left multiplication with a vector:
Right multiplication:
for (i = 0; i < A.range_size (); ++ i) {
 r [i] = 0;
 for (j = 0; j < A.domain_size (); ++ j)
  r [i] += A [i] [j] * x [j];
Left multiplication:
for (j = 0; j < A.domain_size (); ++ j) {
 r [j] = 0;
 for (i = 0; i < A.range_size (); ++ i)
  r [j] += x [i] * A [i] [j];
The latter doesn't seem to be ok for me.
> walter> > However, the common usage is
> walter> > the field is "number of rows" and "number of columns". If
you don't
> walter> name
> walter> > the functions accordingly, you'll be forever answering
emails about
> walter> what
> walter> > "size1" means.
> walter>
> walter> Good point.
> walter>
> walter> It seems to me, that the intermediate results of our
> walter> poll are:
> walter> nrows/ncols: 2
> walter> size1/size2: ?
> walter>
> walter> So let me ask the question the other way round: are there
> walter> objections, if we rename size1()/size2() to row_count
> walter> (), index1()/index2() to row_index()/column_index() and
> walter> ()/iterator2() to row_iterator()/column_iterator()?
> That's better, but I'm not a big fan of "row_count". Someone could
read it
> as the length of a row, instead of the number of rows. I
think "num_rows"
> is better (and that is nice and consistent with the naming scheme
in the
> BGL, which uses num_vertices and num_edge).


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