Documentation ¶
Index ¶
- func Axpy(y *mat64.Vector, alpha float64, x *Vector)
- func Dot(x *Vector, y *mat64.Vector) (dot float64)
- func Gather(x *Vector, y *mat64.Vector, indices []int)
- func GatherZero(x *Vector, y *mat64.Vector, indices []int)
- func MulMatVec(y *mat64.Vector, alpha float64, transA bool, a Matrix, x *mat64.Vector)
- func Scatter(y *mat64.Vector, x *Vector)
- type CSR
- type DOK
- type Index
- type Matrix
- type MatrixBuilder
- type MatrixProperties
- type MutableMatrix
- type Triplet
- type Vector
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Axpy ¶
Axpy scales the sparse vector x by alpha and adds the result to the dense vector y. If alpha is zero, y is not modified.
func Dot ¶
Dot computes the dot product of the sparse vector x with the dense vector y. The vectors must have the same dimension.
func Gather ¶
Gather gathers entries given by indices of the dense vector y into the sparse vector x. Indices must not be nil.
func GatherZero ¶
Gather gathers entries given by indices of the dense vector y into the sparse vector x and sets the corresponding values of y to zero.
Types ¶
type DOK ¶
type DOK struct {
// contains filtered or unexported fields
}
func (*DOK) InsertEntry ¶
func (*DOK) Properties ¶
func (m *DOK) Properties() MatrixProperties
type Matrix ¶
type Matrix interface { // Dims returns the dimensions of the matrix. Dims() (r, c int) // At returns the value of the matrix entry at (r, c). It will panic if r // or c are out of bounds for the matrix. At(r, c int) float64 }
Matrix is a sparse matrix.
type MatrixBuilder ¶
type MatrixBuilder interface { Begin() InsertEntry(r, c int, v float64) InsertEntries() InsertClique() End() }
MatrixBuilder can build a sparse matrix by modifying its sparsity structure.
type MatrixProperties ¶
type MutableMatrix ¶
type MutableMatrix interface { Matrix // SetSparse sets the entry at (r, c) to v. It will panic if r or c are out // of bounds for the matrix. // Whether SetSparse panics if the entry does not already exist in the // matrix is implementation-specific. SetSparse(r, c int, v float64) }
MutableMatrix is a matrix that can modify its non-zero entries without changing its sparsity structure.
type Vector ¶
type Vector struct { N int // Dimension of the vector. Data []float64 // Non-zero values. Indices []int // Indices of values in Data. Must be zero-based and unique. }
Vector is a sparse vector represented by a slice of non-zero values and a slice denoting their indices.
func NewVector ¶
NewVector returns a new Vector of dimension n with non-zero elements given by data and indices. Both data and indices must have the same length smaller than n, otherwise NewVector will panic. Indices must be unique, although no checking is done.
func (*Vector) InsertEntry ¶
InsertEntry appends the value v with index i to the Vector.