Question

I am solving systems of equations using Armadillo. I make a matrix from one array of doubles, specifying the rows and columns. The problem is that it doesn't read it the way I make the array, (it's a vector but then converted to an array) so I need to manipulate the vector.

To be clear, it takes a vector with these values:

2 0 0 0 2 1 1 1 0 1 1 0 3 0 0 1 1 1 1 0 0 1 0 1 2

And it makes this matrix: 2 1 1 1 0 0 1 0 1 1 0 1 3 1 0 0 0 0 1 1 2 1 0 0 2

But I want this matrix: 2 0 0 0 2 1 1 1 0 1 1 0 3 0 0 1 1 1 1 0 0 1 0 1 2

How do I manipulate my vector to make it like this?

Was it helpful?

Solution

I feel as if you are looking for a transposition of a matrix. There is relevant documentation here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top