Documentation ¶
Index ¶
- func Integrate(lower, upper float64, dividers ...[]float64) func(*Data) (float64, error)
- func MatrixCombine(f func(a, b, dest *Data), a, b, dest *Matrix)
- func Mean(dividers ...[]float64) func(*Data) (float64, error)
- func Quantile(nquant float64, dividers ...[]float64) func(*Data) (float64, error)
- func StatFunc(f func(x, w []float64) float64, dividers ...[]float64) func(*Data) (float64, error)
- func StdDev(dividers ...[]float64) func(*Data) (float64, error)
- type Data
- func (D *Data) Add(a, b *Data)
- func (M *Data) AddData(point ...float64)
- func (D *Data) Copy(dest ...[]float64) []float64
- func (D *Data) CopyDividers(dest ...[]float64) []float64
- func (D *Data) ID() int
- func (D *Data) MarshalJSON() ([]byte, error)
- func (D *Data) Normalize()
- func (D *Data) Normalized() bool
- func (D *Data) ReHisto(dividers, rawdata []float64)
- func (D *Data) String() string
- func (D *Data) Sub(a, b *Data, abs ...bool)
- func (D *Data) Sum() float64
- func (D *Data) UnNormalize()
- func (D *Data) UnmarshalJSON(b []byte) error
- func (D *Data) View() []float64
- type Matrix
- func (M *Matrix) AddData(r, c int, point ...float64)
- func (M *Matrix) AddDataCS(r, c int, point ...float64)
- func (M *Matrix) Check(r, c int, pan ...bool) error
- func (M *Matrix) CopyDividers(dest ...[]float64) []float64
- func (M *Matrix) Dims() (int, int)
- func (M *Matrix) Fill()
- func (M *Matrix) FromAll(f func(D *Data) (float64, error)) ([][]float64, error)
- func (M *Matrix) MarshalJSON() ([]byte, error)
- func (M *Matrix) NewHisto(r, c int, dividers []float64, rawdata []float64, ID ...int)
- func (M *Matrix) NormalizeAll()
- func (M *Matrix) String() string
- func (M *Matrix) ToAll(f func(D *Data) error) error
- func (M *Matrix) UnNormalizeAll()
- func (M *Matrix) UnmarshalJSON(b []byte) error
- func (M *Matrix) View(r, c int) *Data
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MatrixCombine ¶
Combines 2 matrices element-wise using the function f, which should take 2 histograms to be combined and one more where the result of the operation is stored.
Types ¶
type Data ¶
type Data struct {
// contains filtered or unexported fields
}
func NewData ¶
Returns a new histogram from the dividers and rawdata given rawdata can be nil. In that case, an empty histogram is created. if an ID for the histogram is given, it will be set. If not, the ID will be set to -1.
func (*Data) CopyDividers ¶
Copies the dividers of the histogram
func (*Data) MarshalJSON ¶
func (*Data) Normalized ¶
Normalized Returns true if the histogram is normalized
func (*Data) String ¶
String prints a -hopefully- pretty string representation of the histogram. The representation uses 3 lines of thext
func (*Data) Sub ¶
Sub substract the histograms a and b puting the results in the receiver if abs is given and true (only the first element is considered)
func (*Data) UnmarshalJSON ¶
type Matrix ¶
type Matrix struct {
// contains filtered or unexported fields
}
A matrix of histograms
func NewMatrix ¶
NewMatrix returns a new matrix of *Data with r and c rows and column and dividers dividers. Dividers can be nil, in which case, elements of the matrix will not be forced to have the same dividers
func (*Matrix) AddData ¶
Adds one or more data points to the histogram in the r,c position in the matrix
func (*Matrix) AddDataCS ¶
Adds one or more data points to the histogram in the r,c position in the matrix it is concurrent safe
func (*Matrix) Check ¶
Check checks if the given row and column indexes are within range. if pan is given and true, it panics if either is out of range, otherwise, it returns an error.
func (*Matrix) CopyDividers ¶
Copies the dividers of the histogram
func (*Matrix) Fill ¶
func (M *Matrix) Fill()
Fill fills the matrix with empty histograms If the matrix has a non-nil delimiters slice, that slice is used for all the histograms created
func (*Matrix) FromAll ¶
Applies the f function to each element in the matrix, the results are returned as a [][]float64. Also returns error unpon failure, or nil.
func (*Matrix) MarshalJSON ¶
func (*Matrix) NewHisto ¶
NewHisto Puts a new histogram in the r,c position in the matrix. Dividers can be nil, in which case, the matrix should have its dividers. If there are no dividers, or they don't match, the function will panic. rawdata can also be nil, in which case, an empty histogram will be put in the position.
func (*Matrix) NormalizeAll ¶
func (M *Matrix) NormalizeAll()
Normalize all the histograms in the matrix
func (*Matrix) ToAll ¶
Applies the f function to each element in the matrix. Returns error unpon failure, or nil.
func (*Matrix) UnNormalizeAll ¶
func (M *Matrix) UnNormalizeAll()
Un-normalize all the histograms in the matrix