sm

package
v0.0.0-...-4977366 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2019 License: MIT Imports: 2 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SparseMatrix

type SparseMatrix struct {
	Indices []SparseMatrixIndex
	Values  []float64
}

SparseMatrix is a sparse matrix implementation

func CreateSparseMatrix

func CreateSparseMatrix() SparseMatrix

CreateSparseMatrix returns an empty sparse matrix

func (*SparseMatrix) Add

func (s *SparseMatrix) Add(smi SparseMatrixIndex, value float64)

Add add the value to the value specified by the index

func (SparseMatrix) Equal

func (s SparseMatrix) Equal(other SparseMatrix) bool

Equal returns true if equal, false if not equal

func (SparseMatrix) Get

Get returns the value specified by the index, or -1.0 and an error otherwise

func (SparseMatrix) Mul

func (s SparseMatrix) Mul(smi SparseMatrixIndex, value float64)

Mul multiplies the value to the value specified by the index

func (SparseMatrix) Scale

func (s SparseMatrix) Scale(value float64)

Scale multiplies the value to all cells

func (*SparseMatrix) Set

func (s *SparseMatrix) Set(smi SparseMatrixIndex, value float64)

Set set the value specified by the index

type SparseMatrixIndex

type SparseMatrixIndex []int

SparseMatrixIndex is the index of the tensor, e.g. index can be (0,1) or (0,1,23), referencing a cell in a 2d or 3d matrix

func (SparseMatrixIndex) Equal

func (si SparseMatrixIndex) Equal(other SparseMatrixIndex) bool

Equal return true of the indices are equal

Jump to

Keyboard shortcuts

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