1

Suppose I have a matrix $A$ with entries $A_{ij}$ and a vector $u$ with entries $u_i$, and that I want to express matrix $C$ with entries $C_{ij} = A_{ij}u_i$ as a product of matrices or vectors and matrices.

Example:

$A=\begin{bmatrix}a_{11}&a_{12}\\a_{21}&a_{22}\end{bmatrix}$ $u=\begin{bmatrix}u_{1}\\u_{2}\end{bmatrix}$

$C=\begin{bmatrix}u_{1}a_{11}&u_{1}a_{12}\\u_{2}a_{21}&u_{2}a_{22}\end{bmatrix}$

Is there a standard notation similar to that of the Hadamard product ⊙ to write this?

If not, is there a standard notation to express that a diagonal matrix M is generated using the entries of vector $u$ as the values for the diagonal, like the MATLAB and Numpy diag(u) function

$M=\begin{bmatrix}u_{1}& 0\\0&u_{2}\end{bmatrix}$

so that I can do $C = MA$?

nayriz
  • 281

2 Answers2

2

If you denote the all-ones vector by ${\tt1}$ then you can use the Hadamard product to write the matrix as $$C = A\odot u{\tt1}^T$$ The notation you suggested is also fairly common, i.e. $$\eqalign{M &= \operatorname{Diag}(u)\\C &= MA}$$

greg
  • 35,825
1

Actually I suggest to be more clear in what you mean by "multiplying a matrix $A$ by a vector $u$". The product will be a vector! Not a matrix!

Remember that, given a field $K$, an object $A\in K^{m\times n}$ can be multiplied canonically only by a column vector $u \in K^{n\times 1}$ and the product $Au \in K^{m\times 1}$.

In any case, if I correctly uderstood your question, you're looking for an operator that extends this notation. Then I suggest you to look to two notations:

  1. Einstein Notation for the repeated indices: When you are for example in $\mathbb{R}^{3}$, you will have that the indices can range over the set $i={1, 2, 3}$, $$y=\sum_{i=1}^{3}c_{i}x^{i}=c_{1}x^{1}+c_{2}x^{2}+c_{3}x^{3}$$ is simplified by the convention to: $$y=c_{i}x^{i}$$ The upper indices are not exponents but are indices of coordinates, coefficients or basis vectors.
  2. Tensor Product (generalization of Matric product in higher dimension) denoted by $\otimes$ , from ordered pairs in the Cartesian product $V\times W$ into $V\otimes W$, in a way that generalizes the outer product.
  • I don't know how I could be clearer, I expressed exactly what the entries of C should be given the entries of A and u...

    I also said it was somewhat of an element wise multiplication, and I mentioned the Hadamard product to give an idea of what I mean.

    – nayriz Jun 16 '17 at 16:46
  • Do you remember that $C$ is a vector and Not a Matrix? Using two sub indices does not make any sense! Otherwise, if you want to denote the $i$-th element of $C$ and you want to express it as the combination of the element of $A$ and $u$, it can be easily done with the Einstein notation. For example $C_i = A_{ij}u^j$ – Erik Pillon Jun 16 '17 at 16:53
  • C is a matrix, please see edits. – nayriz Jun 16 '17 at 16:59
  • @nayriz I bag your pardon... actually I think that the notation you wrote is the most used – Erik Pillon Jun 16 '17 at 17:06
  • No problem! How about a notation to use a vector to create a diagonal matrix? That'd do the trick... – nayriz Jun 16 '17 at 17:08
  • In my experience, I always have seen the operator $diag$, used in the way you mean, i.e., $diag (A)$ is the diagonal matrix that has the diagonal elements of A as diagonal – Erik Pillon Jun 16 '17 at 18:18