27 void casadi_blazing_2d_boor_eval(T1* f, T1* J, T1* H,
const T1* all_knots,
const T1* all_knots_cache,
const casadi_int* offset,
const T1* c,
const T1* dc,
const T1* ddc,
const T1* all_x,
const casadi_int* lookup_mode, casadi_int* iw, T1* w) {
32 casadi_int stride1 = offset[1]-offset[0]-4;
34 simde__m256d zero = simde_mm256_set1_pd(0.0);
37 simde__m256d d0[2], d1[2], d2[2];
38 const T1* inv2[2] = {0, 0};
const T1* inv3[2] = {0, 0};
42 const T1* dim_cache0 = all_knots_cache;
43 const T1* dim_cache1 = all_knots_cache
44 ? all_knots_cache + 2 + 3*(offset[1] - offset[0]) : 0;
45 starts[0] = casadi_blazing_boor_init<T1>(all_x[0], all_knots, dim_cache0,
46 offset[0], offset[1], lookup_mode[0], &d0[0], &d1[0], &d2[0], &inv2[0], &inv3[0]);
47 starts[1] = casadi_blazing_boor_init<T1>(all_x[1], all_knots, dim_cache1,
48 offset[1], offset[2], lookup_mode[1], &d0[1], &d1[1], &d2[1], &inv2[1], &inv3[1]);
52 for (
int j=0;j<4;++j) {
53 C[j] = simde_mm256_loadu_pd(c+(starts[1]+j)*stride1+starts[0]);
57 f[0] = casadi_blazing_tensor_ttv2<T1>(C, d0[0], d0[1]);
61 const T1* t0 = all_knots + offset[0] + starts[0];
62 const T1* t1 = all_knots + offset[1] + starts[1];
65 simde__m256d J0 = dc ? d1[0] : casadi_blazing_dbasis<T1>(d1[0], t0, inv3[0]);
66 simde__m256d J1 = dc ? d1[1] : casadi_blazing_dbasis<T1>(d1[1], t1, inv3[1]);
71 stride1 = offset[1]-offset[0]-4-1;
72 for (
int j=0;j<4;++j) {
73 C[j] = simde_mm256_loadu_pd(dc+(starts[1]+j)*stride1+starts[0]-1);
75 dc += stride1*(offset[2]-offset[1]-4);
77 J[0] = casadi_blazing_tensor_ttv2<T1>(C, J0, d0[1]);
80 stride1 = offset[1]-offset[0]-4;
81 for (
int j=0;j<4;++j) {
85 C[j] = simde_mm256_loadu_pd(dc+(starts[1]+j-1)*stride1+starts[0]);
89 J[1] = casadi_blazing_tensor_ttv2<T1>(C, d0[0], J1);
95 simde__m256d H0 = ddc ? d2[0] : casadi_blazing_d2basis<T1>(d2[0], t0, inv2[0], inv3[0]);
96 simde__m256d H1 = ddc ? d2[1] : casadi_blazing_d2basis<T1>(d2[1], t1, inv2[1], inv3[1]);
100 stride1 = offset[1]-offset[0]-4-2;
101 for (
int j=0;j<4;++j)
102 C[j] = simde_mm256_loadu_pd(ddc+(starts[1]+j)*stride1+starts[0]-2);
103 ddc += stride1*(offset[2]-offset[1]-4);
105 H[0] = casadi_blazing_tensor_ttv2<T1>(C, H0, d0[1]);
108 stride1 = offset[1]-offset[0]-4;
109 for (
int j=0;j<4;++j) {
113 C[j] = simde_mm256_loadu_pd(ddc+(starts[1]+j-2)*stride1+starts[0]);
116 ddc += stride1*(offset[2]-offset[1]-4-2);
118 H[3] = casadi_blazing_tensor_ttv2<T1>(C, d0[0], H1);
122 stride1 = offset[1]-offset[0]-5;
123 for (
int j=0;j<4;++j) {
127 C[j] = simde_mm256_loadu_pd(ddc+(starts[1]+j-1)*stride1+starts[0]-1);
131 H[1] = H[2] = casadi_blazing_tensor_ttv2<T1>(C, J0, J1);