Glas :Re: [glas] norms and inner products for vectors of matrices |
From: Andrew Lumsdaine (lums_at_[hidden])
Date: 2006-01-17 08:51:24
I think the answer is: "it depends."
In a generic library, the operator * is defined between two concepts
for which multiplication makes sense, i.e., a scalar times a scalar,
a scalar times a member of a vector space, a linear operator times a
member of a vector space.
So, if you have some particular types, the meaning of the operator *
between those types depends on the manner in which those types model
the concepts for which * is defined.
For instance, a vector<vector<double>> could be a row matrix, a
column matrix, a diagonal matrix, a banded matrix, etc. Each of
these different interpretations of that type (different ways the type
can model the concept) will have different interpretations of the
multiply operator.
I think it is very important to keep the mathematical concepts and
the concrete implementations distinct from each other.
On Jan 17, 2006, at 4:15 AM, Karl Meerbergen wrote:
> Hi,
>
> Here is a question about nested vectors.
>
> Suppose I have
> vector< vector< double > > v ;
> vector< double > w ;
> double d ;
>
> d*v : scalar times vector;
> trans(w)*w: dot product of vector of vector with vector of vector:
> sum_i
> trans(w[i])*w[i]
> trans(v)*v: dot product of vector with vector: sum_i v[i]*v[i]
>
> How should trans(v)*w be interpreted?
> * result is a vector<double> which is the sum: sum_i v[i]*w[i] ?
> * result is a vector<double> with element i being: trans(v)*w[i] ?
>
> Best,
>
> Karl
>
> _______________________________________________
> glas mailing list
> glas_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/glas