Documentation
¶
Index ¶
- Variables
- func AbsInt(value int) int
- func CirclePoint(cx, cy int, radius, thetaRadians float64) (x, y int)
- func DegreesAdd(baseDegrees, deltaDegrees float64) float64
- func DegreesToCompass(deg float64) float64
- func DegreesToRadians(degrees float64) float64
- func MaxInt(values ...int) int
- func Mean(values ...float64) float64
- func MeanInt(values ...int) int
- func MinInt(values ...int) int
- func MinMax(values ...float64) (min, max float64)
- func Normalize(values ...float64) []float64
- func PercentDifference(v1, v2 float64) float64
- func PercentToRadians(pct float64) float64
- func PolyRegression(xvalues, yvalues []float64, degree int) ([]float64, error)
- func RadiansAdd(base, delta float64) float64
- func RadiansToDegrees(value float64) float64
- func RotateCoordinate(cx, cy, x, y int, thetaRadians float64) (rx, ry int)
- func RoundDown(value, roundTo float64) float64
- func RoundPlaces(input float64, places int) (rounded float64)
- func RoundTo(delta float64) float64
- func RoundUp(value, roundTo float64) float64
- func Sum(values ...float64) float64
- func SumInt(values ...int) int
- type Matrix
- func (m *Matrix) Arrays() [][]float64
- func (m *Matrix) Augment(m2 *Matrix) (*Matrix, error)
- func (m *Matrix) Col(col int) Vector
- func (m *Matrix) Copy() *Matrix
- func (m *Matrix) Diagonal() *Matrix
- func (m *Matrix) DiagonalVector() Vector
- func (m *Matrix) Each(action func(row, col int, value float64))
- func (m *Matrix) Epsilon() float64
- func (m *Matrix) Equals(other *Matrix) bool
- func (m *Matrix) Get(row, col int) float64
- func (m *Matrix) Inverse() (*Matrix, error)
- func (m *Matrix) IsSquare() bool
- func (m *Matrix) IsSymmetric() bool
- func (m *Matrix) L() *Matrix
- func (m *Matrix) LU() (l, u, p *Matrix)
- func (m *Matrix) Multiply(m2 *Matrix) (m3 *Matrix, err error)
- func (m *Matrix) Pivotize() *Matrix
- func (m *Matrix) QR() (q, r *Matrix)
- func (m *Matrix) Round() *Matrix
- func (m *Matrix) Row(row int) Vector
- func (m *Matrix) ScaleRow(row int, scale float64)
- func (m *Matrix) Set(row, col int, val float64)
- func (m *Matrix) Size() (rows, cols int)
- func (m *Matrix) String() string
- func (m *Matrix) SubMatrix(i, j, rows, cols int) *Matrix
- func (m *Matrix) SwapRows(i, j int)
- func (m *Matrix) Times(m2 *Matrix) (*Matrix, error)
- func (m *Matrix) Transpose() *Matrix
- func (m *Matrix) U() *Matrix
- func (m *Matrix) WithEpsilon(epsilon float64) *Matrix
- type Vector
Constants ¶
This section is empty.
Variables ¶
var ( // ErrPolyRegArraysSameLength is a common error. ErrPolyRegArraysSameLength = errors.New("polynomial array inputs must be the same length") )
Functions ¶
func CirclePoint ¶
CirclePoint returns the absolute position of a circle diameter point given by the radius and the theta.
func DegreesAdd ¶
DegreesAdd adds a delta to a base in radians.
func DegreesToCompass ¶
DegreesToCompass returns the degree value in compass / clock orientation.
func DegreesToRadians ¶
DegreesToRadians returns degrees as radians.
func Normalize ¶
Normalize translates the input set of numbers in the [0,1] interval. The total may be < 1.0. There are going to be issues with irrational numbers. E.g: 4,3,2,1 => 0.4, 0.3, 0.2, 0.1
func PercentDifference ¶
PercentDifference computes the percentage difference between two values. The formula is (v2-v1)/v1.
func PercentToRadians ¶
PercentToRadians converts a normalized value (0,1) to radians.
func PolyRegression ¶
PolyRegression returns the polynomial regression of a given degree over the given values.
func RadiansAdd ¶
RadiansAdd adds a delta to a base in radians.
func RadiansToDegrees ¶
RadiansToDegrees translates a radian value to a degree value.
func RotateCoordinate ¶
RotateCoordinate rotates a coordinate around a given center by a theta in radians.
func RoundPlaces ¶
RoundPlaces rounds an input to a given places.
Types ¶
type Matrix ¶
type Matrix struct {
// contains filtered or unexported fields
}
Matrix represents a 2d dense array of floats.
func IdentityMatrix ¶
IdentityMatrix returns the identity matrix of a given order.
func NewMatrixFromArrays ¶
NewMatrixFromArrays creates a matrix from a jagged array set.
func ZeroMatrix ¶
ZeroMatrix returns a matrix of a given size zeroed.
func (*Matrix) DiagonalVector ¶
DiagonalVector returns a vector from the diagonal of a matrix.
func (*Matrix) IsSymmetric ¶
IsSymmetric returns if the matrix is symmetric about its diagonal.
func (*Matrix) Round ¶
Round rounds all the values in a matrix to its epsilon, returning a reference to the original.
func (*Matrix) U ¶
U returns the matrix with zeros above the diagonal. Does not include the diagonal.
func (*Matrix) WithEpsilon ¶
WithEpsilon sets the epsilon on the matrix and returns a reference to the matrix.