4
$\begingroup$

What is a clear and concise notation for the element wise multiplication (Hadamard product) of a column vector $v$ and each column of a matrix $F$.

What I want to achieve it this: $$ v\odot F= \begin{bmatrix} v_1\\ v_2 \\ v_3 \end{bmatrix} \odot \begin{bmatrix} f_{1,1} & f_{1,2} & f_{1,3}\\ f_{2,1} & f_{2,2} & f_{2,3}\\ f_{3,1} & f_{3,2} & f_{3,3} \end{bmatrix} = \begin{bmatrix} v_1f_{1,1} & v_1f_{1,2} & v_1f_{1,3}\\ v_2f_{2,1} & v_2f_{2,2} & v_2f_{2,3}\\ v_3f_{3,1} & v_3f_{3,2} & v_3f_{3,3} \end{bmatrix} $$

My question is essentially the same as this one, but I don't think the answer there actually answers the question and I don't have enough reputation to comment.

$\endgroup$
2
  • $\begingroup$ Denote the all-ones vector by ${\tt1}$ and use the Hadamard product $\;v{\tt1}^T\odot F\;$ $\endgroup$
    – greg
    Apr 23, 2020 at 3:02
  • $\begingroup$ @greg I like this solution. If you post it as an answer I will mark it as accepted. $\endgroup$
    – avs
    Jun 8, 2020 at 17:44

2 Answers 2

3
$\begingroup$

The elementwise/Hadamard product $(\circ)$ and the all-ones vector ${\tt1}$ can be used to write your product as $$v\odot F = v{\tt1}^T\circ F$$ You can also write it using a diagonal matrix and the regular matrix product as $$v\odot F = \operatorname{Diag}(v)\,F$$ as suggested in John's answer.

This is actually a special case of a more general rule, i.e. $$ab^T\circ F = \operatorname{Diag}(a)\,F\,\operatorname{Diag}(b)$$

$\endgroup$
4
  • $\begingroup$ Thank you. I see that both $\odot$ and $\circ$ are used to denote the Hadamard product. Do you have any suggestion for another symbol that I can use for $v\ ?\ F$? $\endgroup$
    – avs
    Jun 10, 2020 at 8:35
  • $\begingroup$ The LaTeX symbol \star has no standard usage in matrix algebra, so perhaps $v\star F$ $\endgroup$
    – greg
    Jun 10, 2020 at 11:08
  • $\begingroup$ The diag notation does not seem to carry to situations where $F$ is not square, does it? ($F$ and $v$ only need to agree in the number of lines.) $\endgroup$
    – Arthur
    Jun 24, 2022 at 10:49
  • $\begingroup$ I might just be confused with the fact that $b$ does not have to be the same dimension as $a$. sorry if I was mistaken... $\endgroup$
    – Arthur
    Jun 24, 2022 at 10:50
1
$\begingroup$

I would tend to write this as $$ P = diag(v) F $$ having first defined $$ diag: \Bbb R^n \to M_{nn}$$ as clearly as possible.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .