I want to store in an array a symmetric matrix
for a matrix I was doing this
double[,] mat = new double[size,size];
for (int i = 0; i < s
If n is the size of the square matrix, you need n * (n + 1) / 2 total values for a symmetric matrix. This is the sum of 1 + 2 + 3 + ... (n - 2) + (n - 1) + n.
A word of caution, though, it's going to be a big pain to be always trying to calculate the correct index for a given row and column, and I'd only move away from the more intuitive 2D array if the matrices are going to be large, and memory is going to be an issue.