Skip to content
Advertisement

How to convert lower triangular matrix into a vector?

I want to convert my triangular matrix into a vector.

Let’s say I have 7×7 lower triangular matrix. Something like this:

JavaScript

And I need to convert this matrix into a vector ignoring zeros. So, the result should be:

JavaScript

I have already made a matrix by the following code:

JavaScript

But I don’t really get how to convert that into a vector. Can you please explain me how?

Advertisement

Answer

Just filter out the 0 values as below

JavaScript

And the result array will be you desired answer, by the way the concept of transforming the rank 2 tensors to vector is quit useful, with this approach you can transfer the rank 4 tensors (supper-operators) to tensor rank 2 (matrix) then study their behaviour in the new vector space .

Validate final result as

JavaScript

example

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement