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

Method trace

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

Source from the content-addressed store, hash-verified

81}
82
83func (A *Matrix) trace() float64 {
84 var tr float64 = 0
85 for i := 0; i < A.cols; i++ {
86 tr += A.GetElm(i, i)
87 }
88 return tr
89}
90
91func (A *Matrix) add(B *Matrix) error {
92 if A.cols != B.cols && A.rows != B.rows {

Callers 1

TestTraceFunction · 0.80

Calls 1

GetElmMethod · 0.95

Tested by 1

TestTraceFunction · 0.64