val0 = shape_data[col * n_columns + i];
res0 += val0 * x[i];
}
- if (add == false)
- out[stride * col] = res0;
- else
+ if (add)
out[stride * col] += res0;
+ else
+ out[stride * col] = res0;
}
if (one_line == false)
if (max_derivative > 1)
res2 += shape_values[ind + 2 * n_rows] * in[stride * ind];
}
- if (add == false)
+ if (add)
{
- out[0] = res0;
+ out[0] += res0;
if (max_derivative > 0)
- out[out_stride] = res1;
+ out[out_stride] += res1;
if (max_derivative > 1)
- out[2 * out_stride] = res2;
+ out[2 * out_stride] += res2;
}
else
{
- out[0] += res0;
+ out[0] = res0;
if (max_derivative > 0)
- out[out_stride] += res1;
+ out[out_stride] = res1;
if (max_derivative > 1)
- out[2 * out_stride] += res2;
+ out[2 * out_stride] = res2;
}
}
else
{
for (int col = 0; col < n_rows; ++col)
{
- if (add == false)
- out[col * stride] = shape_values[col] * in[0];
+ if (add)
+ out[col * stride] += shape_values[col] * in[0];
else
out[col * stride] += shape_values[col] * in[0];
if (max_derivative > 0)
{
const Number result =
shape_data[col] * x0 + shape_data_1[col] * x1;
- if (add == false)
- out[stride * col] = result;
- else
+ if (add)
out[stride * col] += result;
+ else
+ out[stride * col] = result;
}
if (one_line == false)
const Number result = shape_data[col] * x0 +
shape_data_1[col] * x1 +
shape_data_2[col] * x2;
- if (add == false)
- out[stride * col] = result;
- else
+ if (add)
out[stride * col] += result;
+ else
+ out[stride * col] = result;
}
if (one_line == false)
if (max_derivative > 1)
res2 += shape_values[ind + 2 * n_rows] * in[stride * ind];
}
- if (add == false)
+ if (add)
{
- out[0] = res0;
+ out[0] += res0;
if (max_derivative > 0)
- out[out_stride] = res1;
+ out[out_stride] += res1;
if (max_derivative > 1)
- out[2 * out_stride] = res2;
+ out[2 * out_stride] += res2;
}
else
{
- out[0] += res0;
+ out[0] = res0;
if (max_derivative > 0)
- out[out_stride] += res1;
+ out[out_stride] = res1;
if (max_derivative > 1)
- out[2 * out_stride] += res2;
+ out[2 * out_stride] = res2;
}
}
else
{
for (unsigned int col = 0; col < n_rows; ++col)
{
- if (add == false)
- out[col * stride] = shape_values[col] * in[0];
- else
+ if (add)
out[col * stride] += shape_values[col] * in[0];
+ else
+ out[col * stride] = shape_values[col] * in[0];
if (max_derivative > 0)
out[col * stride] +=
shape_values[col + n_rows] * in[out_stride];
res1 += in1;
}
}
- if (add == false)
+ if (add)
{
- out[stride * col] = res0;
- out[stride * (nn - 1 - col)] = res1;
+ out[stride * col] += res0;
+ out[stride * (nn - 1 - col)] += res1;
}
else
{
- out[stride * col] += res0;
- out[stride * (nn - 1 - col)] += res1;
+ out[stride * col] = res0;
+ out[stride * (nn - 1 - col)] = res1;
}
}
if (contract_over_rows == true && nn % 2 == 1 && mm % 2 == 1)
{
- if (add == false)
- out[stride * n_cols] = in[stride * mid];
- else
+ if (add)
out[stride * n_cols] += in[stride * mid];
+ else
+ out[stride * n_cols] = in[stride * mid];
}
else if (contract_over_rows == true && nn % 2 == 1)
{
}
else
res0 = Number();
- if (add == false)
- out[stride * n_cols] = res0;
- else
+ if (add)
out[stride * n_cols] += res0;
+ else
+ out[stride * n_cols] = res0;
}
else if (contract_over_rows == false && nn % 2 == 1)
{
}
else
res0 = in[0];
- if (add == false)
- out[stride * n_cols] = res0;
- else
+ if (add)
out[stride * n_cols] += res0;
+ else
+ out[stride * n_cols] = res0;
}
++in;
res0 += in1;
res1 -= in1;
}
- if (add == false)
+ if (add)
{
- out[stride * col] = res0;
- out[stride * (nn - 1 - col)] = res1;
+ out[stride * col] += res0;
+ out[stride * (nn - 1 - col)] += res1;
}
else
{
- out[stride * col] += res0;
- out[stride * (nn - 1 - col)] += res1;
+ out[stride * col] = res0;
+ out[stride * (nn - 1 - col)] = res1;
}
}
if (nn % 2 == 1)
val0 * (in[stride * ind] - in[stride * (mm - 1 - ind)]);
res0 += in1;
}
- if (add == false)
- out[stride * n_cols] = res0;
- else
+ if (add)
out[stride * n_cols] += res0;
+ else
+ out[stride * n_cols] = res0;
}
++in;
res0 += in1;
res1 += in1;
}
- if (add == false)
+ if (add)
{
- out[stride * col] = res0;
- out[stride * (nn - 1 - col)] = res1;
+ out[stride * col] += res0;
+ out[stride * (nn - 1 - col)] += res1;
}
else
{
- out[stride * col] += res0;
- out[stride * (nn - 1 - col)] += res1;
+ out[stride * col] = res0;
+ out[stride * (nn - 1 - col)] = res1;
}
}
if (nn % 2 == 1)
val0 = shape_hessians[n_cols * n_columns + mid];
res0 += val0 * in[stride * mid];
}
- if (add == false)
- out[stride * n_cols] = res0;
- else
+ if (add)
out[stride * n_cols] += res0;
+ else
+ out[stride * n_cols] = res0;
}
++in;
else if (mm % 2 == 1 && (nn % 2 == 0 || type > 0 || mm == 3))
r0 += shapes[col * offset + mid] * xmid;
- if (add == false)
+ if (add)
{
- out[stride * col] = r0 + r1;
+ out[stride * col] += r0 + r1;
if (type == 1 && contract_over_rows == false)
- out[stride * (nn - 1 - col)] = r1 - r0;
+ out[stride * (nn - 1 - col)] += r1 - r0;
else
- out[stride * (nn - 1 - col)] = r0 - r1;
+ out[stride * (nn - 1 - col)] += r0 - r1;
}
else
{
- out[stride * col] += r0 + r1;
+ out[stride * col] = r0 + r1;
if (type == 1 && contract_over_rows == false)
- out[stride * (nn - 1 - col)] += r1 - r0;
+ out[stride * (nn - 1 - col)] = r1 - r0;
else
- out[stride * (nn - 1 - col)] += r0 - r1;
+ out[stride * (nn - 1 - col)] = r0 - r1;
}
}
if (type == 0 && contract_over_rows == true && nn % 2 == 1 &&
mm % 2 == 1 && mm > 3)
{
- if (add == false)
- out[stride * n_cols] = shapes[mid * offset + n_cols] * xmid;
- else
+ if (add)
out[stride * n_cols] += shapes[mid * offset + n_cols] * xmid;
+ else
+ out[stride * n_cols] = shapes[mid * offset + n_cols] * xmid;
}
else if (contract_over_rows == true && nn % 2 == 1)
{
if (type != 1 && mm % 2 == 1)
r0 += shapes[mid * offset + n_cols] * xmid;
- if (add == false)
- out[stride * n_cols] = r0;
- else
+ if (add)
out[stride * n_cols] += r0;
+ else
+ out[stride * n_cols] = r0;
}
else if (contract_over_rows == false && nn % 2 == 1)
{
if ((type == 0 || type == 2) && mm % 2 == 1)
r0 += shapes[n_cols * offset + mid] * xmid;
- if (add == false)
- out[stride * n_cols] = r0;
- else
+ if (add)
out[stride * n_cols] += r0;
+ else
+ out[stride * n_cols] = r0;
}
if (one_line == false)
{
r0 = r1 = Number();
if (mm % 2 == 1)
r0 += shapes[col + (mm - 1) * n_columns] * x[mm - 1];
- if (add == false)
+ if (add)
{
- out[stride * col] = r0 + r1;
+ out[stride * col] += r0 + r1;
if (type == 1)
- out[stride * (nn - 1 - col)] = r1 - r0;
+ out[stride * (nn - 1 - col)] += r1 - r0;
else
- out[stride * (nn - 1 - col)] = r0 - r1;
+ out[stride * (nn - 1 - col)] += r0 - r1;
}
else
{
- out[stride * col] += r0 + r1;
+ out[stride * col] = r0 + r1;
if (type == 1)
- out[stride * (nn - 1 - col)] += r1 - r0;
+ out[stride * (nn - 1 - col)] = r1 - r0;
else
- out[stride * (nn - 1 - col)] += r0 - r1;
+ out[stride * (nn - 1 - col)] = r0 - r1;
}
}
if (nn % 2 == 1)
r0 = 0;
if (type != 1 && mm % 2 == 1)
r0 += shapes[n_cols + (mm - 1) * n_columns] * x[mm - 1];
- if (add == false)
- out[stride * n_cols] = r0;
- else
+ if (add)
out[stride * n_cols] += r0;
+ else
+ out[stride * n_cols] = r0;
}
}
else
else
r0 += shapes[2 * col * n_columns + mid] * xp[mid];
}
- if (add == false)
+ if (add)
{
- out[stride * (2 * col)] = r0;
- out[stride * (2 * col + 1)] = r1;
+ out[stride * (2 * col)] += r0;
+ out[stride * (2 * col + 1)] += r1;
}
else
{
- out[stride * (2 * col)] += r0;
- out[stride * (2 * col + 1)] += r1;
+ out[stride * (2 * col)] = r0;
+ out[stride * (2 * col + 1)] = r1;
}
}
if (nn % 2 == 1)
r0 = Number();
if (mm % 2 == 1 && type == 0)
r0 += shapes[(nn - 1) * n_columns + mid] * xp[mid];
- if (add == false)
- out[stride * (nn - 1)] = r0;
- else
+ if (add)
out[stride * (nn - 1)] += r0;
+ else
+ out[stride * (nn - 1)] = r0;
}
}
if (one_line == false)