Boost logo

Glas :

Re: [glas] Concept C++ [was Re: back to business}

From: Peter Gottschling (pgottsch_at_[hidden])
Date: 2006-11-27 13:01:55


On Nov 22, 2006, at 9:14 AM, Karl Meerbergen wrote:

> I see an immediate application of concept_map: glas::dense_vector
> becomes a EuclideanVectorspace, e.g.
>
> template <typename T>
> concept_map EuclideanVectorspace< dense_vector<T> > {
> real_type norm() const {
> return norm_2(v) ;
> }
>

That is an interesting idea to define a concept-dependent default
norm. However, we have to consider potential conflicts for vector
types that model multiple concepts with different default norms.

template <typename T>
concept_map L1VectorSpace< dense_vector<T> > {
   real_type norm() const {
     return norm_1(v) ;
   }
}

concept L12VectorSpace<typename Vector>
   : L1VectorSpace<Vector>, EuclideanVectorSpace<Vector>
{}

One solution to resolve this conflict is to introduce a convention
which norm is prioritized over the other (assuming we can agree on one).

concept L12VectorSpace<typename Vector>
   : L1VectorSpace<Vector>, EuclideanVectorSpace<Vector>
{
   real_type norm() {
      return norm_2(v);
   }
}

At any rate, I'm happy to get company on the algebraic concepts.

Best,
Peter

> T operator*( dense_vector<T> const& v ) const {
> return dot( conj(*this), v ) ;
> }
> } ;
>
>
>
> etc.
>
>
>
> On Wed, 2006-11-22 at 14:52 +0100, Ian McCulloch wrote:
>> On Wed, 22 Nov 2006, Karl Meerbergen wrote:
>>
>>> I think we should consider this. Is concept-gcc stable now?
>>
>> I think it is, although last time I checked there were some issues
>> with
>> compile times that ought to go away in the final version. Aside from
>> spending a few hours reading the proposal, I have never used
>> concept gcc.
>> Maybe someone else on this list has? My impression was though, it
>> would
>> be the killer feature for linear algebra libs.
>>
>> Cheers,
>> Ian
>>
>>
>>>
>>>
>>> On Wed, 2006-11-22 at 14:36 +0100, Ian McCulloch wrote:
>>>> Hi Karl, Toon,
>>>>
>>>> Have you considered using Concept-GCC ?
>>>> http://www.generic-programming.org/languages/conceptcpp/
>>>>
>>>> Ian
>>>>
>>>> _______________________________________________
>>>> glas mailing list
>>>> glas_at_[hidden]
>>>> http://lists.boost.org/mailman/listinfo.cgi/glas
>>> --
>>> Karl Meerbergen
>>> Katholieke Universiteit Leuven
>>> Department of Computer Science
>>>
>>> E-mail: karl.meerbergen_at_[hidden]
>>> URL : http://www.cs.kuleuven.be/cwis/research/nalag/
>>> Phone : +32 16 327700 (secretary)
>>> Fax : +32 16 327996
>>>
>>> _______________________________________________
>>> glas mailing list
>>> glas_at_[hidden]
>>> http://lists.boost.org/mailman/listinfo.cgi/glas
>>>
>>>
>> _______________________________________________
>> glas mailing list
>> glas_at_[hidden]
>> http://lists.boost.org/mailman/listinfo.cgi/glas
> --
> Karl Meerbergen
> Katholieke Universiteit Leuven
> Department of Computer Science
>
> E-mail: karl.meerbergen_at_[hidden]
> URL : http://www.cs.kuleuven.be/cwis/research/nalag/
> Phone : +32 16 327700 (secretary)
> Fax : +32 16 327996
>
> _______________________________________________
> glas mailing list
> glas_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/glas

------------
Peter Gottschling
Research Associate
Open Systems Laboratory
Indiana University
135 Lindley Hall
Bloomington, IN 47405
Tel.: +1 812 855-3608 Fax: +1 812 856 0853
http://www.osl.iu.edu/~pgottsch