vec

package
v0.0.0-...-f96ffc0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2015 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package vector implements vector types for plotting and statistics.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs

func Abs(x float32) float32

Float32 utils

func Max

func Max(a, b float32) float32

func Min

func Min(a, b float32) float32

func Nicenum

func Nicenum(r32 float32, round bool) float32

nicenum returns a "nice" number approximately equal to r Rounds the number if round = true. Takes the ceiling if round = false.

Types

type Buffer

type Buffer struct {
	// contains filtered or unexported fields
}

Buffer type is a fixed size circular buffer.

func NewBuffer

func NewBuffer(size int) *Buffer

NewBuffer function creates a new buffer with allocated maximum size.

func (*Buffer) Len

func (b *Buffer) Len() int

Len method returns the number of items in the buffer.

func (*Buffer) Max

func (b *Buffer) Max() float32

Max method returns the maximum value.

func (*Buffer) Push

func (b *Buffer) Push(v float32)

Push method appends an item to the buffer.

type RunningStat

type RunningStat struct {
	Count, Mean float64
	Var, StdDev float64
	// contains filtered or unexported fields
}

Running mean and stddev as per http://www.johndcook.com/blog/standard_deviation/

func (*RunningStat) Clear

func (s *RunningStat) Clear()

func (*RunningStat) Push

func (s *RunningStat) Push(x32 float32)

func (*RunningStat) String

func (s *RunningStat) String() string

type Vector

type Vector struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Vector holds a slice of float32 values and errors. It implements the qml.XYer interface

func New

func New(defaultSize int) *Vector

New function creates a new empty vector with the given capacity and range

func (*Vector) BinWidth

func (v *Vector) BinWidth() float32

func (*Vector) Clear

func (v *Vector) Clear(reset bool) *Vector

Clear method empies the elements fom the vector after each run

func (*Vector) DataRange

func (v *Vector) DataRange() (xmin, ymin, xmax, ymax float32)

func (*Vector) Last

func (v *Vector) Last() float32

Last method returns the last entry from the vector

func (*Vector) Len

func (v *Vector) Len() int

func (*Vector) Push

func (v *Vector) Push(val, err float32)

Push method appends a new value

func (*Vector) Set

func (v *Vector) Set(xmin, xstep float32, values []float32)

Set method sets values from slice

func (*Vector) SetWidth

func (v *Vector) SetWidth(w float32) *Vector

func (*Vector) XY

func (v *Vector) XY(i int) (x, y float32)

func (*Vector) XYErr

func (v *Vector) XYErr(i int) (x, y, yerr float32)

Jump to

Keyboard shortcuts

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