Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Row Column Value
- i j Vij
- file=Import["matrix.dat"]
- (* Dimension of square matrix *)
- dimKall=6000;
- s = SparseArray[{file[[i_, 1]],file[[i_, 2]]} -> file[[i_, 3]], {dimKall,dimKall}]
- 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}};
- m = SparseArray[{#, #2} -> #3 & @@@ file, {DimKall, DimKall}];
- M = m + m[Transpose] - DiagonalMatrix @ Diagonal @ m;
- MatrixForm @ M
Add Comment
Please, Sign In to add comment