variance

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 14, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type VarRing

type VarRing struct {
	// Typ is vector's value type
	Typ types.Type

	// attributes for computing the variance
	Data  []byte
	SumX  []float64 // sum of x, its memory address is same to Data, because we will use it to store result finally.
	SumX2 []float64 // sum of x^2

	NullCounts []int64 // group to record number of the null value
}

VarRing is the ring structure to compute the Overall variance we use E(x^2) - E(x)^2 to compute the result, so we need the average of x and sum of x ^ 2

func NewVarianceRing

func NewVarianceRing(typ types.Type) *VarRing

func NewVarianceRingWithTypeCheck

func NewVarianceRingWithTypeCheck(typ types.Type) (*VarRing, error)

func (*VarRing) Add

func (v *VarRing) Add(a interface{}, x, y int64)

Add merge ring2 group Y into ring1's group X

func (*VarRing) BatchAdd

func (v *VarRing) BatchAdd(a interface{}, start int64, os []uint8, vps []uint64)

func (*VarRing) BatchFill

func (v *VarRing) BatchFill(start int64, os []uint8, vps []uint64, zs []int64, vec *vector.Vector)

BatchFill use parts of vector to update the ring For each item o of os ring's group `vps[o]-1` is related to vector's row `start+o`

func (*VarRing) BulkFill

func (v *VarRing) BulkFill(i int64, zs []int64, vec *vector.Vector)

BulkFill use whole vector to update the ring's group i

func (*VarRing) Count

func (v *VarRing) Count() int

Count return group number of this ring.

func (*VarRing) Dup

func (v *VarRing) Dup() ring.Ring

Dup will make a new VarRing with the same type.

func (*VarRing) Eval

func (v *VarRing) Eval(zs []int64) *vector.Vector

Eval returns the variance result using result = E(x^2) - E(x)^2

func (*VarRing) Fill

func (v *VarRing) Fill(i, j int64, z int64, vec *vector.Vector)

Fill use row j of vector to update the ring's group i

func (*VarRing) Free

func (v *VarRing) Free(m *mheap.Mheap)

func (*VarRing) Grow

func (v *VarRing) Grow(m *mheap.Mheap) error

Grow adds a new group to the ring.

func (*VarRing) Grows

func (v *VarRing) Grows(N int, m *mheap.Mheap) error

Grows adds N new groups to the ring.

func (*VarRing) Mul

func (v *VarRing) Mul(a interface{}, x, y, z int64)

func (*VarRing) SetLength

func (v *VarRing) SetLength(n int)

func (*VarRing) Shrink

func (v *VarRing) Shrink(selectIndexes []int64)

func (*VarRing) Shuffle

func (v *VarRing) Shuffle(_ []int64, _ *mheap.Mheap) error

Shuffle is unused now and just implement it

func (*VarRing) Size

func (v *VarRing) Size() int

Size return size of memory which was allocated in memory pool by this ring.

func (*VarRing) String

func (v *VarRing) String() string

func (*VarRing) Type

func (v *VarRing) Type() types.Type

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL