21 template<
typename T1,
typename T2>
22 void casadi_densify(
const T1* x,
const casadi_int* sp_x, T2* y, casadi_int tr) {
23 casadi_int nrow_x, ncol_x, i, el;
24 const casadi_int *colind_x, *row_x;
27 nrow_x = sp_x[0]; ncol_x = sp_x[1];
28 colind_x = sp_x+2; row_x = sp_x+ncol_x+3;
30 casadi_clear(y, nrow_x*ncol_x);
35 for (i=0; i<ncol_x; ++i) {
36 for (el=colind_x[i]; el!=colind_x[i+1]; ++el) {
37 y[i + row_x[el]*ncol_x] = CASADI_CAST(T2, *x++);
41 for (i=0; i<ncol_x; ++i) {
42 for (el=colind_x[i]; el!=colind_x[i+1]; ++el) {
43 y[row_x[el]] = CASADI_CAST(T2, *x++);