Home util plot cluster

Documentation for CCNY Human Brain Mapping Golang library

import "hbm/util"

The index below has links to each function in the current library. Click on one of the links to jump to the documentation for that function/struct/interface.

Overview

Package hbmutil adds various functions relating to matrix operations.

Index

func Avgf(vals ...float32) float32
func Avgff(vals ...float64) float64
func Avgffl(vals []float64) float64
func Avgfl(vals []float32) float32
func Avgi(vals ...int) int
func Avgil(vals []int) int
func Linspacef(start, end float32, vals int) []float32
func Linspaceff(start, end float64, vals int) []float64
func Linspacei(start, end, vals int) []int
func Maxf(a ...float32) float32
func Maxff(a ...float64) float64
func Maxffl(a []float64) float64
func Maxfl(a []float32) float32
func Maxi(a ...int) int
func Maxil(a []int) int
func Roundf(f float32) float32
func Roundff(f float64) float64
func Sumf(a ...float32) float32
func Sumff(a ...float64) float64
func Sumffl(a []float64) float64
func Sumfl(a []float32) float32
func Sumi(a ...int) int
func Sumil(a []int) int
type Matrix
type Matrixb
    func MatOnesb(rows, cols int) *Matrixb
    func NewMatrixb(rows, cols int) *Matrixb
    func (m1 *Matrixb) Getcol(n int) []bool
    func (m1 Matrixb) MatEqual(m ...Matrixb) bool
    func (m1 Matrixb) Pretty()
    func (m1 *Matrixb) Unpackc(col int, vals ...bool)
    func (m1 *Matrixb) Unpackcl(col int, vals []bool)
    func (m1 *Matrixb) Unpackr(row int, vals ...bool)
    func (m1 *Matrixb) Unpackrl(row int, vals []bool)
type Matrixf
    func Gscmap(vals, max int) *Matrixf
    func MatOnesf(rows, cols int) *Matrixf
    func MattoImgf(pts *Matrixf, xcol, ycol, wid, hei int) *Matrixf
    func NewMatrixf(rows, cols int) *Matrixf
    func ReadMEP(file string, xcol, ycol, zcol, MEPcol int) (*Matrixf, error)
    func (m1 Matrixf) Combinelr(m ...Matrixf) *Matrixf
    func (m1 Matrixf) Cramer(vargin ...float32) []float32
    func (m1 Matrixf) Det() float32
    func (m1 Matrixf) Dot(m2 Matrixf) float32
    func (m1 *Matrixf) Getcol(n int) []float32
    func (m1 Matrixf) MatEqual(m ...Matrixf) bool
    func (m1 *Matrixf) Maxa() float32
    func (m1 *Matrixf) Maxc() []float32
    func (m1 *Matrixf) Maxr() []float32
    func (m1 Matrixf) Pretty()
    func (m1 Matrixf) Scale(s float32) Matrixf
    func (m1 Matrixf) Times(m2 Matrixf) *Matrixf
    func (m1 *Matrixf) ToMatf()
    func (m1 *Matrixf) ToMatff() *Matrixff
    func (m1 *Matrixf) ToMati() *Matrixi
    func (m1 Matrixf) Transpose() *Matrixf
    func (m1 *Matrixf) Unpackc(col int, vals ...float32)
    func (m1 *Matrixf) Unpackcl(col int, vals []float32)
    func (m1 *Matrixf) Unpackr(row int, vals ...float32)
    func (m1 *Matrixf) Unpackrl(row int, vals []float32)
type Matrixff
    func MatOnesff(rows, cols int) *Matrixff
    func MattoImgff(pts *Matrixff, xcol, ycol, wid, hei int) *Matrixff
    func NewMatrixff(rows, cols int) *Matrixff
    func (m1 Matrixff) Combinelr(m ...Matrixff) *Matrixff
    func (m1 Matrixff) Cramer(vargin ...float64) []float64
    func (m1 Matrixff) Det() float64
    func (m1 Matrixff) Dot(m2 Matrixff) float64
    func (m1 *Matrixff) Getcol(n int) []float64
    func (m1 Matrixff) MatEqual(m ...Matrixff) bool
    func (m1 *Matrixff) Maxa() float64
    func (m1 *Matrixff) Maxc() []float64
    func (m1 *Matrixff) Maxr() []float64
    func (m1 Matrixff) Pretty()
    func (m1 Matrixff) Scale(s float64) Matrixff
    func (m1 Matrixff) Times(m2 Matrixff) *Matrixff
    func (m1 *Matrixff) ToMatf() *Matrixf
    func (m1 *Matrixff) ToMatff()
    func (m1 *Matrixff) ToMati() *Matrixi
    func (m1 Matrixff) Transpose() *Matrixff
    func (m1 *Matrixff) Unpackc(col int, vals ...float64)
    func (m1 *Matrixff) Unpackcl(col int, vals []float64)
    func (m1 *Matrixff) Unpackr(row int, vals ...float64)
    func (m1 *Matrixff) Unpackrl(row int, vals []float64)
type Matrixi
    func MatOnesi(rows, cols int) *Matrixi
    func MattoImgi(pts *Matrixi, xcol, ycol, wid, hei int) *Matrixi
    func NewMatrixi(rows, cols int) *Matrixi
    func Randmat(row, col, maxn int) *Matrixi
    func (m1 Matrixi) Combinelr(m ...Matrixi) *Matrixi
    func (m1 Matrixi) Cramer(vargin ...int) []int
    func (m1 Matrixi) Det() int
    func (m1 Matrixi) Dot(m2 Matrixi) int
    func (m1 *Matrixi) Getcol(n int) []int
    func (m1 Matrixi) MatEqual(m ...Matrixi) bool
    func (m1 *Matrixi) Maxa() int
    func (m1 *Matrixi) Maxc() []int
    func (m1 *Matrixi) Maxr() []int
    func (m1 Matrixi) Pretty()
    func (m1 Matrixi) Scale(s int) Matrixi
    func (m1 Matrixi) Times(m2 Matrixi) *Matrixi
    func (m1 *Matrixi) ToMatf() *Matrixf
    func (m1 *Matrixi) ToMatff() *Matrixff
    func (m1 *Matrixi) ToMati()
    func (m1 Matrixi) Transpose() *Matrixi
    func (m1 *Matrixi) Unpackc(col int, vals ...int)
    func (m1 *Matrixi) Unpackcl(col int, vals []int)
    func (m1 *Matrixi) Unpackr(row int, vals ...int)
    func (m1 *Matrixi) Unpackrl(row int, vals []int)
type Point2f
type Point2ff
type Point2i
type Point3f
type Point3ff
type Point3i
type PointCloud2f
type Pointf
type Pointff
type Pointi

Package files

colormap.go csvdataread.go graph.go math.go matrices.go

func Avgf

func Avgf(vals ...float32) float32

Avgf returns the average of the values given

func Avgff

func Avgff(vals ...float64) float64

Avgff returns the average of the values given

func Avgffl

func Avgffl(vals []float64) float64

Avgffl returns the average of the values given

func Avgfl

func Avgfl(vals []float32) float32

Avgfl returns the average of the values given

func Avgi

func Avgi(vals ...int) int

Avgi returns the average of the values given

func Avgil

func Avgil(vals []int) int

Avgil returns the average of the values given

func Linspacef

func Linspacef(start, end float32, vals int) []float32

Linspacef returns an array of equally spaced numbers between start and end (inclusive!) just like matlab's linspace() function

func Linspaceff

func Linspaceff(start, end float64, vals int) []float64

Linspaceff returns an array of equally spaced numbers between start and end (inclusive!) just like matlab's linspace() function

func Linspacei

func Linspacei(start, end, vals int) []int

Linspacei returns an array of equally spaced numbers between start and end (inclusive!) just like matlab's linspace() function

func Maxf

func Maxf(a ...float32) float32

Maxf finds the max of all values passed in

func Maxff

func Maxff(a ...float64) float64

Maxff finds the max of all values passed in

func Maxffl

func Maxffl(a []float64) float64

Maxffl finds the max of a list

func Maxfl

func Maxfl(a []float32) float32

Maxfl finds the max of a list

func Maxi

func Maxi(a ...int) int

Maxi finds the max of all values passed in

func Maxil

func Maxil(a []int) int

Maxil finds the max of a list

func Roundf

func Roundf(f float32) float32

Roundf returns the rounded value of input

func Roundff

func Roundff(f float64) float64

Roundff returns the rounded value of input

func Sumf

func Sumf(a ...float32) float32

Sumf returns the sum of all float32 variables passed in

func Sumff

func Sumff(a ...float64) float64

Sumff returns the sum of all float64 variables passed in

func Sumffl

func Sumffl(a []float64) float64

Sumffl returns the sum of all float64 variables passed in

func Sumfl

func Sumfl(a []float32) float32

Sumfl returns the sum of all float32 variables passed in

func Sumi

func Sumi(a ...int) int

Sumi returns the sum of all uint8 variables passed in

func Sumil

func Sumil(a []int) int

Sumil returns the sum of all uint8 variables passed in

type Matrix

type Matrix interface {
    Pretty()
}

Matrix is an overarching interface for the specific matrices to be derived from allowing overloading non-type specific methods like scalar multiplication

type Matrixb

type Matrixb struct {
    Data [][]bool
}

Matrixb defines a 2-dimensional binary bit map for increased efficiency and performance in matrix operations

func MatOnesb

func MatOnesb(rows, cols int) *Matrixb

MatOnesb returns a binary matrix full of 'true' values instead of the default 'false' map

func NewMatrixb

func NewMatrixb(rows, cols int) *Matrixb

NewMatrixb constructs a binary Matrix with specified rows and columns, returning the pointer to the new binary matrix

func (*Matrixb) Getcol

func (m1 *Matrixb) Getcol(n int) []bool

Getcol will retrieve all values from a given column and return them as a slice

func (Matrixb) MatEqual

func (m1 Matrixb) MatEqual(m ...Matrixb) bool

MatEqual determines if multiple matrices are completely equivalent

func (Matrixb) Pretty

func (m1 Matrixb) Pretty()

Pretty prints out the values of the matrix in a visually readable way

func (*Matrixb) Unpackc

func (m1 *Matrixb) Unpackc(col int, vals ...bool)

Unpackc unpacks all values into a given col

func (*Matrixb) Unpackcl

func (m1 *Matrixb) Unpackcl(col int, vals []bool)

Unpackcl unpacks all values into a given col

func (*Matrixb) Unpackr

func (m1 *Matrixb) Unpackr(row int, vals ...bool)

Unpackr unpacks all values into a given row

func (*Matrixb) Unpackrl

func (m1 *Matrixb) Unpackrl(row int, vals []bool)

Unpackrl unpacks all values into a given row

type Matrixf

type Matrixf struct {
    Rows int
    Cols int
    Data [][]float32
}

Matrixf is a 32bit floating point struct to streamline matrix operations

func Gscmap

func Gscmap(vals, max int) *Matrixf

Gscmap returns a float32 N by 3 matrix with resultant r,g,b values for (vals) discrete levels. Similar to Matlab's 'gray()' command. Thus, Gscmap will return a (12*n) byte matrix.

func MatOnesf

func MatOnesf(rows, cols int) *Matrixf

MatOnesf replicates matlab's ones() function. Returns a new 32bit floating point matrix full of 1's

func MattoImgf

func MattoImgf(pts *Matrixf, xcol, ycol, wid, hei int) *Matrixf

MattoImgf converts a list of points with intensity values to an image array

func NewMatrixf

func NewMatrixf(rows, cols int) *Matrixf

NewMatrixf constructs a Matrix structure with specified rows and columns, returning the pointer to the new 32bit floating point matrix

func ReadMEP

func ReadMEP(file string, xcol, ycol, zcol, MEPcol int) (*Matrixf, error)

ReadMEP takes MEP values from a csvfile and returns an array of hotspot points.

func (Matrixf) Combinelr

func (m1 Matrixf) Combinelr(m ...Matrixf) *Matrixf

Combinelr combines multiple matrices into one larger matrix, appending to the m1 matrix from left to right. If one matrix has more rows than another, the extraneous rows will be zero-valued. Example: if [1,2;3,4] and [5] are appended, the output will be [1,2,5;3,4,0].

func (Matrixf) Cramer

func (m1 Matrixf) Cramer(vargin ...float32) []float32

Cramer solves a system of equations using Cramer's rule. Note that a more efficient systems solver should be implemented in the future.

func (Matrixf) Det

func (m1 Matrixf) Det() float32

Det uses laplace expansion to find the determinant of 2x2, 3x3, and 4x4 matrices

func (Matrixf) Dot

func (m1 Matrixf) Dot(m2 Matrixf) float32

Dot performs simple dot product multiplication for two float32 matrices

func (*Matrixf) Getcol

func (m1 *Matrixf) Getcol(n int) []float32

Getcol will retrieve all values from a given column and return them as a slice

func (Matrixf) MatEqual

func (m1 Matrixf) MatEqual(m ...Matrixf) bool

MatEqual determines if multiple matrices are completely equivalent

func (*Matrixf) Maxa

func (m1 *Matrixf) Maxa() float32

Maxa will find the total maximum of a matrix

func (*Matrixf) Maxc

func (m1 *Matrixf) Maxc() []float32

Maxc will find the maximum in each column of a matrix

func (*Matrixf) Maxr

func (m1 *Matrixf) Maxr() []float32

Maxr will find the maximum in each row of a matrix

func (Matrixf) Pretty

func (m1 Matrixf) Pretty()

Pretty prints out the values of the matrix in a visually readable way

func (Matrixf) Scale

func (m1 Matrixf) Scale(s float32) Matrixf

Scale performs simple scalar matrix multiplication for float32 matrices

func (Matrixf) Times

func (m1 Matrixf) Times(m2 Matrixf) *Matrixf

Times returns the matrix multiplication of the input matrices

func (*Matrixf) ToMatf

func (m1 *Matrixf) ToMatf()

ToMatf will panic if you try to convert a float32 matrix into a float32 matrix

func (*Matrixf) ToMatff

func (m1 *Matrixf) ToMatff() *Matrixff

ToMatff will reassign the values of a float64 matrix into a float32 matrix

func (*Matrixf) ToMati

func (m1 *Matrixf) ToMati() *Matrixi

ToMati will reassign the values of a float32 matrix into an integer matrix

func (Matrixf) Transpose

func (m1 Matrixf) Transpose() *Matrixf

Transpose returns the transpose of the input matrix

func (*Matrixf) Unpackc

func (m1 *Matrixf) Unpackc(col int, vals ...float32)

Unpackc unpacks all values into a given column

func (*Matrixf) Unpackcl

func (m1 *Matrixf) Unpackcl(col int, vals []float32)

Unpackcl unpacks all values from a list into a given column

func (*Matrixf) Unpackr

func (m1 *Matrixf) Unpackr(row int, vals ...float32)

Unpackr unpacks all values into a given row

func (*Matrixf) Unpackrl

func (m1 *Matrixf) Unpackrl(row int, vals []float32)

Unpackrl unpacks all values into a given row

type Matrixff

type Matrixff struct {
    Rows int
    Cols int
    Data [][]float64
}

Matrixff is a 64bit floating point struct to streamline matrix operations

func MatOnesff

func MatOnesff(rows, cols int) *Matrixff

MatOnesff replicates matlab's ones() function. Returns a new 64bit floating point matrix full of 1's

func MattoImgff

func MattoImgff(pts *Matrixff, xcol, ycol, wid, hei int) *Matrixff

MattoImgff converts a list of points with intensity values to an image array

func NewMatrixff

func NewMatrixff(rows, cols int) *Matrixff

NewMatrixff constructs a Matrix structure with specified rows and columns, returning the pointer to the new 64bit floating point matrix

func (Matrixff) Combinelr

func (m1 Matrixff) Combinelr(m ...Matrixff) *Matrixff

Combinelr combines multiple matrices into one larger matrix, appending to the m1 matrix from left to right. If one matrix has more rows than another, the extraneous rows will be zero-valued. Example: if [1,2;3,4] and [5] are appended, the output will be [1,2,5;3,4,0].

func (Matrixff) Cramer

func (m1 Matrixff) Cramer(vargin ...float64) []float64

Cramer solves a system of equations using Cramer's rule. Note that a more efficient systems solver should be implemented in the future.

func (Matrixff) Det

func (m1 Matrixff) Det() float64

Det uses laplace expansion to find the determinant of 2x2, 3x3, and 4x4 matrices

func (Matrixff) Dot

func (m1 Matrixff) Dot(m2 Matrixff) float64

Dot performs simple dot product multiplication for two float64 matrices

func (*Matrixff) Getcol

func (m1 *Matrixff) Getcol(n int) []float64

Getcol will retrieve all values from a given column and return them as a slice

func (Matrixff) MatEqual

func (m1 Matrixff) MatEqual(m ...Matrixff) bool

MatEqual determines if multiple matrices are completely equivalent

func (*Matrixff) Maxa

func (m1 *Matrixff) Maxa() float64

Maxa will find the total maximum of a matrix

func (*Matrixff) Maxc

func (m1 *Matrixff) Maxc() []float64

Maxc will find the maximum in each column of a matrix

func (*Matrixff) Maxr

func (m1 *Matrixff) Maxr() []float64

Maxr will find the maximum in each row of a matrix

func (Matrixff) Pretty

func (m1 Matrixff) Pretty()

Pretty prints out the values of the matrix in a visually readable way

func (Matrixff) Scale

func (m1 Matrixff) Scale(s float64) Matrixff

Scale performs simple scalar matrix multiplication for float64 matrices

func (Matrixff) Times

func (m1 Matrixff) Times(m2 Matrixff) *Matrixff

Times returns the matrix multiplication of the input matrices

func (*Matrixff) ToMatf

func (m1 *Matrixff) ToMatf() *Matrixf

ToMatf will reassign the values of a float64 matrix into a float32 matrix

func (*Matrixff) ToMatff

func (m1 *Matrixff) ToMatff()

ToMatff will panic if you try to convert a float64 matrix into a float64 matrix

func (*Matrixff) ToMati

func (m1 *Matrixff) ToMati() *Matrixi

ToMati will reassign the values of a float64 matrix into an integer matrix

func (Matrixff) Transpose

func (m1 Matrixff) Transpose() *Matrixff

Transpose returns the transpose of the input matrix

func (*Matrixff) Unpackc

func (m1 *Matrixff) Unpackc(col int, vals ...float64)

Unpackc unpacks all values into a given column

func (*Matrixff) Unpackcl

func (m1 *Matrixff) Unpackcl(col int, vals []float64)

Unpackcl unpacks all values from a list into a given column

func (*Matrixff) Unpackr

func (m1 *Matrixff) Unpackr(row int, vals ...float64)

Unpackr unpacks all values into a given row

func (*Matrixff) Unpackrl

func (m1 *Matrixff) Unpackrl(row int, vals []float64)

Unpackrl unpacks all values into a given row

type Matrixi

type Matrixi struct {
    Rows int
    Cols int
    Data [][]int
}

Matrixi is an 8bit unsigned integer struct to streamline matrix operations

func MatOnesi

func MatOnesi(rows, cols int) *Matrixi

MatOnesi replicates matlab's ones() function. Returns a new integer matrix full of 1's

func MattoImgi

func MattoImgi(pts *Matrixi, xcol, ycol, wid, hei int) *Matrixi

MattoImgi converts a list of points with intensity values to an image array

func NewMatrixi

func NewMatrixi(rows, cols int) *Matrixi

NewMatrixi constructs a integer containing Matrix structure with specified rows and columns, returning the pointer to the new matrix

func Randmat

func Randmat(row, col, maxn int) *Matrixi

Randmat returns a matrix of pseudo-random values

func (Matrixi) Combinelr

func (m1 Matrixi) Combinelr(m ...Matrixi) *Matrixi

Combinelr combines multiple matrices into one larger matrix, appending to the m1 matrix from left to right. If one matrix has more rows than another, the extraneous rows will be zero-valued. Example: if [1,2;3,4] and [5] are appended, the output will be [1,2,5;3,4,0].

func (Matrixi) Cramer

func (m1 Matrixi) Cramer(vargin ...int) []int

Cramer solves a system of equations using Cramer's rule. Note that a more efficient systems solver should be implemented in the future.

func (Matrixi) Det

func (m1 Matrixi) Det() int

Det uses laplace expansion to find the determinant of 2x2, 3x3, and 4x4 matrices

func (Matrixi) Dot

func (m1 Matrixi) Dot(m2 Matrixi) int

Dot performs simple dot product multiplication for two uint8 matrices

func (*Matrixi) Getcol

func (m1 *Matrixi) Getcol(n int) []int

Getcol will retrieve all values from a given column and return them as a slice

func (Matrixi) MatEqual

func (m1 Matrixi) MatEqual(m ...Matrixi) bool

MatEqual determines if multiple matrices are completely equivalent

func (*Matrixi) Maxa

func (m1 *Matrixi) Maxa() int

Maxa will find the total maximum of a matrix

func (*Matrixi) Maxc

func (m1 *Matrixi) Maxc() []int

Maxc will find the maximum in each column of a matrix

func (*Matrixi) Maxr

func (m1 *Matrixi) Maxr() []int

Maxr will find the maximum in each row of a matrix

func (Matrixi) Pretty

func (m1 Matrixi) Pretty()

Pretty prints out the values of the matrix in a visually readable way

func (Matrixi) Scale

func (m1 Matrixi) Scale(s int) Matrixi

Scale performs simple scalar matrix multiplication for uint8 matrices

func (Matrixi) Times

func (m1 Matrixi) Times(m2 Matrixi) *Matrixi

Times returns the matrix multiplication of the input matrices

func (*Matrixi) ToMatf

func (m1 *Matrixi) ToMatf() *Matrixf

ToMatf will reassign the values of an integer matrix into a float32 matrix

func (*Matrixi) ToMatff

func (m1 *Matrixi) ToMatff() *Matrixff

ToMatff will reassign the values of a float64 matrix into a float32 matrix

func (*Matrixi) ToMati

func (m1 *Matrixi) ToMati()

ToMati will panic if you try to convert an integer matrix into an integer matrix

func (Matrixi) Transpose

func (m1 Matrixi) Transpose() *Matrixi

Transpose returns the transpose of the input matrix

func (*Matrixi) Unpackc

func (m1 *Matrixi) Unpackc(col int, vals ...int)

Unpackc unpacks all values into a given column

func (*Matrixi) Unpackcl

func (m1 *Matrixi) Unpackcl(col int, vals []int)

Unpackcl unpacks all values from a list into a given column

func (*Matrixi) Unpackr

func (m1 *Matrixi) Unpackr(row int, vals ...int)

Unpackr unpacks all values into a given row

func (*Matrixi) Unpackrl

func (m1 *Matrixi) Unpackrl(row int, vals []int)

Unpackrl unpacks all values into a given row

type Point2f

type Point2f struct {
    X, Y, V float32
}

Point2f defines a 2d float32 point

type Point2ff

type Point2ff struct {
    X, Y, V float64
}

Point2ff defines a 2d float64 point

type Point2i

type Point2i struct {
    X, Y, V int
}

Point2i defines a 2d integer point

type Point3f

type Point3f struct {
    X, Y, Z, V float32
}

Point3f defines a 3d float32 point

type Point3ff

type Point3ff struct {
    X, Y, Z, V float64
}

Point3ff defines a 3d float64 point

type Point3i

type Point3i struct {
    X, Y, Z, V int
}

Point3i defines a 3d integer point

type PointCloud2f

type PointCloud2f struct {
    Pts []Point2f
    // contains filtered or unexported fields
}

PointCloud2f is a method of storing point clouds of points

type Pointf

type Pointf interface {
}

Pointf defines an interface for 2d and 3d float32 points

type Pointff

type Pointff interface {
}

Pointff defines an interface for 2d and 3d float64 points

type Pointi

type Pointi interface {
}

Pointi defines an interface for 2d and 3d int points