blas

package module
v0.0.0-...-da4ca23 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2019 License: BSD-3-Clause Imports: 1 Imported by: 27

README

Go implementation of BLAS (Basic Linear Algebra Subprograms)

Any function is implemented in generic Go and if it is justified, it is optimized for AMD64 (using SSE2 instructions).

AMD64 implementation uses MOVUPS/MOVUPD instructions if all strides equal to 1 so it run fast on Nehalem, Sandy Bridge and newer processors but relatively slow on older processors.

Any implemented function has its own unity test and benchmark.

Implemented functions

Level 1

Sdsdot, Sdot, Ddot, Snrm2, Dnrm2, Sasum, Dasum, Isamax, Idamax, Sswap, Dswap, Scopy, Dcopy, Saxpy, Daxpy, Sscal, Dscal, Srotg, Drotg, Srot, Drot

Level 2

not implemented

Level 3

not implemented

####Example benchmarks

FunctionGeneric GoOptimized for AMD64
Ddot2825 ns/op895 ns/op
Dnrm22787 ns/op597 ns/op
Dasum3145 ns/op560 ns/op
Sdsdot3133 ns/op1733 ns/op
Sdot2832 ns/op508 ns/op

Documentation

http://godoc.org/github.com/ziutek/blas

Documentation

Overview

Go implementation of BLAS (Basic Linear Algebra Subprograms)

Index

Constants

View Source
const (
	RowMajor = Order(101)
	ColMajor = Order(102)
)
View Source
const (
	NoTrans = Transpose(111)
	Trans   = Transpose(112)
)

Variables

This section is empty.

Functions

func Dasum

func Dasum(N int, X []float64, incX int) float64

Absolute sum: \sum |X_i|

func Daxpy

func Daxpy(N int, alpha float64, X []float64, incX int, Y []float64, incY int)

Compute the sum Y = \alpha X + Y for the vectors X and Y

func Dcopy

func Dcopy(N int, X []float64, incX int, Y []float64, incY int)

Copy the elements of the vectors X and Y.

func Ddot

func Ddot(N int, X []float64, incX int, Y []float64, incY int) float64

Scalar product: X^T Y

func Dnrm2

func Dnrm2(N int, X []float64, incX int) float64

Euclidean norm: ||X||_2 = \sqrt {\sum X_i^2}

func Drot

func Drot(N int, X []float64, incX int, Y []float64, incY int, c, s float64)

Apply a Givens rotation (X', Y') = (c X + s Y, c Y - s X) to the vectors X, Y

func Drotg

func Drotg(a, b float64) (c, s, r, z float64)

Compute a Givens rotation (c,s) which zeroes the vector (a,b)

func Dscal

func Dscal(N int, alpha float64, X []float64, incX int)

Rescale the vector X by the multiplicative factor alpha

func Dswap

func Dswap(N int, X []float64, incX int, Y []float64, incY int)

Exchange the elements of the vectors X and Y.

func Idamax

func Idamax(N int, X []float64, incX int) int

Index of largest (absoulute) element of the vector X

func Isamax

func Isamax(N int, X []float32, incX int) int

Index of largest (absoulute) element of the vector X

func Sasum

func Sasum(N int, X []float32, incX int) float32

Absolute sum: \sum |X_i|

func Saxpy

func Saxpy(N int, alpha float32, X []float32, incX int, Y []float32, incY int)

Compute the sum Y = \alpha X + Y for the vectors X and Y

func Scopy

func Scopy(N int, X []float32, incX int, Y []float32, incY int)

Copy the elements of the vectors X and Y.

func Sdot

func Sdot(N int, X []float32, incX int, Y []float32, incY int) float32

Scalar product: X^T Y

func Sdsdot

func Sdsdot(N int, alpha float32, X []float32, incX int, Y []float32, incY int) float32

\alpha + X^T Y computed using float64

func Snrm2

func Snrm2(N int, X []float32, incX int) float32

Euclidean norm: ||X||_2 = \sqrt {\sum X_i^2}

func Srot

func Srot(N int, X []float32, incX int, Y []float32, incY int, c, s float32)

Apply a Givens rotation (X', Y') = (c X + s Y, c Y - s X) to the vectors X, Y

func Srotg

func Srotg(a, b float32) (c, s, r, z float32)

Compute a Givens rotation (c,s) which zeroes the vector (a,b)

func Sscal

func Sscal(N int, alpha float32, X []float32, incX int)

Rescale the vector X by the multiplicative factor alpha

func Sswap

func Sswap(N int, X []float32, incX int, Y []float32, incY int)

Exchange the elements of the vectors X and Y.

Types

type DrotmgParam

type DrotmgParam struct {
	// contains filtered or unexported fields
}

func Drotmg

func Drotmg(d1, d2, x1, y1 float64) (p DrotmgParam, rd1, rd2, rx1 float64)

Compute a modified Givens transformation

type Order

type Order int

type Transpose

type Transpose int

Jump to

Keyboard shortcuts

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