0
$\begingroup$

I have two matrices $A$ and $B$. $A$ is a diagonal matrix and $B$ is not.

e.g.

$A = \begin{bmatrix} a_{11} &0 \\ 0 & a_{22} \end{bmatrix}$ and $B = \begin{bmatrix} b_{11} &b_{12} \\ b_{21} & b_{22} \end{bmatrix}$

I want to obtain $a_{11}\sqrt{b_{11}} + a_{22}\sqrt{b_{22}}$ by applying some matrix operations to $A$ and $B$. How can I do that? Thanks!

  • 1
    Define "operations".2017-01-05
  • 0
    Values of b and c can be any?2017-01-05
  • 0
    Operations mean any matrix operations which can be applied to $A$.2017-01-05
  • 0
    Values of $b$ and $c$ can be any.2017-01-05

1 Answers 1

0

Since your definition of operations is so vague, I'll use two operations which are present in many scientific computing packages (e.g. Matlab/Numpy/etc.):

  • diag (A) : get the diagonal of matrix $A$ as a vector

  • sqrt(B) : do an entry-wise square root of $B$ (which can be scalar/vector/matrix).

  • dot(A,B) : this is the dot product (you can also write this as a vector transpose * vector multiply)

Then, all you need is sqrt(diag(A)) to get a vector containing the square root of the diagonal entries of $A$.

Now, to get the example, you simply do dot(diag(A),sqrt(diag(B)))

  • 0
    Thanks for your answer. I think my writing was not clear. I've just edited my question.2017-01-05
  • 0
    Ok, Updated. The idea is basically the same.2017-01-05