File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11/*
2- * Copyright 2021 INRIA
2+ * Copyright 2021-2022 INRIA
33 */
44
55#ifndef __pycppad_cast_hpp__
66#define __pycppad_cast_hpp__
77
88#include " pycppad/fwd.hpp"
99
10+ #include < eigenpy/user-type.hpp>
11+
1012namespace pycppad
1113{
1214 namespace internal
@@ -42,4 +44,26 @@ namespace pycppad
4244 } // namespace internal
4345} // namespace pycppad
4446
47+ namespace eigenpy {
48+
49+ template <typename Scalar, typename To>
50+ struct cast <::CppAD::AD<Scalar>, To>
51+ {
52+ typedef ::CppAD::AD<Scalar> From;
53+ static To run (const From & from) {
54+ return ::pycppad::internal::Cast<From, To>::run (from);
55+ }
56+ };
57+
58+ template <typename From, typename Scalar>
59+ struct cast <From,::CppAD::AD<Scalar>>
60+ {
61+ typedef ::CppAD::AD<Scalar> To;
62+ static To run (const From & from) {
63+ return To (static_cast <Scalar>(from));
64+ }
65+ };
66+
67+ } // namespace eigenpy
68+
4569#endif // #ifndef __pycppad_cast_hpp__
Original file line number Diff line number Diff line change 1212
1313#include " pycppad/cast.hpp"
1414
15+ namespace eigenpy {
16+
17+ template <typename Scalar, typename To>
18+ struct cast <::CppAD::cg::CG<Scalar>, To>
19+ {
20+ typedef ::CppAD::cg::CG<Scalar> From;
21+ static To run (const From & from) {
22+ return ::pycppad::internal::Cast<From, To>::run (from);
23+ }
24+ };
25+
26+ template <typename From, typename Scalar>
27+ struct cast <From,::CppAD::cg::CG<Scalar>>
28+ {
29+ typedef ::CppAD::cg::CG<Scalar> To;
30+ static To run (const From & from) {
31+ return To (static_cast <Scalar>(from));
32+ }
33+ };
34+
35+ } // namespace eigenpy
36+
1537namespace pycppad
1638{
1739 namespace internal
You can’t perform that action at this time.
0 commit comments