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

Function F64Table

tensor/stats/histogram/histogram.go:44–56  ·  view source on GitHub ↗

F64Table generates an table with a histogram of counts of values within given number of bins and min / max range. The table has columns: Value, Count if value is < min or > max it is ignored. The Value column represents the min value for each bin, with the max being the value of the next bin, or the

(dt *table.Table, vals []float64, nBins int, min, max float64)

Source from the content-addressed store, hash-verified

42// The Value column represents the min value for each bin, with the max being
43// the value of the next bin, or the max if at the end.
44func F64Table(dt *table.Table, vals []float64, nBins int, min, max float64) {
45 dt.DeleteAll()
46 dt.AddFloat64Column("Value")
47 dt.AddFloat64Column("Count")
48 dt.SetNumRows(nBins)
49 ct := dt.Columns[1].(*tensor.Float64)
50 F64(&ct.Values, vals, nBins, min, max)
51 inc := (max - min) / float64(nBins)
52 vls := dt.Columns[0].(*tensor.Float64).Values
53 for i := 0; i < nBins; i++ {
54 vls[i] = math32.Truncate64(min+float64(i)*inc, 4)
55 }
56}
57
58//////////////////////////////////////////////////////
59// float32

Callers 1

TestHistogram64Function · 0.85

Calls 5

Truncate64Function · 0.92
AddFloat64ColumnMethod · 0.80
F64Function · 0.70
SetNumRowsMethod · 0.65
DeleteAllMethod · 0.45

Tested by 1

TestHistogram64Function · 0.68