Hi,
during my work I ran into some issue (that are now solved) that were due to the different behavior of casadi.reshape() and numpy.reshape(). As in the example, I tried to reshape a matrix into a vector It looks like casadi shapes columns first and numpy rows first.
Sample Code
import casadi as ca
import numpy as np
A = ca.MX.sym('A',(2,2))
casadiReshape = ca.Function('caRes',[A],[A.reshape((4,1))])
print(f"Matrix: {np.array([[1, 2],[3, 4]])}")
print(f"Casadi: {casadiReshape(np.array([[1, 2],[3, 4]]))}")
print(f"Numpy: {np.array([[1, 2],[3, 4]]).reshape((4,1))}")
Prints:
Matrix: [[1 2]
[3 4]]
Casadi: [1, 3, 2, 4]
Numpy: [[1]
[2]
[3]
[4]]
Its not an issue any more, I just wanted to ask if this is intended?
Cheers Jakob