Boost logo

Boost :

From: Jeremy Graham Siek (jsiek_at_[hidden])
Date: 2004-07-09 11:28:30


Hi Paul,

Yes, you've got the idea.

The following document shows one such attempt to construct a
system of traits for algebraic concepts:

http://www.cs.rpi.edu/~schupp/entries/SOFTWARE/simpl/doc/AlgCpp.pdf

also, more information is available starting at:

http://www.cs.rpi.edu/~schupp/entries/SOFTWARE/simpl/

Cheers,
Jeremy

On Jul 7, 2004, at 7:32 PM, Paul C. Leopardi wrote:

> Jeremy, Dave,
> I think I get it. See below.
> Best regards
> On Thursday 08 July 2004 02:25, David Abrahams wrote:
> >  Jeremy Graham Siek <jsiek_at_[hidden]> writes:
> >  > group_traits<T>::is_commutative
> >      is_commutative_group<T>::type
> >      is_commutative_group<T>::type::value
>
> OK, for a type where you have one operation (a group).
> For a two operation type, I suppose you would then want
>
> is_ring<T>::type
> is_ring<T>::type::value
>
> is_commutative_ring<T>::type
> is_commutative_ring<T>::type::value
>
> Along these lines, you could build a header file called
> arithmetic_traits.hpp
> or something similar. The object of this file would be to describe
> some of
> the semantics of operator+, operator* and possibly other operators
> when used
> with various types. Eg. you could have say
>
> is_algebra< framed_multi<T,L,H>, T>::type
> is_algebra< framed_multi<T,L,H>, T>::scalar_type
>
> This header would also be used to define the zero element of addition
> and the
> identity element of multiplication, if it exists.
>
> Once this header is established, you could build template libraries
> which
> perform arithmetic according to the axioms embodied in the traits.
> Such a
> library would not eg. assume that multiplication is commutative, it
> would
> check this at compile time.
>
> Note that there would also need to be a distinction between
> approximate and
> exact arithmetic. This especially affects associativity, where eg.
> addition
> of real numbers behaves differently from addition of floating point
> numbers
> due to loss of precision. eg.
> http://h18009.www1.hp.com/fortran/docs/vf-html/pg/pg1round.htm
> http://www.ibiblio.org/pub/languages/fortran/ch4-6.html
>
>
>
>
> Yahoo! Groups Sponsor
>
> ADVERTISEMENT
> <lrec_companion_043004.gif>
> <l.gif>
>
> Yahoo! Groups Links
>
> • To visit your group on the web, go to:
> http://groups.yahoo.com/group/ublas-dev/
>  
> • To unsubscribe from this group, send an email to:
> ublas-dev-unsubscribe_at_[hidden]
>  
> • Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service.
>
>
_______________________________________________
Jeremy Siek <jsiek_at_[hidden]>
http://www.osl.iu.edu/~jsiek
Ph.D. Candidate, Indiana University Bloomington
C++ Booster (http://www.boost.org)
_______________________________________________


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk