Documentation ¶
Overview ¶
Package blas provides implementations of sparse BLAS (Basic Linear Algebra Subprograms) routines for sparse matrix arithmetic and solving sparse linear systems.
See http://www.netlib.org/blas/blast-forum/chapter3.pdf for further information.
Index ¶
- func Dusaxpy(alpha float64, x []float64, indx []int, y []float64, incy int)
- func Dusdot(x []float64, indx []int, y []float64, incy int) (dot float64)
- func Dusga(y []float64, incy int, x []float64, indx []int)
- func Dusgz(y []float64, incy int, x []float64, indx []int)
- func Dusmm(transA bool, k int, alpha float64, a *SparseMatrix, b []float64, ldb int, ...)
- func Dusmv(transA bool, alpha float64, a *SparseMatrix, x []float64, incx int, ...)
- func Dussc(x []float64, y []float64, incy int, indx []int)
- type SparseMatrix
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dusaxpy ¶
Dusaxpy (Sparse update (y <- alpha * x + y)) scales the sparse vector x by alpha and adds the result to the dense vector y. indx is used as the index values to gather and incy as the stride for y.
func Dusdot ¶
Dusdot (Sparse dot product (r <- x^T * y)) calculates the dot product of sparse vector x and dense vector y. indx is used as the index values to gather and incy as the stride for y.
func Dusga ¶
Dusga (Sparse gather (x <- y|x)) gathers entries from the dense vector y into the sparse vector x using indx as the index values to gather and incy as the stride for y.
func Dusgz ¶
Dusgz (Sparse gather and zero (x <- y|x, y|x <- 0)) gathers entries from the dense vector y into the sparse vector x (as Usga()) and then sets the corresponding elements of y (y[indx[i]]) to 0. indx is used as the index values to gather and incy as the stride for y.
func Dusmm ¶
func Dusmm(transA bool, k int, alpha float64, a *SparseMatrix, b []float64, ldb int, c []float64, ldc int)
Dusmm (Sparse matrix multiply (C <- alpha * A * B + C Or C <- alpha * A^T * B + C)) multiplies a dense matrix B by a sparse matrix A (or its transpose), and adds it to a dense matrix operand C. C is modified to hold the result of operation. k Represents the number of columns in matrices B and C and ldb and ldc are the spans to be used for indexing into matrices B and C respectively.
func Dusmv ¶
func Dusmv(transA bool, alpha float64, a *SparseMatrix, x []float64, incx int, y []float64, incy int)
Dusmv (sparse matrix / vector multiply (y <- alpha * A * x + y Or y <- alpha * A^T * x + y)) multiplies a dense vector x by sparse matrix a (or its transpose), and adds it to the dense vector y. transA is a boolean indicating whether to transpose (true) a. alpha is used to scale a and incx and incy represent the span to be used for indexing into vectors x and y respectively.
Types ¶
type SparseMatrix ¶
SparseMatrix represents the common structure for representing compressed sparse matrix formats e.g. CSR (Compressed Sparse Row) or CSC (Compressed Sparse Column)
func (*SparseMatrix) At ¶
func (m *SparseMatrix) At(i, j int) float64
At returns the element of the matrix located at coordinate i, j.
func (*SparseMatrix) Cull ¶
func (m *SparseMatrix) Cull(epsilon float64) *SparseMatrix
Cull returns a new SparseMatrix with all entries within epsilon of 0 removed.
func (*SparseMatrix) Set ¶
func (m *SparseMatrix) Set(i, j int, v float64)
Set is a generic method to set a matrix element. Note: setting a non-zero element to zero does not remove the element from the sparcity pattern but will actually store a zero value.