Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in ca.jtimes when vector of size 0x1 is used #3654

Open
david0oo opened this issue Apr 9, 2024 · 1 comment
Open

Bug in ca.jtimes when vector of size 0x1 is used #3654

david0oo opened this issue Apr 9, 2024 · 1 comment

Comments

@david0oo
Copy link
Contributor

david0oo commented Apr 9, 2024

Hi,

we found a Casadi bug in:
https://github.com/acados/acados/blob/master/interfaces/acados_template/acados_template/casadi_function_generation.py#L571

if python y.shape = (0,1), then the following line fails:

python y_adj = ca.jtimes(y_expr, ca.vertcat(u, x), y, True)

but Casadi does not throw an exception, acados failed with a Floating Point Exception

@david0oo
Copy link
Contributor Author

david0oo commented Apr 9, 2024

Here is a minimal example:

import casadi as cs

# Working example:
y = cs.SX.sym('y', 3)
ux = cs.SX.sym('ux', 3)
y_expr = 0*ux
expr = cs.jtimes(y_expr, ux, y, True)
print("working value is: ", expr)

# Non working example:
y = cs.SX.sym('y', 0)
y_expr = cs.SX.sym('y_expr', 0)
ux = cs.SX.sym('ux', 3)
expr = cs.jtimes(y_expr, ux, y, True)
print("non working value is: ", expr)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant