public API
(
switch to internal
)
-
revision 3.6.6
SX/SXFunction_constr_py.py
This examples demonstrates how to create an Function in python
View
output (PDF)
|
source (python)
See also
casadi::Function
();
casadi::Function
Function object.
Definition:
function.hpp:60
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from
casadi
import
*
28
29
x = SX.sym(
"x"
)
30
y = SX.sym(
"y"
,2)
31
z = SX.sym(
"z"
,2,3)
32
33
ins = [x,y]
34
outs = [x,y,vertcat(x,y),y*x,0]
35
36
print(outs)
37
38
f = Function(
"f"
, ins, outs)
39
40
41
42
print(f.n_in())
43
print(f.n_out())
44
45
46
47
48
49
f_out = f(*f.sx_in())
50
for
i
in
range(3):
51
print(f_out[i])