fix adolc unit test for dynamic sizes

This commit is contained in:
Gael Guennebaud 2009-05-12 07:38:46 +00:00
parent f5b5571a5a
commit 159c99a288

View File

@ -39,12 +39,12 @@ struct TestFunc1
typedef Matrix<Scalar,InputsAtCompileTime,1> InputType; typedef Matrix<Scalar,InputsAtCompileTime,1> InputType;
typedef Matrix<Scalar,ValuesAtCompileTime,1> ValueType; typedef Matrix<Scalar,ValuesAtCompileTime,1> ValueType;
typedef Matrix<Scalar,ValuesAtCompileTime,InputsAtCompileTime> JacobianType; typedef Matrix<Scalar,ValuesAtCompileTime,InputsAtCompileTime> JacobianType;
int m_inputs, m_values; int m_inputs, m_values;
TestFunc1() : m_inputs(InputsAtCompileTime), m_values(ValuesAtCompileTime) {} TestFunc1() : m_inputs(InputsAtCompileTime), m_values(ValuesAtCompileTime) {}
TestFunc1(int inputs, int values) : m_inputs(inputs), m_values(values) {} TestFunc1(int inputs, int values) : m_inputs(inputs), m_values(values) {}
int inputs() const { return m_inputs; } int inputs() const { return m_inputs; }
int values() const { return m_values; } int values() const { return m_values; }
@ -107,8 +107,8 @@ struct TestFunc1
template<typename Func> void adolc_forward_jacobian(const Func& f) template<typename Func> void adolc_forward_jacobian(const Func& f)
{ {
typename Func::InputType x = Func::InputType::Random(); typename Func::InputType x = Func::InputType::Random();
typename Func::ValueType y, yref; typename Func::ValueType y(f.values()), yref(f.values());
typename Func::JacobianType j, jref; typename Func::JacobianType j(f.values(),f.inputs()), jref(f.values(),f.inputs());
jref.setZero(); jref.setZero();
yref.setZero(); yref.setZero();