2
$\begingroup$

Given an $n \times m$ matrix $X$ and $m \times m$ matrix $A$, I would like to define the vector $y$ as

$$y_i = X_{i,*} A (X_{i,*})^T$$

where $X_{i,*}$ is the $i$th row of $X$. Is there a simpler way to write this without using the row index?

Edit: $y$ should indeed be a vector of length $n$ and not an $n \times m$ matrix as another answer has pointed out. I also made my matrix row notation less ambiguous.

Edit 2: Rephrased question to better reflect what I was looking for.

$\endgroup$
  • 1
    $\begingroup$ For $A_{i,*}^T$, it's unclear whether you take the row and then transpose it into a column, or whether you take the transpose of the matrix and then take the row. $\endgroup$ – GFauxPas Jul 2 '15 at 21:20
  • $\begingroup$ Thanks, just realized this. $A_{i,*}^T$ was meant to be $(A_{i,*})^T$ $\endgroup$ – JaredL Jul 2 '15 at 21:56
0
$\begingroup$

For $A^Ti,∗$, it's unclear whether you take the row and then transpose it into a column, or whether you take the transpose of the matrix and then take the row.

It can only be the first. If it were the second there would be a dimension mismatch if $n \neq m$

And $Y$ also cannot be a matrix if you are really doing what you are writing. If you multiply a vector by a matrix by a vector you can only have a scalar at the end. $Y$ can only be a vector of size $n$, and it is the diagonal of $XAX^T$

$\endgroup$
  • 1
    $\begingroup$ This is better off as a comment. My point was the notation was ambiguous, whether or not the context helps clarify. Note that the equation stated does not define $Y$ but rather $Y_{i,*}$. $\endgroup$ – GFauxPas Jul 2 '15 at 21:38
  • $\begingroup$ I would have commented if I had enough rep to do it. The equation is noting $Y_{i,*}$ as if it were a row of matrix $Y$ which it cannot be, the right side is a scalar $\endgroup$ – gsmafra Jul 2 '15 at 21:49
  • $\begingroup$ Thanks @gsmafra, you are correct about Y needing to be a vector. I was actually doing this with many different $m \times m$ matrices $A_{1 \dotsc k}$ and combining by columns to make a final $n \times k$ vector. I ended up confusing myself here. I have edited my post to correct this. $\endgroup$ – JaredL Jul 2 '15 at 22:02
  • $\begingroup$ Well then, I don't think you will get anything more simple than $\operatorname{diag}(XAX^T)$ $\endgroup$ – gsmafra Jul 2 '15 at 22:22
  • $\begingroup$ I agree, I think this best answers my question. Thank you! $\endgroup$ – JaredL Jul 2 '15 at 22:37
1
$\begingroup$

If $e_i$ is the $i$th standard basis vector (all zero but one at the $i$th position), then $e_i^\top X$ is the $i$th row of $X$.

$\endgroup$
  • $\begingroup$ Thanks. This is indeed a much nicer way of writing it, but it looks like I pretty much mangled this post. What I was actually looking for was a way to express this without using row indices at all. I have rephrased the question. $\endgroup$ – JaredL Jul 2 '15 at 22:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.