
Boost : 
From: Ullrich Koethe (koethe_at_[hidden])
Date: 20010329 14:57:05
Very important remark:
Basic Vector
x[i] vector_traits<X>::reference
The requirement that basic_vector::operator[] returns an lvalue has
proven very problematic in my applications (I know that is ubiquitous in
the C++ standard). It basically excludes the possibility to write
adapters whose operator[] returns a computed value. Note that a vector
that computes its values is not necessarily a constant vector  think,
for example, of an adapter for a complex matrix that returns the values
as (magnitude,phase) instead of the stored (real,imaginary). It is easy
to write a set() function then, but it's impossible to write operator[]
so that it returns an lvalue.
So I would prefer:
x[i] convertible to vector_traits<X>::value_type
x.set(a,i) 'a' convertible to vector_traits<X>::value_type
In practice, I've found that read operations are much more frequent than
write operations so that the additional set() does not really reduce
readability.
Jeremy Siek wrote:
>
> koethe>
> koethe> 1. All algebraic types must refine EqualityComparable.
>
> I'm not sure that is necessary. It seems to me there are lots of
> algorithms on numeric quantities that do not need equality comparable.
>
Strictly speaking, you need it to check the constraints (at least those
that are exact), so it belongs into the concepts. In practice, leaving
it out would mean to introduce new categories
SomeAlgebraicConceptAndEqualityComparable  this sounds confusing. Are
there really algorithms that can work on SomeAlgebraicConcept for which
EqualityComparable cannot be implemented?
> koethe> 3. in Field, you dropped the requirement
> koethe>
> koethe> a * b is equivalent to zero(a) if and only if a == zero(a) or b ==
> koethe> zero(a)
>
> I thought this property could be deduced from the others. Am I wrong?
>
I'm not sure. Please check this again.
> koethe> 4. In an RModule, is Commutativity also required ?
>
> It's already there. The type G must be an Additive Abelian Group, which
> includes Commutativity.
>
I mean Commutativity of the scalar multiplication
x * a is equivalent to a * x
Regards
Ulli
 ________________________________________________________________    Ullrich Koethe Universität Hamburg / University of Hamburg   FB Informatik / Dept. of Computer Science   AB Kognitive Systeme / Cognitive Systems Group     Phone: +49 (0)40 428832573 VogtKoellnStr. 30   Fax: +49 (0)40 428832572 D  22527 Hamburg   Email: u.koethe_at_[hidden] Germany   koethe_at_[hidden]   WWW: http://kogswww.informatik.unihamburg.de/~koethe/  ________________________________________________________________
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk