Is it possible to extract the diagonal elements of a matrix into a vector?

Click For Summary
It is possible to extract the diagonal elements of a matrix into a vector using only matrix multiplication, without relying on element-wise operations or specific commands like diag. The process involves strategically using matrix multiplication to isolate each diagonal element into a 1x1 matrix and then expanding it into the appropriate position in a vector. This can be achieved through a series of matrix multiplies and additions. The implementation may require constructing larger matrices, potentially of dimensions N^2 or N^3, depending on the size of the original matrix. Overall, the method emphasizes creativity in utilizing matrix operations to achieve the desired outcome.
7Deuce
Messages
1
Reaction score
0
Is it possible to extract the diagonal elements of a matrix into a vector??

Is it possible to extract the diagonal elements of a matrix into a vector USING ONLY MATRIX MULTIPLICATION? So no element by element multiplication, and no diag commands.

(This will eventually be implemented in MATLAB, but I am required to only use matrix multiplication, so no commands)

Is it even possible?

Thanks in advance.
 
Physics news on Phys.org


You can do it with a sequence of matrix multiplies and adds.

Think about how to get one diagonal element into a 1x1 matrix, and then how to "expand" the 1x1 matrix into the right place in a vector. Repeat and add...

Possibly you combine all those steps part of a bigger matrix multiply operation (I'm speculating here) If the given matrix is order N, you might need matrices with dimensions of N2 or even N3...
 
I am studying the mathematical formalism behind non-commutative geometry approach to quantum gravity. I was reading about Hopf algebras and their Drinfeld twist with a specific example of the Moyal-Weyl twist defined as F=exp(-iλ/2θ^(μν)∂_μ⊗∂_ν) where λ is a constant parametar and θ antisymmetric constant tensor. {∂_μ} is the basis of the tangent vector space over the underlying spacetime Now, from my understanding the enveloping algebra which appears in the definition of the Hopf algebra...

Similar threads

  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 14 ·
Replies
14
Views
4K
  • · Replies 33 ·
2
Replies
33
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 9 ·
Replies
9
Views
2K