35 Real fractional_index = q_value / q_spacing;
36 int base_index =
static_cast<int>(fractional_index);
37 Real fractional_part = fractional_index - base_index;
38 if (base_index + 3 >= table_size)
40 Real weight_1 = 1.0 - fractional_part;
41 Real weight_2 = 2.0 - fractional_part;
42 Real weight_3 = 3.0 - fractional_part;
43 return table[base_index] * weight_1 * weight_2 * weight_3 / 6.0 +
44 table[base_index + 1] * fractional_part * weight_2 * weight_3 / 2.0 -
45 table[base_index + 2] * fractional_part * weight_1 * weight_3 / 2.0 +
46 table[base_index + 3] * fractional_part * weight_1 * weight_2 / 6.0;
64 Real fractional_index = q_value / q_spacing;
65 int base_index =
static_cast<int>(fractional_index);
66 Real fractional_part = fractional_index - base_index;
67 if (base_index + 3 >= table_size)
69 Real weight_1 = 1.0 - fractional_part;
70 Real weight_2 = 2.0 - fractional_part;
71 Real weight_3 = 3.0 - fractional_part;
73 return (table[base_index] * (-weight_2 * weight_3 - weight_1 * weight_3 - weight_1 * weight_2) /
75 table[base_index + 1] *
76 (+weight_2 * weight_3 - fractional_part * weight_3 - fractional_part * weight_2) /
78 table[base_index + 2] *
79 (+weight_1 * weight_3 - fractional_part * weight_3 - fractional_part * weight_1) /
81 table[base_index + 3] *
82 (+weight_1 * weight_2 - fractional_part * weight_2 - fractional_part * weight_1) /