Guest User

Untitled

a guest
Mar 24th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. Row Column Value
  2. i j Vij
  3.  
  4. file=Import["matrix.dat"]
  5. (* Dimension of square matrix *)
  6. dimKall=6000;
  7. s = SparseArray[{file[[i_, 1]],file[[i_, 2]]} -> file[[i_, 3]], {dimKall,dimKall}]
  8.  
  9. file = {{1, 1, 2}, {2, 2, 4}, {3, 3, 7}, {4, 4, 8}, {4, 1, 2}, {3, 2,
  10. 10}};
  11. DimKall = 4
  12. s = {{2, 0, 0, 2}, {0, 4, 10, 0}, {0, 10, 7, 0}, {2, 0, 0, 8}};
  13.  
  14. m = SparseArray[{#, #2} -> #3 & @@@ file, {DimKall, DimKall}];
  15.  
  16. M = m + m[Transpose] - DiagonalMatrix @ Diagonal @ m;
  17.  
  18. MatrixForm @ M
Add Comment
Please, Sign In to add comment