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

Method copy

data-structures/matrix/matrix.go:67–81  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

65}
66
67func (A *Matrix) copy() *Matrix {
68 B := new(Matrix)
69 B.rows = A.rows
70 B.cols = A.cols
71 B.step = A.step
72
73 B.Elements = make([]float64, A.cols*A.rows)
74
75 for i := 0; i < A.rows; i++ {
76 for j := 0; j < A.cols; j++ {
77 B.Elements[i*A.step+j] = A.GetElm(i, j)
78 }
79 }
80 return B
81}
82
83func (A *Matrix) trace() float64 {
84 var tr float64 = 0

Callers

nothing calls this directly

Calls 1

GetElmMethod · 0.95

Tested by

no test coverage detected