MCPcopy Create free account
hub / github.com/cogentcore/core / CopyDense

Function CopyDense

tensor/tensor.go:216–227  ·  view source on GitHub ↗

CopyDense copies a gonum mat.Dense matrix into given Tensor using standard Float64 interface

(to Tensor, dm *mat.Dense)

Source from the content-addressed store, hash-verified

214// CopyDense copies a gonum mat.Dense matrix into given Tensor
215// using standard Float64 interface
216func CopyDense(to Tensor, dm *mat.Dense) {
217 nr, nc := dm.Dims()
218 to.SetShape([]int{nr, nc})
219 idx := 0
220 for ri := 0; ri < nr; ri++ {
221 for ci := 0; ci < nc; ci++ {
222 v := dm.At(ri, ci)
223 to.SetFloat1D(idx, v)
224 idx++
225 }
226 }
227}

Callers 2

PCAMethod · 0.92
SVDMethod · 0.92

Calls 4

SetShapeMethod · 0.65
SetFloat1DMethod · 0.65
DimsMethod · 0.45
AtMethod · 0.45

Tested by

no test coverage detected