gpuZipWith (Function)
Signature: gpuZipWith(a: GpuBuffer<int> | GpuBuffer<float> | GpuBuffer<bool>, b: GpuBuffer<t1>, kernel: (t0, t1) -> t2) -> GpuBuffer<t2>
Description: Combines two buffers elementwise with a pure binary kernel. The result takes the shorter operand's length.
Parameters
- a (GpuBuffer
| GpuBuffer | GpuBuffer ): The left buffer - b (GpuBuffer
): The right buffer - kernel ((t0, t1) -> t2): The pure (a, b) element function
Returns: GpuBuffer
Example
gpuZipWith(xs, ys, fn(x, y) => (x * y) ?: 0) // elementwise product
gpuZipWith (xs, ys, \(x, y) => (x * y) ?: 0) // elementwise product