I have a file formatted in this way:
Row Column Value
i j Vij
i
= INT Number row where in sparse matrix I want the double number Vij
j
= INT Number column where in sparse matrix I want the double number Vij
In summary element of sparse matrix {i,j}->Vij
In this file is stored the bottom triangular of large " Lower Triangular SPARSE matrix".
I wish build a sparse Matrix from this file. Moreover, my final SPARSE matrix must be symmetric such that Vij=Vji. Once I imported the file, how di I make my sparse matrix? The command in mathematica is "SparseArray[]", if yes how can I use it ?
I need to make a sparse matrix in mathematica because if I build a classic matrix, the matrix have need a lot of RAM memory and I have a problem of memory overflow.
I try to achieve my goal in this way, but not working:
file=Import["matrix.dat"]
(* Dimension of square matrix *)
dimKall=6000;
s = SparseArray[{file[[i_, 1]],file[[i_, 2]]} -> file[[i_, 3]], {dimKall,dimKall}]
This is a small example of what I want to achieve:
file = {{1, 1, 2}, {2, 2, 4}, {3, 3, 7}, {4, 4, 8}, {4, 1, 2}, {3, 2,
10}};
DimKall = 4
s = {{2, 0, 0, 2}, {0, 4, 10, 0}, {0, 10, 7, 0}, {2, 0, 0, 8}};
thx