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

Method CopyCellsFrom

tensor/string.go:245–255  ·  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

243// values to copy. Uses an optimized implementation if the other tensor is
244// of the same type, and otherwise it goes through appropriate standard type.
245func (tsr *String) CopyCellsFrom(frm Tensor, to, start, n int) {
246 if fsm, ok := frm.(*String); ok {
247 for i := 0; i < n; i++ {
248 tsr.Values[to+i] = fsm.Values[start+i]
249 }
250 return
251 }
252 for i := 0; i < n; i++ {
253 tsr.Values[to+i] = Float64ToString(frm.Float1D(start + i))
254 }
255}
256
257// SubSpace returns a new tensor with innermost subspace at given
258// offset(s) in outermost dimension(s) (len(offs) < NumDims).

Callers

nothing calls this directly

Calls 2

Float64ToStringFunction · 0.85
Float1DMethod · 0.65

Tested by

no test coverage detected