We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3606713 commit a6abdbfCopy full SHA for a6abdbf
include/pycppad/codegen/cg.hpp
@@ -32,6 +32,26 @@ struct cast<From,::CppAD::cg::CG<Scalar>>
32
}
33
};
34
35
+namespace internal {
36
+
37
+template <typename Scalar>
38
+struct getitem<::CppAD::cg::CG<Scalar>> {
39
40
+ typedef ::CppAD::cg::CG<Scalar> CG;
41
42
+ static PyObject* run(void* data, void* /* arr */) {
43
+ CG & cg = *static_cast<CG*>(data);
44
45
+ if(!cg.isValueDefined()) // not initialized
46
+ cg.setValue(static_cast<Scalar>(0));
47
48
+ bp::object m(cg);
49
+ Py_INCREF(m.ptr());
50
+ return m.ptr();
51
+ }
52
+};
53
54
+} // namespace internal
55
} // namespace eigenpy
56
57
namespace pycppad
0 commit comments