Skip to content

Commit b033997

Browse files
author
Benjamin Chrétien
committed
Fix for Eigen::Ref.
1 parent 72a6149 commit b033997

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

src/wrap.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ namespace roboptim
122122
npy_intp outputSize = static_cast<npy_intp> (this->outputSize ());
123123

124124
PyObject* resultNumpy =
125-
PyArray_SimpleNewFromData (1, &outputSize, NPY_DOUBLE, &result[0]);
125+
PyArray_SimpleNewFromData (1, &outputSize, NPY_DOUBLE, result.data ());
126126
if (!resultNumpy)
127127
{
128128
PyErr_SetString (PyExc_TypeError, "cannot convert result");
@@ -131,7 +131,7 @@ namespace roboptim
131131

132132
PyObject* argNumpy =
133133
PyArray_SimpleNewFromData
134-
(1, &inputSize, NPY_DOUBLE, const_cast<double*> (&argument[0]));
134+
(1, &inputSize, NPY_DOUBLE, const_cast<double*> (argument.data ()));
135135
if (!argNumpy)
136136
{
137137
PyErr_SetString (PyExc_TypeError, "cannot convert argument");
@@ -244,7 +244,7 @@ namespace roboptim
244244
(::roboptim::core::python::Function::inputSize ());
245245

246246
PyObject* gradientNumpy =
247-
PyArray_SimpleNewFromData (1, &inputSize, NPY_DOUBLE, &gradient[0]);
247+
PyArray_SimpleNewFromData (1, &inputSize, NPY_DOUBLE, gradient.data ());
248248
if (!gradientNumpy)
249249
{
250250
PyErr_SetString (PyExc_TypeError, "cannot convert result");
@@ -253,7 +253,7 @@ namespace roboptim
253253

254254
PyObject* argNumpy =
255255
PyArray_SimpleNewFromData
256-
(1, &inputSize, NPY_DOUBLE, const_cast<double*> (&argument[0]));
256+
(1, &inputSize, NPY_DOUBLE, const_cast<double*> (argument.data ()));
257257
if (!argNumpy)
258258
{
259259
PyErr_SetString (PyExc_TypeError, "cannot convert argument");
@@ -317,7 +317,7 @@ namespace roboptim
317317

318318
PyObject* argNumpy =
319319
PyArray_SimpleNewFromData
320-
(1, &inputSize, NPY_DOUBLE, const_cast<double*> (&argument[0]));
320+
(1, &inputSize, NPY_DOUBLE, const_cast<double*> (argument.data ()));
321321
if (!argNumpy)
322322
{
323323
PyErr_SetString (PyExc_TypeError, "cannot convert argument");
@@ -967,7 +967,7 @@ namespace detail
967967
npy_intp n = static_cast<npy_intp> (v.size ());
968968

969969
return PyArray_SimpleNewFromData
970-
(1, &n, NPY_DOUBLE, const_cast<double*> (&v[0]));
970+
(1, &n, NPY_DOUBLE, const_cast<double*> (v.data ()));
971971
}
972972
};
973973

src/wrap.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ namespace roboptim
157157

158158

159159
virtual void
160-
impl_hessian (hessian_t& /*hessian*/,
160+
impl_hessian (hessian_ref /*hessian*/,
161161
const_argument_ref /*argument*/,
162162
size_type /*functionId*/) const;
163163

0 commit comments

Comments
 (0)