Boost logo

Glas :

[glas] ring_traits and vector space

From: Toon Knapen (toon.knapen_at_[hidden])
Date: 2005-01-11 01:49:10


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.

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).

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).

toon