UNPKG

@woosh/meep-engine

Version:

Pure JavaScript game engine. Fully featured and production ready.

21 lines (20 loc) 701 B
/** * N-dimensional AXPY over offset slices of two flat buffers. * * y[yOff + i] += alpha * x[xOff + i] for i in [0, n) * * Use when the operands are columns/rows of a flat matrix; passing offsets * avoids per-call `.subarray(...)` header allocation. * * @param {number[]|Float32Array|Float64Array} y receives in-place update * @param {number} yOff starting index into y * @param {number} alpha * @param {number[]|Float32Array|Float64Array} x * @param {number} xOff starting index into x * @param {number} n number of elements */ export function vector_axpy_offset(y, yOff, alpha, x, xOff, n) { for (let i = 0; i < n; ++i) { y[yOff + i] += alpha * x[xOff + i]; } }