Skip to content

Commit

Permalink
allow calls to CppAD::CompareChange as compare_change and allow speci…
Browse files Browse the repository at this point in the history
…fic variant of pow with integer exponent
  • Loading branch information
utke1 authored and jutke committed Apr 25, 2014
1 parent 7e6d686 commit b4c8deb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pycppad/adfun.cpp
Expand Up @@ -471,6 +471,11 @@ namespace pycppad {
return vec2array(result);
}

// CompareChange
template <class Base>
int ADFun<Base>::CompareChange(void)
{ return static_cast<int>( f_.CompareChange() ); }

// Reverse
template <class Base>
array ADFun<Base>::Reverse(int p, array& w)
Expand Down
1 change: 1 addition & 0 deletions pycppad/adfun.hpp
Expand Up @@ -18,6 +18,7 @@ namespace pycppad {
int Domain(void);
int Range(void);
array Forward(int p, array& xp);
int CompareChange(void);
array Reverse(int p, array& w);
array Jacobian(array& x);
array Hessian(array& x, array& w);
Expand Down
3 changes: 3 additions & 0 deletions pycppad/pycppad.cpp
Expand Up @@ -703,12 +703,14 @@ BOOST_PYTHON_MODULE(cppad_)
// pow
.def( pow(self, self) )
.def( pow(self, double()) )
.def( pow(self, int()) )
.def( pow(double(), self) )
;

class_<ADFun_double>("adfun_float", init< array& , array& >())
.def("domain", &ADFun_double::Domain)
.def("forward", &ADFun_double::Forward)
.def("compare_change", &ADFun_double::CompareChange)
.def("hessian_" , &ADFun_double::Hessian)
.def("jacobian_", &ADFun_double::Jacobian)
.def("optimize", &ADFun_double::optimize)
Expand All @@ -733,6 +735,7 @@ BOOST_PYTHON_MODULE(cppad_)
.def("domain", &ADFun_AD_double::Domain)
.def("range", &ADFun_AD_double::Range)
.def("forward", &ADFun_AD_double::Forward)
.def("compare_change", &ADFun_AD_double::CompareChange)
.def("reverse", &ADFun_AD_double::Reverse)
.def("jacobian_", &ADFun_AD_double::Jacobian)
.def("hessian_", &ADFun_AD_double::Hessian)
Expand Down

0 comments on commit b4c8deb

Please sign in to comment.