f64

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2021 License: BSD-2-Clause, BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package f64 provides float64 vector primitives.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(dst, s []float64)

Add is

for i, v := range s {
	dst[i] += v
}

func AddConst

func AddConst(alpha float64, x []float64)

AddConst is

for i := range x {
	x[i] += alpha
}

func AxpyInc

func AxpyInc(alpha float64, x, y []float64, n, incX, incY, ix, iy uintptr)

AxpyInc is

for i := 0; i < int(n); i++ {
	y[iy] += alpha * x[ix]
	ix += incX
	iy += incY
}

func AxpyIncTo

func AxpyIncTo(dst []float64, incDst, idst uintptr, alpha float64, x, y []float64, n, incX, incY, ix, iy uintptr)

AxpyIncTo is

for i := 0; i < int(n); i++ {
	dst[idst] = alpha*x[ix] + y[iy]
	ix += incX
	iy += incY
	idst += incDst
}

func AxpyUnitary

func AxpyUnitary(alpha float64, x, y []float64)

AxpyUnitary is

for i, v := range x {
	y[i] += alpha * v
}

func AxpyUnitaryTo

func AxpyUnitaryTo(dst []float64, alpha float64, x, y []float64)

AxpyUnitaryTo is

for i, v := range x {
	dst[i] = alpha*v + y[i]
}

func CumProd

func CumProd(dst, s []float64) []float64

CumProd is

if len(s) == 0 {
	return dst
}
dst[0] = s[0]
for i, v := range s[1:] {
	dst[i+1] = dst[i] * v
}
return dst

func CumSum

func CumSum(dst, s []float64) []float64

CumSum is

if len(s) == 0 {
	return dst
}
dst[0] = s[0]
for i, v := range s[1:] {
	dst[i+1] = dst[i] + v
}
return dst

func Dgemm

func Dgemm(aTrans, bTrans bool, m, n, k int, alpha float64, a []float64, lda int, b []float64, ldb int, beta float64, c []float64, ldc int)

Dgemm performs one of the matrix-matrix operations

C = alpha * A * B + beta * C
C = alpha * Aᵀ * B + beta * C
C = alpha * A * Bᵀ + beta * C
C = alpha * Aᵀ * Bᵀ + beta * C

where A is an m×k or k×m dense matrix, B is an n×k or k×n dense matrix, C is an m×n matrix, and alpha and beta are scalars. tA and tB specify whether A or B are transposed.

func DgemmSerial

func DgemmSerial(aTrans, bTrans bool, m, n, k int, a []float64, lda int, b []float64, ldb int, c []float64, ldc int, alpha float64)

DgemmSerial is serial matrix multiply

func Div

func Div(dst, s []float64)

Div is

for i, v := range s {
	dst[i] /= v
}

func DivTo

func DivTo(dst, x, y []float64) []float64

DivTo is

for i, v := range s {
	dst[i] = v / t[i]
}
return dst

func DotInc

func DotInc(x, y []float64, n, incX, incY, ix, iy uintptr) (sum float64)

DotInc is

for i := 0; i < int(n); i++ {
	sum += y[iy] * x[ix]
	ix += incX
	iy += incY
}
return sum

func DotUnitary

func DotUnitary(x, y []float64) (sum float64)

DotUnitary is

for i, v := range x {
	sum += y[i] * v
}
return sum

func GemvN

func GemvN(m, n uintptr, alpha float64, a []float64, lda uintptr, x []float64, incX uintptr, beta float64, y []float64, incY uintptr)

GemvN computes

y = alpha * A * x + beta * y

where A is an m×n dense matrix, x and y are vectors, and alpha and beta are scalars.

func GemvT

func GemvT(m, n uintptr, alpha float64, a []float64, lda uintptr, x []float64, incX uintptr, beta float64, y []float64, incY uintptr)

GemvT computes

y = alpha * Aᵀ * x + beta * y

where A is an m×n dense matrix, x and y are vectors, and alpha and beta are scalars.

func Ger

func Ger(m, n uintptr, alpha float64, x []float64, incX uintptr, y []float64, incY uintptr, a []float64, lda uintptr)

Ger performs the rank-one operation

A += alpha * x * yᵀ

where A is an m×n dense matrix, x and y are vectors, and alpha is a scalar.

func L1Dist

func L1Dist(s, t []float64) float64

L1Dist is

var norm float64
for i, v := range s {
	norm += math.Abs(t[i] - v)
}
return norm

func L1Norm

func L1Norm(x []float64) (sum float64)

L1Norm is

for _, v := range x {
	sum += math.Abs(v)
}
return sum

func L1NormInc

func L1NormInc(x []float64, n, incX int) (sum float64)

L1NormInc is

for i := 0; i < n*incX; i += incX {
	sum += math.Abs(x[i])
}
return sum

func LinfDist

func LinfDist(s, t []float64) float64

LinfDist is

var norm float64
if len(s) == 0 {
	return 0
}
norm = math.Abs(t[0] - s[0])
for i, v := range s[1:] {
	absDiff := math.Abs(t[i+1] - v)
	if absDiff > norm || math.IsNaN(norm) {
		norm = absDiff
	}
}
return norm

func ScalInc

func ScalInc(alpha float64, x []float64, n, incX uintptr)

ScalInc is

var ix uintptr
for i := 0; i < int(n); i++ {
	x[ix] *= alpha
	ix += incX
}

func ScalIncTo

func ScalIncTo(dst []float64, incDst uintptr, alpha float64, x []float64, n, incX uintptr)

ScalIncTo is

var idst, ix uintptr
for i := 0; i < int(n); i++ {
	dst[idst] = alpha * x[ix]
	ix += incX
	idst += incDst
}

func ScalUnitary

func ScalUnitary(alpha float64, x []float64)

ScalUnitary is

for i := range x {
	x[i] *= alpha
}

func ScalUnitaryTo

func ScalUnitaryTo(dst []float64, alpha float64, x []float64)

ScalUnitaryTo is

for i, v := range x {
	dst[i] = alpha * v
}

func Sum

func Sum(x []float64) float64

Sum is

var sum float64
for i := range x {
    sum += x[i]
}

Types

This section is empty.

Jump to

Keyboard shortcuts

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