math

package
v0.0.0-...-d606bfb Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Closest

func Closest(pred [][][]float64, all [][][][]float64, truevalue [][][]float64) float64

Checks if the predicted value is the closest to the true value, returns 1 if true, 0 if false

func Convolve

func Convolve(in [][]float64, k [][]float64, s int) (out [][]float64, err error)

func Dot

func Dot(x [][]float64, y [][]float64) (r [][]float64, err error)

Multiplies two 2-dimensional matrices

func HorzStack

func HorzStack(x [][]float64, y [][]float64) [][]float64

Stacks two matrices horizontally

func MatAdd

func MatAdd(m1 [][]float64, m2 [][]float64) ([][]float64, error)

Adds two matrices

func MatMean

func MatMean(m [][]float64) float64

Returns the average value of a matrix

func MatOp

func MatOp(m [][]float64, f MatOpF) [][]float64

Applies a given function on a matrix

func MatSub

func MatSub(m1 [][]float64, m2 [][]float64) ([][]float64, error)

Substracts two matrices

func MatSum

func MatSum(m [][]float64) (out float64)

Calculates the sum of a matrix

func Max

func Max(in []float64) float64

Returns the biggest number in the array

func MaxIndex

func MaxIndex(in [][]float64) (float64, int, int)

func Mean

func Mean(in []float64) float64

Calculates the mean value of the input array

func Normalize

func Normalize(in [][][][]float64) [][][][]float64

Normalizes the values between <0,1>

func OutIndex

func OutIndex(in [][][]float64) int

func Padding

func Padding(in [][]float64, s int) [][]float64

Adds padding to a matrix

func Rand

func Rand(seq ...int) interface{}

Generate a multidimensional matrix with random numbers

func Rand2D

func Rand2D(y int, x int) [][]float64

Creates a matrix with random values

func Resize

func Resize(matrix [][]float64, y int, x int) [][]float64

Resizes the matrix

func Rotate180

func Rotate180(in [][]float64) [][]float64

func Sum

func Sum(in []float64) float64

Calculates the sum of the input array

func Transpose

func Transpose(slice [][]float64) [][]float64

Determines the correct dimensions of the matrix.

func VertStack

func VertStack(x [][]float64, y [][]float64) [][]float64

Stacks two matrices vertically

func Zeros

func Zeros(seq ...int) interface{}

Generate a multidimensional matrix with zeros

func Zeros2D

func Zeros2D(x int, y int) (out [][]float64)

Creates a matrix of zeros with dimentions x and y

Types

type MatOpF

type MatOpF func(val float64, x int, y int) float64

Defines MatOp function

Jump to

Keyboard shortcuts

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