Re: phoenix domain language (to write mathematical formulas)

Andrey Asadchev <[email protected]> Mon, 14 Jun 2010 15:37:03 -0500
Newsgroups gmane.comp.parsers.spirit.devel
Message-ID <[email protected]>
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.

------------------------------------------------------------------------------
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

_______________________________________________
Spirit-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/spirit-devel