Element-wise Multiply

L1 · Math
multiply · 1 specification · 5 implementations · 6 benchmarks
WHAT IT ISThe element-wise product of two length-N vectors: c_i = a_i * b_i.
ARITHMETICVECTORREFERENCECPU
SIGNATURE
kernel multiply<type T: Numeric, N: u32>(
%a: tensor<N x T>,
%b: tensor<N x T>,
) -> %c: tensor<N x T>
Sizes and element types are left open here. A specification fixes them; an implementation says over which of them it works.
SPECIFICATIONS1publishedIMPLEMENTATIONS54 measured
BENCHMARKS6across 2 machines
FASTEST3.71 µsN70 on fairmath-general-runner
CHALLENGES0none opened
DESCRIPTION

Definition

Given a,bRNa, b \in R^N over a ring RR, compute cRNc \in R^N with

ci;=;aibi,0i<N.c_i ;=; a_i \cdot b_i, \qquad 0 \le i < N .

Each output element depends on exactly one element of each input. There is no summation and no interaction between positions: this is neither an inner product (iaibi\sum_i a_i b_i) nor a convolution (position kk of a convolution sums over i+j=ki + j = k). Both are separate kernels.

Complexity

NN ring multiplications, 2N2N reads, NN writes. No algorithm improves on this bound. Performance differences between implementations at a fixed point reflect memory traffic and vectorisation, not arithmetic.

Role in the catalogue

The correct answer is inexpensive to compute independently, so the kernel is also used to validate the measurement pipeline itself — generator, oracle, verifier and runner.

MAINTAINER
FM
fairmathreviews specifications · resolves disputes
USED BY · 0 KERNELS
Kernels above this one. If this kernel is wrong, or slow, they are wrong or slow with it.Nothing depends on this kernel yet.
BUILDS ON · 0 KERNELS
Kernels this one is stated in terms of. Not a call graph — a statement of dependence between problems.Nothing. This kernel sits at the bottom of the graph.
RECENT ACTIVITYNothing yet.