Re: phoenix domain language (to write mathematical formulas)
Joel de Guzman <[email protected]> Wed, 16 Jun 2010 08:42:52 +0800
| Newsgroups | gmane.comp.parsers.spirit.devel |
|---|---|
| Message-ID | <[email protected]> |
On 6/15/10 4:37 AM, Andrey Asadchev wrote: > hello > > I have written to this list a few weeks ago regarding formula library > built on top of phoenix, > I changed few things around, here is the source code > > http://code.google.com/p/asadchev/source/browse/trunk/work/cxx/interval.hpp > > there is still more things to clean up. > > So far, the following things up possible (and some variations): > there a few examples in the link in the bottom of file also > > compose loops like: > x = (range(i) < N, 4 <= range(j) < M)[ expression ]; > > x(); //evaluate expression > reduce(_1 += _2)[ x ](x); // reduce expressions, usual reductions like > sum can be predefined. > > // use ublas (matrix multiply example) > ublas::matrix<double> a(N,N), b(N,N), c(N,N); > function<matrix<double> > A(a), B(b), C(c); > > (range(i) < N)(range(j) < N) > [ A(i,j) = sum(range(k) < N)[ B(k,i)*C(k,j) ] ](); > > > let me know if you have feedback. > I would like to contribute this to project if you think it is worthwhile. > I know quality is not very good yet, but I still work on it. Nice. We're working on Phoenix3. It would be nice to see how this all fits there. Regards, -- Joel de Guzman http://www.boostpro.com http://spirit.sf.net ------------------------------------------------------------------------------ ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo