Documentation ¶
Index ¶
- type SparseMatrix
- func (s *SparseMatrix) Add(smi SparseMatrixIndex, value float64)
- func (s SparseMatrix) Equal(other SparseMatrix) bool
- func (s SparseMatrix) Get(smi SparseMatrixIndex) (float64, error)
- func (s SparseMatrix) Mul(smi SparseMatrixIndex, value float64)
- func (s SparseMatrix) Scale(value float64)
- func (s *SparseMatrix) Set(smi SparseMatrixIndex, value float64)
- type SparseMatrixIndex
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 ¶
func (s SparseMatrix) Get(smi SparseMatrixIndex) (float64, error)
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
Click to show internal directories.
Click to hide internal directories.