MCPcopy
hub / github.com/arnauddri/algorithms / Substract

Function Substract

data-structures/matrix/matrix.go:137–147  ·  view source on GitHub ↗
(A *Matrix, B *Matrix)

Source from the content-addressed store, hash-verified

135}
136
137func Substract(A *Matrix, B *Matrix) *Matrix {
138 result := MakeMatrix(make([]float64, A.cols*A.rows), A.cols, A.rows)
139
140 for i := 0; i < A.rows; i++ {
141 for j := 0; j < A.cols; j++ {
142 result.SetElm(i, j, A.GetElm(i, j)-B.GetElm(i, j))
143 }
144 }
145
146 return result
147}
148
149func Multiply(A *Matrix, B *Matrix) *Matrix {
150 result := MakeMatrix(make([]float64, A.cols*A.rows), A.cols, A.rows)

Callers

nothing calls this directly

Calls 3

MakeMatrixFunction · 0.85
SetElmMethod · 0.80
GetElmMethod · 0.80

Tested by

no test coverage detected