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

Function Multiply

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

Source from the content-addressed store, hash-verified

147}
148
149func Multiply(A *Matrix, B *Matrix) *Matrix {
150 result := MakeMatrix(make([]float64, A.cols*A.rows), A.cols, A.rows)
151
152 for i := 0; i < A.rows; i++ {
153 for j := 0; j < A.cols; j++ {
154 sum := float64(0)
155 for k := 0; k < A.cols; k++ {
156 sum += A.GetElm(i, k) * B.GetElm(k, j)
157 }
158 result.SetElm(i, j, sum)
159 }
160 }
161
162 return result
163}

Callers

nothing calls this directly

Calls 3

MakeMatrixFunction · 0.85
GetElmMethod · 0.80
SetElmMethod · 0.80

Tested by

no test coverage detected