Documentation ¶
Overview ¶
Package f64 provides float64 vector primitives.
Index ¶
- func Add(dst, s []float64)
- func AddConst(alpha float64, x []float64)
- func AxpyInc(alpha float64, x, y []float64, n, incX, incY, ix, iy uintptr)
- func AxpyIncTo(dst []float64, incDst, idst uintptr, alpha float64, x, y []float64, ...)
- func AxpyUnitary(alpha float64, x, y []float64)
- func AxpyUnitaryTo(dst []float64, alpha float64, x, y []float64)
- func CumProd(dst, s []float64) []float64
- func CumSum(dst, s []float64) []float64
- func Div(dst, s []float64)
- func DivTo(dst, x, y []float64) []float64
- func DotInc(x, y []float64, n, incX, incY, ix, iy uintptr) (sum float64)
- func DotUnitary(x, y []float64) (sum float64)
- func GemvN(m, n uintptr, alpha float64, a []float64, lda uintptr, x []float64, ...)
- func GemvT(m, n uintptr, alpha float64, a []float64, lda uintptr, x []float64, ...)
- func Ger(m, n uintptr, alpha float64, x []float64, incX uintptr, y []float64, ...)
- func L1Dist(s, t []float64) float64
- func L1Norm(x []float64) (sum float64)
- func L1NormInc(x []float64, n, incX int) (sum float64)
- func L2DistanceUnitary(x, y []float64) (norm float64)
- func L2NormInc(x []float64, n, incX uintptr) (norm float64)
- func L2NormUnitary(x []float64) (norm float64)
- func LinfDist(s, t []float64) float64
- func ScalInc(alpha float64, x []float64, n, incX uintptr)
- func ScalIncTo(dst []float64, incDst uintptr, alpha float64, x []float64, n, incX uintptr)
- func ScalUnitary(alpha float64, x []float64)
- func ScalUnitaryTo(dst []float64, alpha float64, x []float64)
- func Sum(x []float64) float64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AxpyInc ¶
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 CumProd ¶
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 ¶
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 DotInc ¶
DotInc is
for i := 0; i < int(n); i++ { sum += y[iy] * x[ix] ix += incX iy += incY } 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 ¶
L1Dist is
var norm float64 for i, v := range s { norm += math.Abs(t[i] - v) } return norm
func L1NormInc ¶
L1NormInc is
for i := 0; i < n*incX; i += incX { sum += math.Abs(x[i]) } return sum
func L2DistanceUnitary ¶
L2DistanceUnitary returns the L2-norm of x-y.
var scale float64 sumSquares := 1.0 for i, v := range x { v -= y[i] if v == 0 { continue } absxi := math.Abs(v) if math.IsNaN(absxi) { return math.NaN() } if scale < absxi { s := scale / absxi sumSquares = 1 + sumSquares*s*s scale = absxi } else { s := absxi / scale sumSquares += s * s } } if math.IsInf(scale, 1) { return math.Inf(1) } return scale * math.Sqrt(sumSquares)
func L2NormInc ¶
L2NormInc returns the L2-norm of x.
var scale float64 sumSquares := 1.0 for ix := uintptr(0); ix < n*incX; ix += incX { val := x[ix] if val == 0 { continue } absxi := math.Abs(val) if math.IsNaN(absxi) { return math.NaN() } if scale < absxi { s := scale / absxi sumSquares = 1 + sumSquares*s*s scale = absxi } else { s := absxi / scale sumSquares += s * s } } if math.IsInf(scale, 1) { return math.Inf(1) } return scale * math.Sqrt(sumSquares)
func L2NormUnitary ¶
L2NormUnitary returns the L2-norm of x.
var scale float64 sumSquares := 1.0 for _, v := range x { if v == 0 { continue } absxi := math.Abs(v) if math.IsNaN(absxi) { return math.NaN() } if scale < absxi { s := scale / absxi sumSquares = 1 + sumSquares*s*s scale = absxi } else { s := absxi / scale sumSquares += s * s } if math.IsInf(scale, 1) { return math.Inf(1) } } return scale * math.Sqrt(sumSquares)
func LinfDist ¶
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 ScalIncTo ¶
ScalIncTo is
var idst, ix uintptr for i := 0; i < int(n); i++ { dst[idst] = alpha * x[ix] ix += incX idst += incDst }
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.