
Whoops that should be v[j]
std::vector
Hi, I wanted to try to write a DFT that can take a compile-time data structure such as the following:
#include
// v = [1.01 2.01 3.01 4.01 5.01 6.01 7.01] typedef boost::mpl::math::string_c_to_double<1,'.',0,1>::type D1; typedef boost::mpl::math::string_c_to_double<2,'.',0,1>::type D2; typedef boost::mpl::math::string_c_to_double<3,'.',0,1>::type D3; typedef boost::mpl::math::string_c_to_double<4,'.',0,1>::type D4; typedef boost::mpl::math::string_c_to_double<5,'.',0,1>::type D5; typedef boost::mpl::math::string_c_to_double<6,'.',0,1>::type D6; typedef boost::mpl::math::string_c_to_double<7,'.',0,1>::type D7; typedef boost::mpl::math::string_c_to_double<8,'.',0,1>::type D8;
typedef boost::fusion::vector
VectorType; and perform the fourier transform at compile time.
The DFT is fairly simple as a for-loop it would look like this: std::vector
fft(const std::vector<float>& v) { std::vector result(v.size(),complex<float>(0,0)); complex<float> c(0,1); for(size_t i=0;i To get this algorithm into fusion, I would need a function object for times, divide, and exp. Thanks, Chris
On 1/22/07, Joel de Guzman
wrote: Chris Weed wrote:
Hi, I am interested in combining the fusion and mpl::math libraries, but I am not sure if they currently support what I want to do.
I want to use generic math operations that can easily switch between run-time and compile-time. I think this would require writing the mpl::math functions as "Polymorphic Function Object" as described in the fusion documentation. I am not sure if there is any mpl::math documentation that describes this.
It looks like the MPL currently has some math operations that are strictly meta-functions in boost/mpl/aux_/arithmetic_op.hpp. Are the any plans to expand these to be functions also?
It would be good to start with some use cases. With use cases, it's easier to understand what exactly you want to accomplish.
Regards, -- Joel de Guzman http://www.boost-consulting.com http://spirit.sf.net
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users