I want to make a program to do simple matrix calculations with the elements from a text file. that part is simple and i can handle. i want this program to be highly optimised in terms of memory etc when catering for huge matrices like 50X50 matrices perhaps. so what i thought about was to store the element value and its coordinates instead of storing the entire matrix which often contains many zeros.

so for example if i had the matrix

2 0 6

0 1 0

0 0 5

what i would really store here is (2, 0, 0) which represents the element 2, stored in row 0, column 0. and so on for the rest. so what i need help with is finding the best way to store that data perhaps using struc. also i dont know much about struc or classes. i am reading the msdn but still confused.

any ideas?