Element-wise (or pointwise) operations notation?

230.1k Views Asked by At

Is there a notation for element-wise (or pointwise) operations?

For example, take the element-wise product of two vectors x and y (in Matlab, x .* y, in numpy x*y), producing a new vector of same length z, where $z_i = x_i * y_i$ .

In mathematical notation, there doesn't seem to be a standard for this, am I wrong?

There is $x \cdot y$, the dot product. There is $x*y$, which is usually considered the cross product. I need to find a notation for element-wise multiplication. I was aiming at maybe using the . as is done in Matlab, but it looks a little off :

$z = x .* y$

What do you think?

2

There are 2 best solutions below

2
On

If you need to do this, generally a good idea is to write your "vectors" as functions $I \to \mathbb{R}$ (or whatever) where $I$ is your index set, and then say that $fg(i) = f(i) g(i)$ is the pointwise product. Mathematicians don't have a special notation for this because

  • nobody takes the pointwise product of vectors (in the geometric sense) because it's not invariant under change of coordinates, and
  • if you are taking the pointwise product of functions then it is generally clear that you are doing this from context (e.g. if $f, g$ are continuous functions $X \to \mathbb{R}$ where $X$ is a topological space).

If you are working in a context where both dot products and pointwise products make sense, the answer is to change your notation for dot products to something like $\langle f, g \rangle$.

0
On

Element-wise product of matrices is known as the Hadamard product, and can be notated as $A \circ B$.

Some basic properties of the Hadamard Product are described in this section from an open source linear algebra text. Wikipedia also mentions it in the article on Matrix Multiplication, with an alternate name as the Schur product.

As for the significance of element-wise multiplications (in signal processing), we encounter them frequently for time-windowing operations, as well as pointwise multiplying in the DFT spectrum which is equivalent to convolution in time.

I wouldn't say this notation has completely caught on, in many cases $A \cdot B$ is used (like in the statement of the convolution theorem above.

Searching for Hadamard Product on Math.SE will get you some other examples. (sorry, couldn't add as many links as I planned.)