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

Method CopyCellsFrom

tensor/bits.go:288–298  ·  view source on GitHub ↗

CopyCellsFrom copies given range of values from other tensor into this tensor, using flat 1D indexes: to = starting index in this Tensor to start copying into, start = starting index on from Tensor to start copying from, and n = number of values to copy. Uses an optimized implementation if the othe

(frm Tensor, to, start, n int)

Source from the content-addressed store, hash-verified

286// values to copy. Uses an optimized implementation if the other tensor is
287// of the same type, and otherwise it goes through appropriate standard type.
288func (tsr *Bits) CopyCellsFrom(frm Tensor, to, start, n int) {
289 if fsm, ok := frm.(*Bits); ok {
290 for i := 0; i < n; i++ {
291 tsr.Values.Set(to+i, fsm.Values.Index(start+i))
292 }
293 return
294 }
295 for i := 0; i < n; i++ {
296 tsr.Values.Set(to+i, Float64ToBool(frm.Float1D(start+i)))
297 }
298}
299
300// Dims is the gonum/mat.Matrix interface method for returning the dimensionality of the
301// 2D Matrix. Not supported for Bits -- do not call!

Callers

nothing calls this directly

Calls 4

Float64ToBoolFunction · 0.85
SetMethod · 0.65
Float1DMethod · 0.65
IndexMethod · 0.45

Tested by

no test coverage detected