vectorize a two parameter function
const mult = (v1, v2) => v1 * v2const arr1 = new Float32Array(10_000).map(() => 123 * (Math.random() - 0.5))const arr2 = new Float32Array(10_000).map(() => 321 * (Math.random() - 0.5))const arr = new Float32Array(10_000)vectorize2(mult, arr, arr1, arr2) // `arr` is now filled with random numbers Copy
const mult = (v1, v2) => v1 * v2const arr1 = new Float32Array(10_000).map(() => 123 * (Math.random() - 0.5))const arr2 = new Float32Array(10_000).map(() => 321 * (Math.random() - 0.5))const arr = new Float32Array(10_000)vectorize2(mult, arr, arr1, arr2) // `arr` is now filled with random numbers
Rest
vectorize a two parameter function
Example