3

Suppose that I have a m x n matrix A and a m x 1 vector b. I want to describe the following computations with some LaTeX operator:

Form a matrix B repeating b for n times, then perform the Hadamard product between A and B.

Does exists an operator for such task? If not, can someone provide an elegant way to express the computation?

2 Answers 2

6

Not entirely sure if this is what you want, but I would write it like this:

\usepackage{amsmath}
... 
\begin{equation}
A \circ \vec{b} = (a_{ij}\cdot b_i) = 
\begin{pmatrix} 
a_{11} \cdot b_{1} & \cdots & a_{1n} \cdot b_{1} \\
\vdots & \ddots & \vdots \\ 
a_{m1} \cdot b_{m} & \cdots & a_{mn} \cdot b_{m} 
\end{pmatrix}
\end{equation}

result

\circ is the symbol I have seen used for Hadamard-product, you would be extending it's meaning for a Hadamard-product between Matrix and Vector. I'm not sure if this symbol is already used for some other operation between Matrix and Vector, but you could choose whatever symbol you want, or a function for that matter.

2
  • That was exactly what I was thinking to do, I just wanted to hear some other opinion, thanks!
    – aretor
    May 25, 2017 at 15:20
  • You're welcome. Depending on how formal you want to go, you might consider adding the definitions for A being m x n, b being m x 1 and the result being m x n. Although I consider this to be implicitly the case, so for a beamer presentation I wouldn't add these, but for a book I would.
    – clocktown
    May 25, 2017 at 15:23
1

You can left multiply $\mathbf{A}$ by the diagonal matrix whose main diagonal is $\mathbf{b}$, i.e.

$$\diag{\mathbf{b}}\mathbf{A}$$

You must log in to answer this question.

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