How would look the code that can transform an upper triangular matrix into a full matrix.
The matrix is in a vector, not in a bidimensional array…
so the array
[ 1 2 3 4
0 5 6 7
0 0 8 9
0 0 0 10 ]
would become an array like:
[ 1 2 3 4
2 5 6 7
3 6 8 9
4 7 9 10 ]
could you provide some ideas, I was thinking in applying a kind of module or something…
There is one restriction, I am not using bidimensional arrays
I am usng a vector, so is a unidimensional array
First, you must understand the fundemtnal nature of a reflected matrix. For any
i,j, the following assertion is true:So, you need some algorithm to make that true. May I suggest:
Note the condition of the 2nd loop. By ensuring that
jis always less thani, we restrict our activity to the bottom-left triangle.Next, you must understand how you have implemented a two-dimensional matrix in a one-dimensional array. It appears that you have established the identity:
Substituting, we have: