Boost logo

Proto :

Subject: Re: [proto] Defining the result domain of a proto operator
From: Eric Niebler (eric_at_[hidden])
Date: 2011-08-26 10:45:23


On 8/26/2011 10:25 AM, Mathias Gaunard wrote:
> With the following Proto expression:
> m * v;
>
> with m in the matrix_domain and v in the vector_domain.
> vector_domain is a sub-domain of matrix_domain, so the common domain is
> matrix_domain.
>
> We want the '*' operation to model the matrix multiplication.
> matrix times vector yields a vector.
> Therefore, the result of m * v should be in the vector_domain.
>
> If we define operator* ourselves, then we can easily put the domain we
> want when calling proto::make_expr.
>
> However, using Proto-provided operator overloads, this doesn't appear to
> be possible.
>
> Is there a mechanism in Proto to define how the domain of a node new
> should be computed depending on the tag and the domains of the children?

Before I answer, can you tell me why you've decided to put vector and
matrix operations into separate domains? This seems like an artificial
and unnecessary separation to me.

-- 
Eric Niebler
BoostPro Computing
http://www.boostpro.com

Proto list run by eric at boostpro.com