Boost logo

Glas :

Re: [glas] ring_traits and vector space

From: Doug Gregor (dgregor_at_[hidden])
Date: 2005-01-11 10:31:06


On Jan 11, 2005, at 1:49 AM, Toon Knapen wrote:

> Doug Gregor wrote:
>> In the context of a ring, however, 0.0 is the
>> identity and 1.0 is the unity and there is no confusion. This may be
>> best expressed by calling the above structure "ring_traits" instead
>> of "value_traits".
>
> A ring has also multiplicative identity (in addition to be being an
> abelian group (R,+)) so 'identity' is still confusing.

The ambiguity is resolved in some textbooks by calling the
multiplicative identity the "unity", and the additive identity the
"identity".

> But related to the question if the value_type's should be in a ring is
> whether the vectors and matrices (in the glas library) should be
> defined in a vector-space or not. If so, this requires the
> value_type's to be in a field (and thus not restricted to a ring).

This seems desirable to me.

> OTOH we can also see vectors and matrices as 1D and 2D containers.
> This would allow for instance to use a matrix to store e.g.
> function-pointers in a 2D structure or have std::pair as value_type
> for vectors. The requirements on the operations on the value_type then
> would only depend on the _operations_ one performs on the vector or
> matrix (e.g. the value_type should have a operator- if you want to
> substract 2 vectors).

It's not really an either-or situation. We can say that the vectors and
matrices of the glas library model the Vector Space concept when the
value_type is a field (the common case), or some weaker concept when
the value_type is not a field.

        Doug