fork download
  1. package main
  2. import "fmt"
  3.  
  4. func main(){
  5. var Z = [][]int{{1,2,3},{4,5,6},{7,8,9}}
  6. fmt.Println(Z)
  7. T := [][]int{{1,3,5},{7,9,11},{13,25,17}}
  8. N := [][]int{{0,0,0},{0,0,0},{0,0,0}}
  9. fmt.Println(T)
  10. fmt.Println(N)
  11. O :=[][]int{{1,1,1},{1,1,1},{1,1,1}}
  12. W :=[][]int{{0,0,0},{0,0,0},{0,0,0}}
  13.  
  14.  
  15. fmt.Println(Z)
  16.  
  17.  
  18.  
  19.  
  20.  
  21. fmt.Println(N)
  22. fmt.Println("louie")
  23. for i:=0; i<3;i++{
  24. for j:=0; j<3;j++{
  25. for k:=0; k<3;k++{
  26. N[i][j] += Z[i][k] * T[k][j]
  27. W[i][j] += T[i][k] * O[i][j]
  28. fmt.Println("",N[i][j])
  29. }
  30. }
  31. }
  32. fmt.Println(Z)
  33. fmt.Println(T)
  34. fmt.Println(N)
  35. fmt.Println(W)
  36. fmt.Println(O)
  37.  
  38.  
  39. }
Success #stdin #stdout 0s 4312KB
stdin
Standard input is empty
stdout
[[1 2 3] [4 5 6] [7 8 9]]
[[1 3 5] [7 9 11] [13 25 17]]
[[0 0 0] [0 0 0] [0 0 0]]
[[1 2 3] [4 5 6] [7 8 9]]
[[0 0 0] [0 0 0] [0 0 0]]
louie
 1
 15
 54
 3
 21
 96
 5
 27
 78
 4
 39
 117
 12
 57
 207
 20
 75
 177
 7
 63
 180
 21
 93
 318
 35
 123
 276
[[1 2 3] [4 5 6] [7 8 9]]
[[1 3 5] [7 9 11] [13 25 17]]
[[54 96 78] [117 207 177] [180 318 276]]
[[9 9 9] [27 27 27] [55 55 55]]
[[1 1 1] [1 1 1] [1 1 1]]