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

Method TensorFloat1D

tensor/table/table.go:546–563  ·  view source on GitHub ↗

TensorFloat1D returns the float value of a Tensor cell's cell at given 1D offset within cell, for given column (by name), row index for columns that have higher-dimensional tensors so each row is represented by an n-1 dimensional tensor, with the outer dimension being the row number. Returns 0 on a

(column string, row int, idx int)

Source from the content-addressed store, hash-verified

544// being the row number. Returns 0 on any error -- see Try version for
545// error returns.
546func (dt *Table) TensorFloat1D(column string, row int, idx int) float64 {
547 if !dt.IsValidRow(row) {
548 return 0
549 }
550 ct := dt.ColumnByName(column)
551 if ct == nil {
552 return 0
553 }
554 if ct.NumDims() == 1 {
555 return 0
556 }
557 _, sz := ct.RowCellSize()
558 if idx >= sz || idx < 0 {
559 return 0
560 }
561 off := row*sz + idx
562 return ct.Float1D(off)
563}
564
565/////////////////////////////////////////////////////////////////////////////////////
566// Set

Callers

nothing calls this directly

Implementers 1

_cogentcore_org_core_plot_plots_Tableyaegicore/symbols/cogentcore_org-core-

Calls 5

IsValidRowMethod · 0.95
ColumnByNameMethod · 0.95
NumDimsMethod · 0.65
RowCellSizeMethod · 0.65
Float1DMethod · 0.65

Tested by

no test coverage detected