cos scalar
sin scalar
first n-dimensional tensor
second n-dimensional tensor BLAS: SROT, DROT, CROT, ZROT, CSROT, ZDROTF
import mir.ndslice.allocation: slice; auto x = slice!double(4); auto y = slice!double(4); auto a = slice!double(4); auto b = slice!double(4); double cos = 3.0 / 5; double sin = 4.0 / 5; x[] = [0, 1, 2, 3]; y[] = [4, 5, 6, 7]; foreach (i; 0 .. 4) { a[i] = cos * x[i] + sin * y[i]; b[i] = cos * y[i] - sin * x[i]; } rot(cos, sin, x, y); assert(x == a); assert(y == b);
Applies a plane rotation, where the c (cos) and s (sin) are scalars. Uses unrolled loops for strides equal to one.