Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check the use of transformX instead of for_eachX #32

Closed
headmyshoulder opened this issue May 12, 2012 · 8 comments
Closed

Check the use of transformX instead of for_eachX #32

headmyshoulder opened this issue May 12, 2012 · 8 comments
Milestone

Comments

@headmyshoulder
Copy link
Owner

Check, if transform can be used instead of for_each in all algebras.

This must necessarily result in a new version of odeint, since it will break existing code.

@headmyshoulder
Copy link
Owner Author

It works in principle but it is difficult to use with boost::units. The result type of the transform-operations has to be determined from the operation:

template< class Fac1 = double >
struct scale_sum1
{
    typedef xxx result_type;     // what should xxx be for boost::units, or how can we determine xxx from Fac1, T1

    scale_sum1( Fac1 fac1 ) : m_fac1( fac1 ) { }

    template< class T1 >
    result_type operator()( T1 t1 ) const { return t1 * m_fac1; }

private:
    Fac1 m_fac1;
};

It would work with C++11 where one can use decltype.

@mariomulansky
Copy link
Collaborator

Hrm I would think there should be a way somewhere in boost units to obtain the result type of some unit-based operation. Maybe we could ask on the boost list?

@headmyshoulder
Copy link
Owner Author

Yes, I guess this is possible. But then we have to introduce another layer determining the result type of any operation.

@mariomulansky
Copy link
Collaborator

Or units_operations? Maybe the cleaner way to handle this rare use-case, although it would break existing code - but if we switch to transform anyhow this might be acceptable.

@headmyshoulder
Copy link
Owner Author

I think it would be a nice feature for the C++11 version of odeint. C++11 support decltype which is exactly what is needed here.

@mariomulansky
Copy link
Collaborator

so leave the switch to transform for the c++11 version?

@headmyshoulder
Copy link
Owner Author

Yeah, I think this is the best idea. Switching to transform is a large change, which cannot easily be done in the trunk since it breaks existing code.

@headmyshoulder
Copy link
Owner Author

Moved this issue in the feature wishlist in the wiki!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants