(A *Matrix, B *Matrix)
| 123 | } |
| 124 | |
| 125 | func Add(A *Matrix, B *Matrix) *Matrix { |
| 126 | result := MakeMatrix(make([]float64, A.cols*A.rows), A.cols, A.rows) |
| 127 | |
| 128 | for i := 0; i < A.rows; i++ { |
| 129 | for j := 0; j < A.cols; j++ { |
| 130 | result.SetElm(i, j, A.GetElm(i, j)+B.GetElm(i, j)) |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | return result |
| 135 | } |
| 136 | |
| 137 | func Substract(A *Matrix, B *Matrix) *Matrix { |
| 138 | result := MakeMatrix(make([]float64, A.cols*A.rows), A.cols, A.rows) |
nothing calls this directly
no test coverage detected