fix compilation and unit test of adolc

This commit is contained in:
Gael Guennebaud 2010-10-26 16:26:20 +02:00
parent 92044fcc2b
commit 5e95ee6662
2 changed files with 14 additions and 13 deletions

View File

@ -82,21 +82,22 @@ namespace Eigen {
// the Adolc's type adouble is defined in the adtl namespace
// therefore, the following internal::* functions *must* be defined
// in the same namespace
namespace adtl {
namespace Eigen {
namespace internal {
inline const adouble& internal::conj(const adouble& x) { return x; }
inline const adouble& internal::real(const adouble& x) { return x; }
inline adouble internal::imag(const adouble&) { return 0.; }
inline adouble internal::abs(const adouble& x) { return fabs(x); }
inline adouble internal::abs2(const adouble& x) { return x*x; }
inline adouble internal::sqrt(const adouble& x) { return sqrt(x); }
inline adouble internal::exp(const adouble& x) { return exp(x); }
inline adouble internal::log(const adouble& x) { return log(x); }
inline adouble internal::sin(const adouble& x) { return sin(x); }
inline adouble internal::cos(const adouble& x) { return cos(x); }
inline adouble internal::pow(const adouble& x, adouble y) { return pow(x, y); }
inline const adtl::adouble& conj(const adtl::adouble& x) { return x; }
inline const adtl::adouble& real(const adtl::adouble& x) { return x; }
inline adtl::adouble imag(const adtl::adouble&) { return 0.; }
inline adtl::adouble abs(const adtl::adouble& x) { return adtl::fabs(x); }
inline adtl::adouble abs2(const adtl::adouble& x) { return x*x; }
using adtl::sqrt;
using adtl::exp;
using adtl::log;
using adtl::sin;
using adtl::cos;
using adtl::pow;
}

View File

@ -106,7 +106,7 @@ struct TestFunc1
template<typename Func> void adolc_forward_jacobian(const Func& f)
{
typename Func::InputType x = Func::InputType::Random();
typename Func::InputType x = Func::InputType::Random(f.inputs());
typename Func::ValueType y(f.values()), yref(f.values());
typename Func::JacobianType j(f.values(),f.inputs()), jref(f.values(),f.inputs());