From: Ullrich Koethe (koethe_at_[hidden])
Date: 2001-03-29 14:57:05
Very important remark:
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
Jeremy Siek wrote:
> 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> 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 R-Module, 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
-- ________________________________________________________________ | | | Ullrich Koethe Universität Hamburg / University of Hamburg | | FB Informatik / Dept. of Computer Science | | AB Kognitive Systeme / Cognitive Systems Group | | | | Phone: +49 (0)40 42883-2573 Vogt-Koelln-Str. 30 | | Fax: +49 (0)40 42883-2572 D - 22527 Hamburg | | Email: u.koethe_at_[hidden] Germany | | koethe_at_[hidden] | | WWW: http://kogs-www.informatik.uni-hamburg.de/~koethe/ | |________________________________________________________________|
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk