| 77 | } |
| 78 | |
| 79 | Array<shared_ptr<CoefficientFunction>> MakeCoefficients (py::object py_coef) |
| 80 | { |
| 81 | Array<shared_ptr<CoefficientFunction>> tmp; |
| 82 | if (py::isinstance<py::list>(py_coef)) |
| 83 | { |
| 84 | auto l = py_coef.cast<py::list>(); |
| 85 | for (int i = 0; i < py::len(l); i++) |
| 86 | tmp += MakeCoefficient(l[i]); |
| 87 | } |
| 88 | else if (py::isinstance<py::tuple>(py_coef)) |
| 89 | { |
| 90 | auto l = py_coef.cast<py::tuple>(); |
| 91 | for (int i = 0; i < py::len(l); i++) |
| 92 | tmp += MakeCoefficient(l[i]); |
| 93 | } |
| 94 | else |
| 95 | tmp += MakeCoefficient(py_coef); |
| 96 | |
| 97 | return tmp; |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | struct PythonCoefficientFunction : public CoefficientFunction { |
no test coverage detected