dotMultiply

x .* y

dotMultiply(x, y)

Try it yourself:

See also:

dotMultiply(): Element-Wise Products

dotMultiply() multiplies corresponding entries of compatible arrays or matrices. dotMultiply([2, 3], [4, 5]) returns [8, 15]. It is ideal for applying per-item weights, masks, conversion factors, or gains.

Not matrix multiplication

This operation keeps matching positions independent. It differs from multiply(), where matrix multiplication combines rows and columns, and from dot(), which reduces two vectors to one scalar. Check array shapes first with size().

Element-wise multiplication is often paired with dotDivide() for normalization and with sum() for weighted totals. Make unit effects explicit: multiplying a quantity by a dimensionless weight differs from multiplying two physical measurements.

Practical example

Multiply a sales vector by a per-product commission vector, then sum the result. This keeps the calculation transparent and avoids accidental matrix-product semantics.

Try Dot Multiply in Calcul.io

Start with one of the editable examples above, then replace its arguments with your own values. Keeping the function on a separate calculator line makes the input and result easy to compare. For a longer workflow, assign the result to a variable or reference that line in the next expression.

Check the shown signature before adding optional arguments, and use the related-function links to compare operations with similar purposes.

All functions