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?

有帮助吗?

解决方案

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top