mirror of
https://github.com/gonum/gonum.git
synced 2025-09-26 19:21:17 +08:00
all: run gofmt and generate all packages
Changes made in dsp/fourier/internal/fftpack break the formatting used there, so these are reverted. There will be complaints in CI. [git-generate] gofmt -w . go generate gonum.org/v1/gonum/blas go generate gonum.org/v1/gonum/blas/gonum go generate gonum.org/v1/gonum/unit go generate gonum.org/v1/gonum/unit/constant go generate gonum.org/v1/gonum/graph/formats/dot go generate gonum.org/v1/gonum/graph/formats/rdf go generate gonum.org/v1/gonum/stat/card git checkout -- dsp/fourier/internal/fftpack
This commit is contained in:
@@ -105,7 +105,9 @@ const (
|
||||
)
|
||||
|
||||
// Dot computes the dot product of the two vectors:
|
||||
// \sum_i x[i]*y[i].
|
||||
//
|
||||
// \sum_i x[i]*y[i].
|
||||
//
|
||||
// Dot will panic if the lengths of x and y do not match.
|
||||
func Dot(x, y Vector) float32 {
|
||||
if x.N != y.N {
|
||||
@@ -115,7 +117,9 @@ func Dot(x, y Vector) float32 {
|
||||
}
|
||||
|
||||
// DDot computes the dot product of the two vectors:
|
||||
// \sum_i x[i]*y[i].
|
||||
//
|
||||
// \sum_i x[i]*y[i].
|
||||
//
|
||||
// DDot will panic if the lengths of x and y do not match.
|
||||
func DDot(x, y Vector) float64 {
|
||||
if x.N != y.N {
|
||||
@@ -125,7 +129,9 @@ func DDot(x, y Vector) float64 {
|
||||
}
|
||||
|
||||
// SDDot computes the dot product of the two vectors adding a constant:
|
||||
// alpha + \sum_i x[i]*y[i].
|
||||
//
|
||||
// alpha + \sum_i x[i]*y[i].
|
||||
//
|
||||
// SDDot will panic if the lengths of x and y do not match.
|
||||
func SDDot(alpha float32, x, y Vector) float32 {
|
||||
if x.N != y.N {
|
||||
@@ -135,7 +141,8 @@ func SDDot(alpha float32, x, y Vector) float32 {
|
||||
}
|
||||
|
||||
// Nrm2 computes the Euclidean norm of the vector x:
|
||||
// sqrt(\sum_i x[i]*x[i]).
|
||||
//
|
||||
// sqrt(\sum_i x[i]*x[i]).
|
||||
//
|
||||
// Nrm2 will panic if the vector increment is negative.
|
||||
func Nrm2(x Vector) float32 {
|
||||
@@ -146,7 +153,8 @@ func Nrm2(x Vector) float32 {
|
||||
}
|
||||
|
||||
// Asum computes the sum of the absolute values of the elements of x:
|
||||
// \sum_i |x[i]|.
|
||||
//
|
||||
// \sum_i |x[i]|.
|
||||
//
|
||||
// Asum will panic if the vector increment is negative.
|
||||
func Asum(x Vector) float32 {
|
||||
@@ -169,7 +177,9 @@ func Iamax(x Vector) int {
|
||||
}
|
||||
|
||||
// Swap exchanges the elements of the two vectors:
|
||||
// x[i], y[i] = y[i], x[i] for all i.
|
||||
//
|
||||
// x[i], y[i] = y[i], x[i] for all i.
|
||||
//
|
||||
// Swap will panic if the lengths of x and y do not match.
|
||||
func Swap(x, y Vector) {
|
||||
if x.N != y.N {
|
||||
@@ -179,7 +189,9 @@ func Swap(x, y Vector) {
|
||||
}
|
||||
|
||||
// Copy copies the elements of x into the elements of y:
|
||||
// y[i] = x[i] for all i.
|
||||
//
|
||||
// y[i] = x[i] for all i.
|
||||
//
|
||||
// Copy will panic if the lengths of x and y do not match.
|
||||
func Copy(x, y Vector) {
|
||||
if x.N != y.N {
|
||||
@@ -189,7 +201,9 @@ func Copy(x, y Vector) {
|
||||
}
|
||||
|
||||
// Axpy adds x scaled by alpha to y:
|
||||
// y[i] += alpha*x[i] for all i.
|
||||
//
|
||||
// y[i] += alpha*x[i] for all i.
|
||||
//
|
||||
// Axpy will panic if the lengths of x and y do not match.
|
||||
func Axpy(alpha float32, x, y Vector) {
|
||||
if x.N != y.N {
|
||||
@@ -199,17 +213,22 @@ func Axpy(alpha float32, x, y Vector) {
|
||||
}
|
||||
|
||||
// Rotg computes the parameters of a Givens plane rotation so that
|
||||
// ⎡ c s⎤ ⎡a⎤ ⎡r⎤
|
||||
// ⎣-s c⎦ * ⎣b⎦ = ⎣0⎦
|
||||
//
|
||||
// ⎡ c s⎤ ⎡a⎤ ⎡r⎤
|
||||
// ⎣-s c⎦ * ⎣b⎦ = ⎣0⎦
|
||||
//
|
||||
// where a and b are the Cartesian coordinates of a given point.
|
||||
// c, s, and r are defined as
|
||||
// r = ±Sqrt(a^2 + b^2),
|
||||
// c = a/r, the cosine of the rotation angle,
|
||||
// s = a/r, the sine of the rotation angle,
|
||||
//
|
||||
// r = ±Sqrt(a^2 + b^2),
|
||||
// c = a/r, the cosine of the rotation angle,
|
||||
// s = a/r, the sine of the rotation angle,
|
||||
//
|
||||
// and z is defined such that
|
||||
// if |a| > |b|, z = s,
|
||||
// otherwise if c != 0, z = 1/c,
|
||||
// otherwise z = 1.
|
||||
//
|
||||
// if |a| > |b|, z = s,
|
||||
// otherwise if c != 0, z = 1/c,
|
||||
// otherwise z = 1.
|
||||
func Rotg(a, b float32) (c, s, r, z float32) {
|
||||
return blas32.Srotg(a, b)
|
||||
}
|
||||
@@ -223,8 +242,9 @@ func Rotmg(d1, d2, b1, b2 float32) (p blas.SrotmParams, rd1, rd2, rb1 float32) {
|
||||
|
||||
// Rot applies a plane transformation to n points represented by the vectors x
|
||||
// and y:
|
||||
// x[i] = c*x[i] + s*y[i],
|
||||
// y[i] = -s*x[i] + c*y[i], for all i.
|
||||
//
|
||||
// x[i] = c*x[i] + s*y[i],
|
||||
// y[i] = -s*x[i] + c*y[i], for all i.
|
||||
func Rot(n int, x, y Vector, c, s float32) {
|
||||
blas32.Srot(n, x.Data, x.Inc, y.Data, y.Inc, c, s)
|
||||
}
|
||||
@@ -236,7 +256,8 @@ func Rotm(n int, x, y Vector, p blas.SrotmParams) {
|
||||
}
|
||||
|
||||
// Scal scales the vector x by alpha:
|
||||
// x[i] *= alpha for all i.
|
||||
//
|
||||
// x[i] *= alpha for all i.
|
||||
//
|
||||
// Scal will panic if the vector increment is negative.
|
||||
func Scal(alpha float32, x Vector) {
|
||||
@@ -249,48 +270,60 @@ func Scal(alpha float32, x Vector) {
|
||||
// Level 2
|
||||
|
||||
// Gemv computes
|
||||
// y = alpha * A * x + beta * y if t == blas.NoTrans,
|
||||
// y = alpha * Aᵀ * x + beta * y if t == blas.Trans or blas.ConjTrans,
|
||||
//
|
||||
// y = alpha * A * x + beta * y if t == blas.NoTrans,
|
||||
// y = alpha * Aᵀ * x + beta * y if t == blas.Trans or blas.ConjTrans,
|
||||
//
|
||||
// where A is an m×n dense matrix, x and y are vectors, and alpha and beta are scalars.
|
||||
func Gemv(t blas.Transpose, alpha float32, a General, x Vector, beta float32, y Vector) {
|
||||
blas32.Sgemv(t, a.Rows, a.Cols, alpha, a.Data, a.Stride, x.Data, x.Inc, beta, y.Data, y.Inc)
|
||||
}
|
||||
|
||||
// Gbmv computes
|
||||
// y = alpha * A * x + beta * y if t == blas.NoTrans,
|
||||
// y = alpha * Aᵀ * x + beta * y if t == blas.Trans or blas.ConjTrans,
|
||||
//
|
||||
// y = alpha * A * x + beta * y if t == blas.NoTrans,
|
||||
// y = alpha * Aᵀ * x + beta * y if t == blas.Trans or blas.ConjTrans,
|
||||
//
|
||||
// where A is an m×n band matrix, x and y are vectors, and alpha and beta are scalars.
|
||||
func Gbmv(t blas.Transpose, alpha float32, a Band, x Vector, beta float32, y Vector) {
|
||||
blas32.Sgbmv(t, a.Rows, a.Cols, a.KL, a.KU, alpha, a.Data, a.Stride, x.Data, x.Inc, beta, y.Data, y.Inc)
|
||||
}
|
||||
|
||||
// Trmv computes
|
||||
// x = A * x if t == blas.NoTrans,
|
||||
// x = Aᵀ * x if t == blas.Trans or blas.ConjTrans,
|
||||
//
|
||||
// x = A * x if t == blas.NoTrans,
|
||||
// x = Aᵀ * x if t == blas.Trans or blas.ConjTrans,
|
||||
//
|
||||
// where A is an n×n triangular matrix, and x is a vector.
|
||||
func Trmv(t blas.Transpose, a Triangular, x Vector) {
|
||||
blas32.Strmv(a.Uplo, t, a.Diag, a.N, a.Data, a.Stride, x.Data, x.Inc)
|
||||
}
|
||||
|
||||
// Tbmv computes
|
||||
// x = A * x if t == blas.NoTrans,
|
||||
// x = Aᵀ * x if t == blas.Trans or blas.ConjTrans,
|
||||
//
|
||||
// x = A * x if t == blas.NoTrans,
|
||||
// x = Aᵀ * x if t == blas.Trans or blas.ConjTrans,
|
||||
//
|
||||
// where A is an n×n triangular band matrix, and x is a vector.
|
||||
func Tbmv(t blas.Transpose, a TriangularBand, x Vector) {
|
||||
blas32.Stbmv(a.Uplo, t, a.Diag, a.N, a.K, a.Data, a.Stride, x.Data, x.Inc)
|
||||
}
|
||||
|
||||
// Tpmv computes
|
||||
// x = A * x if t == blas.NoTrans,
|
||||
// x = Aᵀ * x if t == blas.Trans or blas.ConjTrans,
|
||||
//
|
||||
// x = A * x if t == blas.NoTrans,
|
||||
// x = Aᵀ * x if t == blas.Trans or blas.ConjTrans,
|
||||
//
|
||||
// where A is an n×n triangular matrix in packed format, and x is a vector.
|
||||
func Tpmv(t blas.Transpose, a TriangularPacked, x Vector) {
|
||||
blas32.Stpmv(a.Uplo, t, a.Diag, a.N, a.Data, x.Data, x.Inc)
|
||||
}
|
||||
|
||||
// Trsv solves
|
||||
// A * x = b if t == blas.NoTrans,
|
||||
// Aᵀ * x = b if t == blas.Trans or blas.ConjTrans,
|
||||
//
|
||||
// A * x = b if t == blas.NoTrans,
|
||||
// Aᵀ * x = b if t == blas.Trans or blas.ConjTrans,
|
||||
//
|
||||
// where A is an n×n triangular matrix, and x and b are vectors.
|
||||
//
|
||||
// At entry to the function, x contains the values of b, and the result is
|
||||
@@ -303,8 +336,10 @@ func Trsv(t blas.Transpose, a Triangular, x Vector) {
|
||||
}
|
||||
|
||||
// Tbsv solves
|
||||
// A * x = b if t == blas.NoTrans,
|
||||
// Aᵀ * x = b if t == blas.Trans or blas.ConjTrans,
|
||||
//
|
||||
// A * x = b if t == blas.NoTrans,
|
||||
// Aᵀ * x = b if t == blas.Trans or blas.ConjTrans,
|
||||
//
|
||||
// where A is an n×n triangular band matrix, and x and b are vectors.
|
||||
//
|
||||
// At entry to the function, x contains the values of b, and the result is
|
||||
@@ -317,8 +352,10 @@ func Tbsv(t blas.Transpose, a TriangularBand, x Vector) {
|
||||
}
|
||||
|
||||
// Tpsv solves
|
||||
// A * x = b if t == blas.NoTrans,
|
||||
// Aᵀ * x = b if t == blas.Trans or blas.ConjTrans,
|
||||
//
|
||||
// A * x = b if t == blas.NoTrans,
|
||||
// Aᵀ * x = b if t == blas.Trans or blas.ConjTrans,
|
||||
//
|
||||
// where A is an n×n triangular matrix in packed format, and x and b are
|
||||
// vectors.
|
||||
//
|
||||
@@ -332,7 +369,9 @@ func Tpsv(t blas.Transpose, a TriangularPacked, x Vector) {
|
||||
}
|
||||
|
||||
// Symv computes
|
||||
// y = alpha * A * x + beta * y,
|
||||
//
|
||||
// y = alpha * A * x + beta * y,
|
||||
//
|
||||
// where A is an n×n symmetric matrix, x and y are vectors, and alpha and
|
||||
// beta are scalars.
|
||||
func Symv(alpha float32, a Symmetric, x Vector, beta float32, y Vector) {
|
||||
@@ -340,7 +379,9 @@ func Symv(alpha float32, a Symmetric, x Vector, beta float32, y Vector) {
|
||||
}
|
||||
|
||||
// Sbmv performs
|
||||
// y = alpha * A * x + beta * y,
|
||||
//
|
||||
// y = alpha * A * x + beta * y,
|
||||
//
|
||||
// where A is an n×n symmetric band matrix, x and y are vectors, and alpha
|
||||
// and beta are scalars.
|
||||
func Sbmv(alpha float32, a SymmetricBand, x Vector, beta float32, y Vector) {
|
||||
@@ -348,7 +389,9 @@ func Sbmv(alpha float32, a SymmetricBand, x Vector, beta float32, y Vector) {
|
||||
}
|
||||
|
||||
// Spmv performs
|
||||
// y = alpha * A * x + beta * y,
|
||||
//
|
||||
// y = alpha * A * x + beta * y,
|
||||
//
|
||||
// where A is an n×n symmetric matrix in packed format, x and y are vectors,
|
||||
// and alpha and beta are scalars.
|
||||
func Spmv(alpha float32, a SymmetricPacked, x Vector, beta float32, y Vector) {
|
||||
@@ -356,21 +399,27 @@ func Spmv(alpha float32, a SymmetricPacked, x Vector, beta float32, y Vector) {
|
||||
}
|
||||
|
||||
// Ger performs a rank-1 update
|
||||
// A += alpha * x * yᵀ,
|
||||
//
|
||||
// A += alpha * x * yᵀ,
|
||||
//
|
||||
// where A is an m×n dense matrix, x and y are vectors, and alpha is a scalar.
|
||||
func Ger(alpha float32, x, y Vector, a General) {
|
||||
blas32.Sger(a.Rows, a.Cols, alpha, x.Data, x.Inc, y.Data, y.Inc, a.Data, a.Stride)
|
||||
}
|
||||
|
||||
// Syr performs a rank-1 update
|
||||
// A += alpha * x * xᵀ,
|
||||
//
|
||||
// A += alpha * x * xᵀ,
|
||||
//
|
||||
// where A is an n×n symmetric matrix, x is a vector, and alpha is a scalar.
|
||||
func Syr(alpha float32, x Vector, a Symmetric) {
|
||||
blas32.Ssyr(a.Uplo, a.N, alpha, x.Data, x.Inc, a.Data, a.Stride)
|
||||
}
|
||||
|
||||
// Spr performs the rank-1 update
|
||||
// A += alpha * x * xᵀ,
|
||||
//
|
||||
// A += alpha * x * xᵀ,
|
||||
//
|
||||
// where A is an n×n symmetric matrix in packed format, x is a vector, and
|
||||
// alpha is a scalar.
|
||||
func Spr(alpha float32, x Vector, a SymmetricPacked) {
|
||||
@@ -378,14 +427,18 @@ func Spr(alpha float32, x Vector, a SymmetricPacked) {
|
||||
}
|
||||
|
||||
// Syr2 performs a rank-2 update
|
||||
// A += alpha * x * yᵀ + alpha * y * xᵀ,
|
||||
//
|
||||
// A += alpha * x * yᵀ + alpha * y * xᵀ,
|
||||
//
|
||||
// where A is a symmetric n×n matrix, x and y are vectors, and alpha is a scalar.
|
||||
func Syr2(alpha float32, x, y Vector, a Symmetric) {
|
||||
blas32.Ssyr2(a.Uplo, a.N, alpha, x.Data, x.Inc, y.Data, y.Inc, a.Data, a.Stride)
|
||||
}
|
||||
|
||||
// Spr2 performs a rank-2 update
|
||||
// A += alpha * x * yᵀ + alpha * y * xᵀ,
|
||||
//
|
||||
// A += alpha * x * yᵀ + alpha * y * xᵀ,
|
||||
//
|
||||
// where A is an n×n symmetric matrix in packed format, x and y are vectors,
|
||||
// and alpha is a scalar.
|
||||
func Spr2(alpha float32, x, y Vector, a SymmetricPacked) {
|
||||
@@ -395,7 +448,9 @@ func Spr2(alpha float32, x, y Vector, a SymmetricPacked) {
|
||||
// Level 3
|
||||
|
||||
// Gemm computes
|
||||
// C = alpha * A * B + beta * C,
|
||||
//
|
||||
// C = alpha * A * B + beta * C,
|
||||
//
|
||||
// where A, B, and C are dense matrices, and alpha and beta are scalars.
|
||||
// tA and tB specify whether A or B are transposed.
|
||||
func Gemm(tA, tB blas.Transpose, alpha float32, a, b General, beta float32, c General) {
|
||||
@@ -414,8 +469,10 @@ func Gemm(tA, tB blas.Transpose, alpha float32, a, b General, beta float32, c Ge
|
||||
}
|
||||
|
||||
// Symm performs
|
||||
// C = alpha * A * B + beta * C if s == blas.Left,
|
||||
// C = alpha * B * A + beta * C if s == blas.Right,
|
||||
//
|
||||
// C = alpha * A * B + beta * C if s == blas.Left,
|
||||
// C = alpha * B * A + beta * C if s == blas.Right,
|
||||
//
|
||||
// where A is an n×n or m×m symmetric matrix, B and C are m×n matrices, and
|
||||
// alpha is a scalar.
|
||||
func Symm(s blas.Side, alpha float32, a Symmetric, b General, beta float32, c General) {
|
||||
@@ -429,8 +486,10 @@ func Symm(s blas.Side, alpha float32, a Symmetric, b General, beta float32, c Ge
|
||||
}
|
||||
|
||||
// Syrk performs a symmetric rank-k update
|
||||
// C = alpha * A * Aᵀ + beta * C if t == blas.NoTrans,
|
||||
// C = alpha * Aᵀ * A + beta * C if t == blas.Trans or blas.ConjTrans,
|
||||
//
|
||||
// C = alpha * A * Aᵀ + beta * C if t == blas.NoTrans,
|
||||
// C = alpha * Aᵀ * A + beta * C if t == blas.Trans or blas.ConjTrans,
|
||||
//
|
||||
// where C is an n×n symmetric matrix, A is an n×k matrix if t == blas.NoTrans and
|
||||
// a k×n matrix otherwise, and alpha and beta are scalars.
|
||||
func Syrk(t blas.Transpose, alpha float32, a General, beta float32, c Symmetric) {
|
||||
@@ -444,8 +503,10 @@ func Syrk(t blas.Transpose, alpha float32, a General, beta float32, c Symmetric)
|
||||
}
|
||||
|
||||
// Syr2k performs a symmetric rank-2k update
|
||||
// C = alpha * A * Bᵀ + alpha * B * Aᵀ + beta * C if t == blas.NoTrans,
|
||||
// C = alpha * Aᵀ * B + alpha * Bᵀ * A + beta * C if t == blas.Trans or blas.ConjTrans,
|
||||
//
|
||||
// C = alpha * A * Bᵀ + alpha * B * Aᵀ + beta * C if t == blas.NoTrans,
|
||||
// C = alpha * Aᵀ * B + alpha * Bᵀ * A + beta * C if t == blas.Trans or blas.ConjTrans,
|
||||
//
|
||||
// where C is an n×n symmetric matrix, A and B are n×k matrices if t == NoTrans
|
||||
// and k×n matrices otherwise, and alpha and beta are scalars.
|
||||
func Syr2k(t blas.Transpose, alpha float32, a, b General, beta float32, c Symmetric) {
|
||||
@@ -459,10 +520,12 @@ func Syr2k(t blas.Transpose, alpha float32, a, b General, beta float32, c Symmet
|
||||
}
|
||||
|
||||
// Trmm performs
|
||||
// B = alpha * A * B if tA == blas.NoTrans and s == blas.Left,
|
||||
// B = alpha * Aᵀ * B if tA == blas.Trans or blas.ConjTrans, and s == blas.Left,
|
||||
// B = alpha * B * A if tA == blas.NoTrans and s == blas.Right,
|
||||
// B = alpha * B * Aᵀ if tA == blas.Trans or blas.ConjTrans, and s == blas.Right,
|
||||
//
|
||||
// B = alpha * A * B if tA == blas.NoTrans and s == blas.Left,
|
||||
// B = alpha * Aᵀ * B if tA == blas.Trans or blas.ConjTrans, and s == blas.Left,
|
||||
// B = alpha * B * A if tA == blas.NoTrans and s == blas.Right,
|
||||
// B = alpha * B * Aᵀ if tA == blas.Trans or blas.ConjTrans, and s == blas.Right,
|
||||
//
|
||||
// where A is an n×n or m×m triangular matrix, B is an m×n matrix, and alpha is
|
||||
// a scalar.
|
||||
func Trmm(s blas.Side, tA blas.Transpose, alpha float32, a Triangular, b General) {
|
||||
@@ -470,10 +533,12 @@ func Trmm(s blas.Side, tA blas.Transpose, alpha float32, a Triangular, b General
|
||||
}
|
||||
|
||||
// Trsm solves
|
||||
// A * X = alpha * B if tA == blas.NoTrans and s == blas.Left,
|
||||
// Aᵀ * X = alpha * B if tA == blas.Trans or blas.ConjTrans, and s == blas.Left,
|
||||
// X * A = alpha * B if tA == blas.NoTrans and s == blas.Right,
|
||||
// X * Aᵀ = alpha * B if tA == blas.Trans or blas.ConjTrans, and s == blas.Right,
|
||||
//
|
||||
// A * X = alpha * B if tA == blas.NoTrans and s == blas.Left,
|
||||
// Aᵀ * X = alpha * B if tA == blas.Trans or blas.ConjTrans, and s == blas.Left,
|
||||
// X * A = alpha * B if tA == blas.NoTrans and s == blas.Right,
|
||||
// X * Aᵀ = alpha * B if tA == blas.Trans or blas.ConjTrans, and s == blas.Right,
|
||||
//
|
||||
// where A is an n×n or m×m triangular matrix, X and B are m×n matrices, and
|
||||
// alpha is a scalar.
|
||||
//
|
||||
|
@@ -105,7 +105,9 @@ const (
|
||||
)
|
||||
|
||||
// Dot computes the dot product of the two vectors:
|
||||
// \sum_i x[i]*y[i].
|
||||
//
|
||||
// \sum_i x[i]*y[i].
|
||||
//
|
||||
// Dot will panic if the lengths of x and y do not match.
|
||||
func Dot(x, y Vector) float64 {
|
||||
if x.N != y.N {
|
||||
@@ -115,7 +117,8 @@ func Dot(x, y Vector) float64 {
|
||||
}
|
||||
|
||||
// Nrm2 computes the Euclidean norm of the vector x:
|
||||
// sqrt(\sum_i x[i]*x[i]).
|
||||
//
|
||||
// sqrt(\sum_i x[i]*x[i]).
|
||||
//
|
||||
// Nrm2 will panic if the vector increment is negative.
|
||||
func Nrm2(x Vector) float64 {
|
||||
@@ -126,7 +129,8 @@ func Nrm2(x Vector) float64 {
|
||||
}
|
||||
|
||||
// Asum computes the sum of the absolute values of the elements of x:
|
||||
// \sum_i |x[i]|.
|
||||
//
|
||||
// \sum_i |x[i]|.
|
||||
//
|
||||
// Asum will panic if the vector increment is negative.
|
||||
func Asum(x Vector) float64 {
|
||||
@@ -149,7 +153,9 @@ func Iamax(x Vector) int {
|
||||
}
|
||||
|
||||
// Swap exchanges the elements of the two vectors:
|
||||
// x[i], y[i] = y[i], x[i] for all i.
|
||||
//
|
||||
// x[i], y[i] = y[i], x[i] for all i.
|
||||
//
|
||||
// Swap will panic if the lengths of x and y do not match.
|
||||
func Swap(x, y Vector) {
|
||||
if x.N != y.N {
|
||||
@@ -159,7 +165,9 @@ func Swap(x, y Vector) {
|
||||
}
|
||||
|
||||
// Copy copies the elements of x into the elements of y:
|
||||
// y[i] = x[i] for all i.
|
||||
//
|
||||
// y[i] = x[i] for all i.
|
||||
//
|
||||
// Copy will panic if the lengths of x and y do not match.
|
||||
func Copy(x, y Vector) {
|
||||
if x.N != y.N {
|
||||
@@ -169,7 +177,9 @@ func Copy(x, y Vector) {
|
||||
}
|
||||
|
||||
// Axpy adds x scaled by alpha to y:
|
||||
// y[i] += alpha*x[i] for all i.
|
||||
//
|
||||
// y[i] += alpha*x[i] for all i.
|
||||
//
|
||||
// Axpy will panic if the lengths of x and y do not match.
|
||||
func Axpy(alpha float64, x, y Vector) {
|
||||
if x.N != y.N {
|
||||
@@ -179,17 +189,22 @@ func Axpy(alpha float64, x, y Vector) {
|
||||
}
|
||||
|
||||
// Rotg computes the parameters of a Givens plane rotation so that
|
||||
// ⎡ c s⎤ ⎡a⎤ ⎡r⎤
|
||||
// ⎣-s c⎦ * ⎣b⎦ = ⎣0⎦
|
||||
//
|
||||
// ⎡ c s⎤ ⎡a⎤ ⎡r⎤
|
||||
// ⎣-s c⎦ * ⎣b⎦ = ⎣0⎦
|
||||
//
|
||||
// where a and b are the Cartesian coordinates of a given point.
|
||||
// c, s, and r are defined as
|
||||
// r = ±Sqrt(a^2 + b^2),
|
||||
// c = a/r, the cosine of the rotation angle,
|
||||
// s = a/r, the sine of the rotation angle,
|
||||
//
|
||||
// r = ±Sqrt(a^2 + b^2),
|
||||
// c = a/r, the cosine of the rotation angle,
|
||||
// s = a/r, the sine of the rotation angle,
|
||||
//
|
||||
// and z is defined such that
|
||||
// if |a| > |b|, z = s,
|
||||
// otherwise if c != 0, z = 1/c,
|
||||
// otherwise z = 1.
|
||||
//
|
||||
// if |a| > |b|, z = s,
|
||||
// otherwise if c != 0, z = 1/c,
|
||||
// otherwise z = 1.
|
||||
func Rotg(a, b float64) (c, s, r, z float64) {
|
||||
return blas64.Drotg(a, b)
|
||||
}
|
||||
@@ -203,8 +218,9 @@ func Rotmg(d1, d2, b1, b2 float64) (p blas.DrotmParams, rd1, rd2, rb1 float64) {
|
||||
|
||||
// Rot applies a plane transformation to n points represented by the vectors x
|
||||
// and y:
|
||||
// x[i] = c*x[i] + s*y[i],
|
||||
// y[i] = -s*x[i] + c*y[i], for all i.
|
||||
//
|
||||
// x[i] = c*x[i] + s*y[i],
|
||||
// y[i] = -s*x[i] + c*y[i], for all i.
|
||||
func Rot(x, y Vector, c, s float64) {
|
||||
if x.N != y.N {
|
||||
panic(badLength)
|
||||
@@ -222,7 +238,8 @@ func Rotm(x, y Vector, p blas.DrotmParams) {
|
||||
}
|
||||
|
||||
// Scal scales the vector x by alpha:
|
||||
// x[i] *= alpha for all i.
|
||||
//
|
||||
// x[i] *= alpha for all i.
|
||||
//
|
||||
// Scal will panic if the vector increment is negative.
|
||||
func Scal(alpha float64, x Vector) {
|
||||
@@ -235,48 +252,60 @@ func Scal(alpha float64, x Vector) {
|
||||
// Level 2
|
||||
|
||||
// Gemv computes
|
||||
// y = alpha * A * x + beta * y if t == blas.NoTrans,
|
||||
// y = alpha * Aᵀ * x + beta * y if t == blas.Trans or blas.ConjTrans,
|
||||
//
|
||||
// y = alpha * A * x + beta * y if t == blas.NoTrans,
|
||||
// y = alpha * Aᵀ * x + beta * y if t == blas.Trans or blas.ConjTrans,
|
||||
//
|
||||
// where A is an m×n dense matrix, x and y are vectors, and alpha and beta are scalars.
|
||||
func Gemv(t blas.Transpose, alpha float64, a General, x Vector, beta float64, y Vector) {
|
||||
blas64.Dgemv(t, a.Rows, a.Cols, alpha, a.Data, a.Stride, x.Data, x.Inc, beta, y.Data, y.Inc)
|
||||
}
|
||||
|
||||
// Gbmv computes
|
||||
// y = alpha * A * x + beta * y if t == blas.NoTrans,
|
||||
// y = alpha * Aᵀ * x + beta * y if t == blas.Trans or blas.ConjTrans,
|
||||
//
|
||||
// y = alpha * A * x + beta * y if t == blas.NoTrans,
|
||||
// y = alpha * Aᵀ * x + beta * y if t == blas.Trans or blas.ConjTrans,
|
||||
//
|
||||
// where A is an m×n band matrix, x and y are vectors, and alpha and beta are scalars.
|
||||
func Gbmv(t blas.Transpose, alpha float64, a Band, x Vector, beta float64, y Vector) {
|
||||
blas64.Dgbmv(t, a.Rows, a.Cols, a.KL, a.KU, alpha, a.Data, a.Stride, x.Data, x.Inc, beta, y.Data, y.Inc)
|
||||
}
|
||||
|
||||
// Trmv computes
|
||||
// x = A * x if t == blas.NoTrans,
|
||||
// x = Aᵀ * x if t == blas.Trans or blas.ConjTrans,
|
||||
//
|
||||
// x = A * x if t == blas.NoTrans,
|
||||
// x = Aᵀ * x if t == blas.Trans or blas.ConjTrans,
|
||||
//
|
||||
// where A is an n×n triangular matrix, and x is a vector.
|
||||
func Trmv(t blas.Transpose, a Triangular, x Vector) {
|
||||
blas64.Dtrmv(a.Uplo, t, a.Diag, a.N, a.Data, a.Stride, x.Data, x.Inc)
|
||||
}
|
||||
|
||||
// Tbmv computes
|
||||
// x = A * x if t == blas.NoTrans,
|
||||
// x = Aᵀ * x if t == blas.Trans or blas.ConjTrans,
|
||||
//
|
||||
// x = A * x if t == blas.NoTrans,
|
||||
// x = Aᵀ * x if t == blas.Trans or blas.ConjTrans,
|
||||
//
|
||||
// where A is an n×n triangular band matrix, and x is a vector.
|
||||
func Tbmv(t blas.Transpose, a TriangularBand, x Vector) {
|
||||
blas64.Dtbmv(a.Uplo, t, a.Diag, a.N, a.K, a.Data, a.Stride, x.Data, x.Inc)
|
||||
}
|
||||
|
||||
// Tpmv computes
|
||||
// x = A * x if t == blas.NoTrans,
|
||||
// x = Aᵀ * x if t == blas.Trans or blas.ConjTrans,
|
||||
//
|
||||
// x = A * x if t == blas.NoTrans,
|
||||
// x = Aᵀ * x if t == blas.Trans or blas.ConjTrans,
|
||||
//
|
||||
// where A is an n×n triangular matrix in packed format, and x is a vector.
|
||||
func Tpmv(t blas.Transpose, a TriangularPacked, x Vector) {
|
||||
blas64.Dtpmv(a.Uplo, t, a.Diag, a.N, a.Data, x.Data, x.Inc)
|
||||
}
|
||||
|
||||
// Trsv solves
|
||||
// A * x = b if t == blas.NoTrans,
|
||||
// Aᵀ * x = b if t == blas.Trans or blas.ConjTrans,
|
||||
//
|
||||
// A * x = b if t == blas.NoTrans,
|
||||
// Aᵀ * x = b if t == blas.Trans or blas.ConjTrans,
|
||||
//
|
||||
// where A is an n×n triangular matrix, and x and b are vectors.
|
||||
//
|
||||
// At entry to the function, x contains the values of b, and the result is
|
||||
@@ -289,8 +318,10 @@ func Trsv(t blas.Transpose, a Triangular, x Vector) {
|
||||
}
|
||||
|
||||
// Tbsv solves
|
||||
// A * x = b if t == blas.NoTrans,
|
||||
// Aᵀ * x = b if t == blas.Trans or blas.ConjTrans,
|
||||
//
|
||||
// A * x = b if t == blas.NoTrans,
|
||||
// Aᵀ * x = b if t == blas.Trans or blas.ConjTrans,
|
||||
//
|
||||
// where A is an n×n triangular band matrix, and x and b are vectors.
|
||||
//
|
||||
// At entry to the function, x contains the values of b, and the result is
|
||||
@@ -303,8 +334,10 @@ func Tbsv(t blas.Transpose, a TriangularBand, x Vector) {
|
||||
}
|
||||
|
||||
// Tpsv solves
|
||||
// A * x = b if t == blas.NoTrans,
|
||||
// Aᵀ * x = b if t == blas.Trans or blas.ConjTrans,
|
||||
//
|
||||
// A * x = b if t == blas.NoTrans,
|
||||
// Aᵀ * x = b if t == blas.Trans or blas.ConjTrans,
|
||||
//
|
||||
// where A is an n×n triangular matrix in packed format, and x and b are
|
||||
// vectors.
|
||||
//
|
||||
@@ -318,7 +351,9 @@ func Tpsv(t blas.Transpose, a TriangularPacked, x Vector) {
|
||||
}
|
||||
|
||||
// Symv computes
|
||||
// y = alpha * A * x + beta * y,
|
||||
//
|
||||
// y = alpha * A * x + beta * y,
|
||||
//
|
||||
// where A is an n×n symmetric matrix, x and y are vectors, and alpha and
|
||||
// beta are scalars.
|
||||
func Symv(alpha float64, a Symmetric, x Vector, beta float64, y Vector) {
|
||||
@@ -326,7 +361,9 @@ func Symv(alpha float64, a Symmetric, x Vector, beta float64, y Vector) {
|
||||
}
|
||||
|
||||
// Sbmv performs
|
||||
// y = alpha * A * x + beta * y,
|
||||
//
|
||||
// y = alpha * A * x + beta * y,
|
||||
//
|
||||
// where A is an n×n symmetric band matrix, x and y are vectors, and alpha
|
||||
// and beta are scalars.
|
||||
func Sbmv(alpha float64, a SymmetricBand, x Vector, beta float64, y Vector) {
|
||||
@@ -334,7 +371,9 @@ func Sbmv(alpha float64, a SymmetricBand, x Vector, beta float64, y Vector) {
|
||||
}
|
||||
|
||||
// Spmv performs
|
||||
// y = alpha * A * x + beta * y,
|
||||
//
|
||||
// y = alpha * A * x + beta * y,
|
||||
//
|
||||
// where A is an n×n symmetric matrix in packed format, x and y are vectors,
|
||||
// and alpha and beta are scalars.
|
||||
func Spmv(alpha float64, a SymmetricPacked, x Vector, beta float64, y Vector) {
|
||||
@@ -342,21 +381,27 @@ func Spmv(alpha float64, a SymmetricPacked, x Vector, beta float64, y Vector) {
|
||||
}
|
||||
|
||||
// Ger performs a rank-1 update
|
||||
// A += alpha * x * yᵀ,
|
||||
//
|
||||
// A += alpha * x * yᵀ,
|
||||
//
|
||||
// where A is an m×n dense matrix, x and y are vectors, and alpha is a scalar.
|
||||
func Ger(alpha float64, x, y Vector, a General) {
|
||||
blas64.Dger(a.Rows, a.Cols, alpha, x.Data, x.Inc, y.Data, y.Inc, a.Data, a.Stride)
|
||||
}
|
||||
|
||||
// Syr performs a rank-1 update
|
||||
// A += alpha * x * xᵀ,
|
||||
//
|
||||
// A += alpha * x * xᵀ,
|
||||
//
|
||||
// where A is an n×n symmetric matrix, x is a vector, and alpha is a scalar.
|
||||
func Syr(alpha float64, x Vector, a Symmetric) {
|
||||
blas64.Dsyr(a.Uplo, a.N, alpha, x.Data, x.Inc, a.Data, a.Stride)
|
||||
}
|
||||
|
||||
// Spr performs the rank-1 update
|
||||
// A += alpha * x * xᵀ,
|
||||
//
|
||||
// A += alpha * x * xᵀ,
|
||||
//
|
||||
// where A is an n×n symmetric matrix in packed format, x is a vector, and
|
||||
// alpha is a scalar.
|
||||
func Spr(alpha float64, x Vector, a SymmetricPacked) {
|
||||
@@ -364,14 +409,18 @@ func Spr(alpha float64, x Vector, a SymmetricPacked) {
|
||||
}
|
||||
|
||||
// Syr2 performs a rank-2 update
|
||||
// A += alpha * x * yᵀ + alpha * y * xᵀ,
|
||||
//
|
||||
// A += alpha * x * yᵀ + alpha * y * xᵀ,
|
||||
//
|
||||
// where A is a symmetric n×n matrix, x and y are vectors, and alpha is a scalar.
|
||||
func Syr2(alpha float64, x, y Vector, a Symmetric) {
|
||||
blas64.Dsyr2(a.Uplo, a.N, alpha, x.Data, x.Inc, y.Data, y.Inc, a.Data, a.Stride)
|
||||
}
|
||||
|
||||
// Spr2 performs a rank-2 update
|
||||
// A += alpha * x * yᵀ + alpha * y * xᵀ,
|
||||
//
|
||||
// A += alpha * x * yᵀ + alpha * y * xᵀ,
|
||||
//
|
||||
// where A is an n×n symmetric matrix in packed format, x and y are vectors,
|
||||
// and alpha is a scalar.
|
||||
func Spr2(alpha float64, x, y Vector, a SymmetricPacked) {
|
||||
@@ -381,7 +430,9 @@ func Spr2(alpha float64, x, y Vector, a SymmetricPacked) {
|
||||
// Level 3
|
||||
|
||||
// Gemm computes
|
||||
// C = alpha * A * B + beta * C,
|
||||
//
|
||||
// C = alpha * A * B + beta * C,
|
||||
//
|
||||
// where A, B, and C are dense matrices, and alpha and beta are scalars.
|
||||
// tA and tB specify whether A or B are transposed.
|
||||
func Gemm(tA, tB blas.Transpose, alpha float64, a, b General, beta float64, c General) {
|
||||
@@ -400,8 +451,10 @@ func Gemm(tA, tB blas.Transpose, alpha float64, a, b General, beta float64, c Ge
|
||||
}
|
||||
|
||||
// Symm performs
|
||||
// C = alpha * A * B + beta * C if s == blas.Left,
|
||||
// C = alpha * B * A + beta * C if s == blas.Right,
|
||||
//
|
||||
// C = alpha * A * B + beta * C if s == blas.Left,
|
||||
// C = alpha * B * A + beta * C if s == blas.Right,
|
||||
//
|
||||
// where A is an n×n or m×m symmetric matrix, B and C are m×n matrices, and
|
||||
// alpha is a scalar.
|
||||
func Symm(s blas.Side, alpha float64, a Symmetric, b General, beta float64, c General) {
|
||||
@@ -415,8 +468,10 @@ func Symm(s blas.Side, alpha float64, a Symmetric, b General, beta float64, c Ge
|
||||
}
|
||||
|
||||
// Syrk performs a symmetric rank-k update
|
||||
// C = alpha * A * Aᵀ + beta * C if t == blas.NoTrans,
|
||||
// C = alpha * Aᵀ * A + beta * C if t == blas.Trans or blas.ConjTrans,
|
||||
//
|
||||
// C = alpha * A * Aᵀ + beta * C if t == blas.NoTrans,
|
||||
// C = alpha * Aᵀ * A + beta * C if t == blas.Trans or blas.ConjTrans,
|
||||
//
|
||||
// where C is an n×n symmetric matrix, A is an n×k matrix if t == blas.NoTrans and
|
||||
// a k×n matrix otherwise, and alpha and beta are scalars.
|
||||
func Syrk(t blas.Transpose, alpha float64, a General, beta float64, c Symmetric) {
|
||||
@@ -430,8 +485,10 @@ func Syrk(t blas.Transpose, alpha float64, a General, beta float64, c Symmetric)
|
||||
}
|
||||
|
||||
// Syr2k performs a symmetric rank-2k update
|
||||
// C = alpha * A * Bᵀ + alpha * B * Aᵀ + beta * C if t == blas.NoTrans,
|
||||
// C = alpha * Aᵀ * B + alpha * Bᵀ * A + beta * C if t == blas.Trans or blas.ConjTrans,
|
||||
//
|
||||
// C = alpha * A * Bᵀ + alpha * B * Aᵀ + beta * C if t == blas.NoTrans,
|
||||
// C = alpha * Aᵀ * B + alpha * Bᵀ * A + beta * C if t == blas.Trans or blas.ConjTrans,
|
||||
//
|
||||
// where C is an n×n symmetric matrix, A and B are n×k matrices if t == NoTrans
|
||||
// and k×n matrices otherwise, and alpha and beta are scalars.
|
||||
func Syr2k(t blas.Transpose, alpha float64, a, b General, beta float64, c Symmetric) {
|
||||
@@ -445,10 +502,12 @@ func Syr2k(t blas.Transpose, alpha float64, a, b General, beta float64, c Symmet
|
||||
}
|
||||
|
||||
// Trmm performs
|
||||
// B = alpha * A * B if tA == blas.NoTrans and s == blas.Left,
|
||||
// B = alpha * Aᵀ * B if tA == blas.Trans or blas.ConjTrans, and s == blas.Left,
|
||||
// B = alpha * B * A if tA == blas.NoTrans and s == blas.Right,
|
||||
// B = alpha * B * Aᵀ if tA == blas.Trans or blas.ConjTrans, and s == blas.Right,
|
||||
//
|
||||
// B = alpha * A * B if tA == blas.NoTrans and s == blas.Left,
|
||||
// B = alpha * Aᵀ * B if tA == blas.Trans or blas.ConjTrans, and s == blas.Left,
|
||||
// B = alpha * B * A if tA == blas.NoTrans and s == blas.Right,
|
||||
// B = alpha * B * Aᵀ if tA == blas.Trans or blas.ConjTrans, and s == blas.Right,
|
||||
//
|
||||
// where A is an n×n or m×m triangular matrix, B is an m×n matrix, and alpha is
|
||||
// a scalar.
|
||||
func Trmm(s blas.Side, tA blas.Transpose, alpha float64, a Triangular, b General) {
|
||||
@@ -456,10 +515,12 @@ func Trmm(s blas.Side, tA blas.Transpose, alpha float64, a Triangular, b General
|
||||
}
|
||||
|
||||
// Trsm solves
|
||||
// A * X = alpha * B if tA == blas.NoTrans and s == blas.Left,
|
||||
// Aᵀ * X = alpha * B if tA == blas.Trans or blas.ConjTrans, and s == blas.Left,
|
||||
// X * A = alpha * B if tA == blas.NoTrans and s == blas.Right,
|
||||
// X * Aᵀ = alpha * B if tA == blas.Trans or blas.ConjTrans, and s == blas.Right,
|
||||
//
|
||||
// A * X = alpha * B if tA == blas.NoTrans and s == blas.Left,
|
||||
// Aᵀ * X = alpha * B if tA == blas.Trans or blas.ConjTrans, and s == blas.Left,
|
||||
// X * A = alpha * B if tA == blas.NoTrans and s == blas.Right,
|
||||
// X * Aᵀ = alpha * B if tA == blas.Trans or blas.ConjTrans, and s == blas.Right,
|
||||
//
|
||||
// where A is an n×n or m×m triangular matrix, X and B are m×n matrices, and
|
||||
// alpha is a scalar.
|
||||
//
|
||||
|
@@ -115,7 +115,9 @@ const (
|
||||
|
||||
// Dotu computes the dot product of the two vectors without
|
||||
// complex conjugation:
|
||||
// xᵀ * y.
|
||||
//
|
||||
// xᵀ * y.
|
||||
//
|
||||
// Dotu will panic if the lengths of x and y do not match.
|
||||
func Dotu(x, y Vector) complex128 {
|
||||
if x.N != y.N {
|
||||
@@ -126,7 +128,9 @@ func Dotu(x, y Vector) complex128 {
|
||||
|
||||
// Dotc computes the dot product of the two vectors with
|
||||
// complex conjugation:
|
||||
// xᴴ * y.
|
||||
//
|
||||
// xᴴ * y.
|
||||
//
|
||||
// Dotc will panic if the lengths of x and y do not match.
|
||||
func Dotc(x, y Vector) complex128 {
|
||||
if x.N != y.N {
|
||||
@@ -136,7 +140,8 @@ func Dotc(x, y Vector) complex128 {
|
||||
}
|
||||
|
||||
// Nrm2 computes the Euclidean norm of the vector x:
|
||||
// sqrt(\sum_i x[i] * x[i]).
|
||||
//
|
||||
// sqrt(\sum_i x[i] * x[i]).
|
||||
//
|
||||
// Nrm2 will panic if the vector increment is negative.
|
||||
func Nrm2(x Vector) float64 {
|
||||
@@ -148,7 +153,8 @@ func Nrm2(x Vector) float64 {
|
||||
|
||||
// Asum computes the sum of magnitudes of the real and imaginary parts of
|
||||
// elements of the vector x:
|
||||
// \sum_i (|Re x[i]| + |Im x[i]|).
|
||||
//
|
||||
// \sum_i (|Re x[i]| + |Im x[i]|).
|
||||
//
|
||||
// Asum will panic if the vector increment is negative.
|
||||
func Asum(x Vector) float64 {
|
||||
@@ -173,7 +179,9 @@ func Iamax(x Vector) int {
|
||||
}
|
||||
|
||||
// Swap exchanges the elements of two vectors:
|
||||
// x[i], y[i] = y[i], x[i] for all i.
|
||||
//
|
||||
// x[i], y[i] = y[i], x[i] for all i.
|
||||
//
|
||||
// Swap will panic if the lengths of x and y do not match.
|
||||
func Swap(x, y Vector) {
|
||||
if x.N != y.N {
|
||||
@@ -183,7 +191,9 @@ func Swap(x, y Vector) {
|
||||
}
|
||||
|
||||
// Copy copies the elements of x into the elements of y:
|
||||
// y[i] = x[i] for all i.
|
||||
//
|
||||
// y[i] = x[i] for all i.
|
||||
//
|
||||
// Copy will panic if the lengths of x and y do not match.
|
||||
func Copy(x, y Vector) {
|
||||
if x.N != y.N {
|
||||
@@ -193,7 +203,9 @@ func Copy(x, y Vector) {
|
||||
}
|
||||
|
||||
// Axpy computes
|
||||
// y = alpha * x + y,
|
||||
//
|
||||
// y = alpha * x + y,
|
||||
//
|
||||
// where x and y are vectors, and alpha is a scalar.
|
||||
// Axpy will panic if the lengths of x and y do not match.
|
||||
func Axpy(alpha complex128, x, y Vector) {
|
||||
@@ -204,7 +216,9 @@ func Axpy(alpha complex128, x, y Vector) {
|
||||
}
|
||||
|
||||
// Scal computes
|
||||
// x = alpha * x,
|
||||
//
|
||||
// x = alpha * x,
|
||||
//
|
||||
// where x is a vector, and alpha is a scalar.
|
||||
//
|
||||
// Scal will panic if the vector increment is negative.
|
||||
@@ -216,7 +230,9 @@ func Scal(alpha complex128, x Vector) {
|
||||
}
|
||||
|
||||
// Dscal computes
|
||||
// x = alpha * x,
|
||||
//
|
||||
// x = alpha * x,
|
||||
//
|
||||
// where x is a vector, and alpha is a real scalar.
|
||||
//
|
||||
// Dscal will panic if the vector increment is negative.
|
||||
@@ -230,9 +246,11 @@ func Dscal(alpha float64, x Vector) {
|
||||
// Level 2
|
||||
|
||||
// Gemv computes
|
||||
// y = alpha * A * x + beta * y if t == blas.NoTrans,
|
||||
// y = alpha * Aᵀ * x + beta * y if t == blas.Trans,
|
||||
// y = alpha * Aᴴ * x + beta * y if t == blas.ConjTrans,
|
||||
//
|
||||
// y = alpha * A * x + beta * y if t == blas.NoTrans,
|
||||
// y = alpha * Aᵀ * x + beta * y if t == blas.Trans,
|
||||
// y = alpha * Aᴴ * x + beta * y if t == blas.ConjTrans,
|
||||
//
|
||||
// where A is an m×n dense matrix, x and y are vectors, and alpha and beta are
|
||||
// scalars.
|
||||
func Gemv(t blas.Transpose, alpha complex128, a General, x Vector, beta complex128, y Vector) {
|
||||
@@ -240,9 +258,11 @@ func Gemv(t blas.Transpose, alpha complex128, a General, x Vector, beta complex1
|
||||
}
|
||||
|
||||
// Gbmv computes
|
||||
// y = alpha * A * x + beta * y if t == blas.NoTrans,
|
||||
// y = alpha * Aᵀ * x + beta * y if t == blas.Trans,
|
||||
// y = alpha * Aᴴ * x + beta * y if t == blas.ConjTrans,
|
||||
//
|
||||
// y = alpha * A * x + beta * y if t == blas.NoTrans,
|
||||
// y = alpha * Aᵀ * x + beta * y if t == blas.Trans,
|
||||
// y = alpha * Aᴴ * x + beta * y if t == blas.ConjTrans,
|
||||
//
|
||||
// where A is an m×n band matrix, x and y are vectors, and alpha and beta are
|
||||
// scalars.
|
||||
func Gbmv(t blas.Transpose, alpha complex128, a Band, x Vector, beta complex128, y Vector) {
|
||||
@@ -250,36 +270,44 @@ func Gbmv(t blas.Transpose, alpha complex128, a Band, x Vector, beta complex128,
|
||||
}
|
||||
|
||||
// Trmv computes
|
||||
// x = A * x if t == blas.NoTrans,
|
||||
// x = Aᵀ * x if t == blas.Trans,
|
||||
// x = Aᴴ * x if t == blas.ConjTrans,
|
||||
//
|
||||
// x = A * x if t == blas.NoTrans,
|
||||
// x = Aᵀ * x if t == blas.Trans,
|
||||
// x = Aᴴ * x if t == blas.ConjTrans,
|
||||
//
|
||||
// where A is an n×n triangular matrix, and x is a vector.
|
||||
func Trmv(t blas.Transpose, a Triangular, x Vector) {
|
||||
cblas128.Ztrmv(a.Uplo, t, a.Diag, a.N, a.Data, a.Stride, x.Data, x.Inc)
|
||||
}
|
||||
|
||||
// Tbmv computes
|
||||
// x = A * x if t == blas.NoTrans,
|
||||
// x = Aᵀ * x if t == blas.Trans,
|
||||
// x = Aᴴ * x if t == blas.ConjTrans,
|
||||
//
|
||||
// x = A * x if t == blas.NoTrans,
|
||||
// x = Aᵀ * x if t == blas.Trans,
|
||||
// x = Aᴴ * x if t == blas.ConjTrans,
|
||||
//
|
||||
// where A is an n×n triangular band matrix, and x is a vector.
|
||||
func Tbmv(t blas.Transpose, a TriangularBand, x Vector) {
|
||||
cblas128.Ztbmv(a.Uplo, t, a.Diag, a.N, a.K, a.Data, a.Stride, x.Data, x.Inc)
|
||||
}
|
||||
|
||||
// Tpmv computes
|
||||
// x = A * x if t == blas.NoTrans,
|
||||
// x = Aᵀ * x if t == blas.Trans,
|
||||
// x = Aᴴ * x if t == blas.ConjTrans,
|
||||
//
|
||||
// x = A * x if t == blas.NoTrans,
|
||||
// x = Aᵀ * x if t == blas.Trans,
|
||||
// x = Aᴴ * x if t == blas.ConjTrans,
|
||||
//
|
||||
// where A is an n×n triangular matrix in packed format, and x is a vector.
|
||||
func Tpmv(t blas.Transpose, a TriangularPacked, x Vector) {
|
||||
cblas128.Ztpmv(a.Uplo, t, a.Diag, a.N, a.Data, x.Data, x.Inc)
|
||||
}
|
||||
|
||||
// Trsv solves
|
||||
// A * x = b if t == blas.NoTrans,
|
||||
// Aᵀ * x = b if t == blas.Trans,
|
||||
// Aᴴ * x = b if t == blas.ConjTrans,
|
||||
//
|
||||
// A * x = b if t == blas.NoTrans,
|
||||
// Aᵀ * x = b if t == blas.Trans,
|
||||
// Aᴴ * x = b if t == blas.ConjTrans,
|
||||
//
|
||||
// where A is an n×n triangular matrix and x is a vector.
|
||||
//
|
||||
// At entry to the function, x contains the values of b, and the result is
|
||||
@@ -292,9 +320,11 @@ func Trsv(t blas.Transpose, a Triangular, x Vector) {
|
||||
}
|
||||
|
||||
// Tbsv solves
|
||||
// A * x = b if t == blas.NoTrans,
|
||||
// Aᵀ * x = b if t == blas.Trans,
|
||||
// Aᴴ * x = b if t == blas.ConjTrans,
|
||||
//
|
||||
// A * x = b if t == blas.NoTrans,
|
||||
// Aᵀ * x = b if t == blas.Trans,
|
||||
// Aᴴ * x = b if t == blas.ConjTrans,
|
||||
//
|
||||
// where A is an n×n triangular band matrix, and x is a vector.
|
||||
//
|
||||
// At entry to the function, x contains the values of b, and the result is
|
||||
@@ -307,9 +337,11 @@ func Tbsv(t blas.Transpose, a TriangularBand, x Vector) {
|
||||
}
|
||||
|
||||
// Tpsv solves
|
||||
// A * x = b if t == blas.NoTrans,
|
||||
// Aᵀ * x = b if t == blas.Trans,
|
||||
// Aᴴ * x = b if t == blas.ConjTrans,
|
||||
//
|
||||
// A * x = b if t == blas.NoTrans,
|
||||
// Aᵀ * x = b if t == blas.Trans,
|
||||
// Aᴴ * x = b if t == blas.ConjTrans,
|
||||
//
|
||||
// where A is an n×n triangular matrix in packed format and x is a vector.
|
||||
//
|
||||
// At entry to the function, x contains the values of b, and the result is
|
||||
@@ -322,7 +354,9 @@ func Tpsv(t blas.Transpose, a TriangularPacked, x Vector) {
|
||||
}
|
||||
|
||||
// Hemv computes
|
||||
// y = alpha * A * x + beta * y,
|
||||
//
|
||||
// y = alpha * A * x + beta * y,
|
||||
//
|
||||
// where A is an n×n Hermitian matrix, x and y are vectors, and alpha and
|
||||
// beta are scalars.
|
||||
func Hemv(alpha complex128, a Hermitian, x Vector, beta complex128, y Vector) {
|
||||
@@ -330,7 +364,9 @@ func Hemv(alpha complex128, a Hermitian, x Vector, beta complex128, y Vector) {
|
||||
}
|
||||
|
||||
// Hbmv performs
|
||||
// y = alpha * A * x + beta * y,
|
||||
//
|
||||
// y = alpha * A * x + beta * y,
|
||||
//
|
||||
// where A is an n×n Hermitian band matrix, x and y are vectors, and alpha
|
||||
// and beta are scalars.
|
||||
func Hbmv(alpha complex128, a HermitianBand, x Vector, beta complex128, y Vector) {
|
||||
@@ -338,7 +374,9 @@ func Hbmv(alpha complex128, a HermitianBand, x Vector, beta complex128, y Vector
|
||||
}
|
||||
|
||||
// Hpmv performs
|
||||
// y = alpha * A * x + beta * y,
|
||||
//
|
||||
// y = alpha * A * x + beta * y,
|
||||
//
|
||||
// where A is an n×n Hermitian matrix in packed format, x and y are vectors,
|
||||
// and alpha and beta are scalars.
|
||||
func Hpmv(alpha complex128, a HermitianPacked, x Vector, beta complex128, y Vector) {
|
||||
@@ -346,28 +384,36 @@ func Hpmv(alpha complex128, a HermitianPacked, x Vector, beta complex128, y Vect
|
||||
}
|
||||
|
||||
// Geru performs a rank-1 update
|
||||
// A += alpha * x * yᵀ,
|
||||
//
|
||||
// A += alpha * x * yᵀ,
|
||||
//
|
||||
// where A is an m×n dense matrix, x and y are vectors, and alpha is a scalar.
|
||||
func Geru(alpha complex128, x, y Vector, a General) {
|
||||
cblas128.Zgeru(a.Rows, a.Cols, alpha, x.Data, x.Inc, y.Data, y.Inc, a.Data, a.Stride)
|
||||
}
|
||||
|
||||
// Gerc performs a rank-1 update
|
||||
// A += alpha * x * yᴴ,
|
||||
//
|
||||
// A += alpha * x * yᴴ,
|
||||
//
|
||||
// where A is an m×n dense matrix, x and y are vectors, and alpha is a scalar.
|
||||
func Gerc(alpha complex128, x, y Vector, a General) {
|
||||
cblas128.Zgerc(a.Rows, a.Cols, alpha, x.Data, x.Inc, y.Data, y.Inc, a.Data, a.Stride)
|
||||
}
|
||||
|
||||
// Her performs a rank-1 update
|
||||
// A += alpha * x * yᵀ,
|
||||
//
|
||||
// A += alpha * x * yᵀ,
|
||||
//
|
||||
// where A is an m×n Hermitian matrix, x and y are vectors, and alpha is a scalar.
|
||||
func Her(alpha float64, x Vector, a Hermitian) {
|
||||
cblas128.Zher(a.Uplo, a.N, alpha, x.Data, x.Inc, a.Data, a.Stride)
|
||||
}
|
||||
|
||||
// Hpr performs a rank-1 update
|
||||
// A += alpha * x * xᴴ,
|
||||
//
|
||||
// A += alpha * x * xᴴ,
|
||||
//
|
||||
// where A is an n×n Hermitian matrix in packed format, x is a vector, and
|
||||
// alpha is a scalar.
|
||||
func Hpr(alpha float64, x Vector, a HermitianPacked) {
|
||||
@@ -375,14 +421,18 @@ func Hpr(alpha float64, x Vector, a HermitianPacked) {
|
||||
}
|
||||
|
||||
// Her2 performs a rank-2 update
|
||||
// A += alpha * x * yᴴ + conj(alpha) * y * xᴴ,
|
||||
//
|
||||
// A += alpha * x * yᴴ + conj(alpha) * y * xᴴ,
|
||||
//
|
||||
// where A is an n×n Hermitian matrix, x and y are vectors, and alpha is a scalar.
|
||||
func Her2(alpha complex128, x, y Vector, a Hermitian) {
|
||||
cblas128.Zher2(a.Uplo, a.N, alpha, x.Data, x.Inc, y.Data, y.Inc, a.Data, a.Stride)
|
||||
}
|
||||
|
||||
// Hpr2 performs a rank-2 update
|
||||
// A += alpha * x * yᴴ + conj(alpha) * y * xᴴ,
|
||||
//
|
||||
// A += alpha * x * yᴴ + conj(alpha) * y * xᴴ,
|
||||
//
|
||||
// where A is an n×n Hermitian matrix in packed format, x and y are vectors,
|
||||
// and alpha is a scalar.
|
||||
func Hpr2(alpha complex128, x, y Vector, a HermitianPacked) {
|
||||
@@ -392,7 +442,9 @@ func Hpr2(alpha complex128, x, y Vector, a HermitianPacked) {
|
||||
// Level 3
|
||||
|
||||
// Gemm computes
|
||||
// C = alpha * A * B + beta * C,
|
||||
//
|
||||
// C = alpha * A * B + beta * C,
|
||||
//
|
||||
// where A, B, and C are dense matrices, and alpha and beta are scalars.
|
||||
// tA and tB specify whether A or B are transposed or conjugated.
|
||||
func Gemm(tA, tB blas.Transpose, alpha complex128, a, b General, beta complex128, c General) {
|
||||
@@ -411,8 +463,10 @@ func Gemm(tA, tB blas.Transpose, alpha complex128, a, b General, beta complex128
|
||||
}
|
||||
|
||||
// Symm performs
|
||||
// C = alpha * A * B + beta * C if s == blas.Left,
|
||||
// C = alpha * B * A + beta * C if s == blas.Right,
|
||||
//
|
||||
// C = alpha * A * B + beta * C if s == blas.Left,
|
||||
// C = alpha * B * A + beta * C if s == blas.Right,
|
||||
//
|
||||
// where A is an n×n or m×m symmetric matrix, B and C are m×n matrices, and
|
||||
// alpha and beta are scalars.
|
||||
func Symm(s blas.Side, alpha complex128, a Symmetric, b General, beta complex128, c General) {
|
||||
@@ -426,8 +480,10 @@ func Symm(s blas.Side, alpha complex128, a Symmetric, b General, beta complex128
|
||||
}
|
||||
|
||||
// Syrk performs a symmetric rank-k update
|
||||
// C = alpha * A * Aᵀ + beta * C if t == blas.NoTrans,
|
||||
// C = alpha * Aᵀ * A + beta * C if t == blas.Trans,
|
||||
//
|
||||
// C = alpha * A * Aᵀ + beta * C if t == blas.NoTrans,
|
||||
// C = alpha * Aᵀ * A + beta * C if t == blas.Trans,
|
||||
//
|
||||
// where C is an n×n symmetric matrix, A is an n×k matrix if t == blas.NoTrans
|
||||
// and a k×n matrix otherwise, and alpha and beta are scalars.
|
||||
func Syrk(t blas.Transpose, alpha complex128, a General, beta complex128, c Symmetric) {
|
||||
@@ -441,8 +497,10 @@ func Syrk(t blas.Transpose, alpha complex128, a General, beta complex128, c Symm
|
||||
}
|
||||
|
||||
// Syr2k performs a symmetric rank-2k update
|
||||
// C = alpha * A * Bᵀ + alpha * B * Aᵀ + beta * C if t == blas.NoTrans,
|
||||
// C = alpha * Aᵀ * B + alpha * Bᵀ * A + beta * C if t == blas.Trans,
|
||||
//
|
||||
// C = alpha * A * Bᵀ + alpha * B * Aᵀ + beta * C if t == blas.NoTrans,
|
||||
// C = alpha * Aᵀ * B + alpha * Bᵀ * A + beta * C if t == blas.Trans,
|
||||
//
|
||||
// where C is an n×n symmetric matrix, A and B are n×k matrices if
|
||||
// t == blas.NoTrans and k×n otherwise, and alpha and beta are scalars.
|
||||
func Syr2k(t blas.Transpose, alpha complex128, a, b General, beta complex128, c Symmetric) {
|
||||
@@ -456,12 +514,14 @@ func Syr2k(t blas.Transpose, alpha complex128, a, b General, beta complex128, c
|
||||
}
|
||||
|
||||
// Trmm performs
|
||||
// B = alpha * A * B if tA == blas.NoTrans and s == blas.Left,
|
||||
// B = alpha * Aᵀ * B if tA == blas.Trans and s == blas.Left,
|
||||
// B = alpha * Aᴴ * B if tA == blas.ConjTrans and s == blas.Left,
|
||||
// B = alpha * B * A if tA == blas.NoTrans and s == blas.Right,
|
||||
// B = alpha * B * Aᵀ if tA == blas.Trans and s == blas.Right,
|
||||
// B = alpha * B * Aᴴ if tA == blas.ConjTrans and s == blas.Right,
|
||||
//
|
||||
// B = alpha * A * B if tA == blas.NoTrans and s == blas.Left,
|
||||
// B = alpha * Aᵀ * B if tA == blas.Trans and s == blas.Left,
|
||||
// B = alpha * Aᴴ * B if tA == blas.ConjTrans and s == blas.Left,
|
||||
// B = alpha * B * A if tA == blas.NoTrans and s == blas.Right,
|
||||
// B = alpha * B * Aᵀ if tA == blas.Trans and s == blas.Right,
|
||||
// B = alpha * B * Aᴴ if tA == blas.ConjTrans and s == blas.Right,
|
||||
//
|
||||
// where A is an n×n or m×m triangular matrix, B is an m×n matrix, and alpha is
|
||||
// a scalar.
|
||||
func Trmm(s blas.Side, tA blas.Transpose, alpha complex128, a Triangular, b General) {
|
||||
@@ -469,12 +529,14 @@ func Trmm(s blas.Side, tA blas.Transpose, alpha complex128, a Triangular, b Gene
|
||||
}
|
||||
|
||||
// Trsm solves
|
||||
// A * X = alpha * B if tA == blas.NoTrans and s == blas.Left,
|
||||
// Aᵀ * X = alpha * B if tA == blas.Trans and s == blas.Left,
|
||||
// Aᴴ * X = alpha * B if tA == blas.ConjTrans and s == blas.Left,
|
||||
// X * A = alpha * B if tA == blas.NoTrans and s == blas.Right,
|
||||
// X * Aᵀ = alpha * B if tA == blas.Trans and s == blas.Right,
|
||||
// X * Aᴴ = alpha * B if tA == blas.ConjTrans and s == blas.Right,
|
||||
//
|
||||
// A * X = alpha * B if tA == blas.NoTrans and s == blas.Left,
|
||||
// Aᵀ * X = alpha * B if tA == blas.Trans and s == blas.Left,
|
||||
// Aᴴ * X = alpha * B if tA == blas.ConjTrans and s == blas.Left,
|
||||
// X * A = alpha * B if tA == blas.NoTrans and s == blas.Right,
|
||||
// X * Aᵀ = alpha * B if tA == blas.Trans and s == blas.Right,
|
||||
// X * Aᴴ = alpha * B if tA == blas.ConjTrans and s == blas.Right,
|
||||
//
|
||||
// where A is an n×n or m×m triangular matrix, X and B are m×n matrices, and
|
||||
// alpha is a scalar.
|
||||
//
|
||||
@@ -487,8 +549,10 @@ func Trsm(s blas.Side, tA blas.Transpose, alpha complex128, a Triangular, b Gene
|
||||
}
|
||||
|
||||
// Hemm performs
|
||||
// C = alpha * A * B + beta * C if s == blas.Left,
|
||||
// C = alpha * B * A + beta * C if s == blas.Right,
|
||||
//
|
||||
// C = alpha * A * B + beta * C if s == blas.Left,
|
||||
// C = alpha * B * A + beta * C if s == blas.Right,
|
||||
//
|
||||
// where A is an n×n or m×m Hermitian matrix, B and C are m×n matrices, and
|
||||
// alpha and beta are scalars.
|
||||
func Hemm(s blas.Side, alpha complex128, a Hermitian, b General, beta complex128, c General) {
|
||||
@@ -502,8 +566,10 @@ func Hemm(s blas.Side, alpha complex128, a Hermitian, b General, beta complex128
|
||||
}
|
||||
|
||||
// Herk performs the Hermitian rank-k update
|
||||
// C = alpha * A * Aᴴ + beta*C if t == blas.NoTrans,
|
||||
// C = alpha * Aᴴ * A + beta*C if t == blas.ConjTrans,
|
||||
//
|
||||
// C = alpha * A * Aᴴ + beta*C if t == blas.NoTrans,
|
||||
// C = alpha * Aᴴ * A + beta*C if t == blas.ConjTrans,
|
||||
//
|
||||
// where C is an n×n Hermitian matrix, A is an n×k matrix if t == blas.NoTrans
|
||||
// and a k×n matrix otherwise, and alpha and beta are scalars.
|
||||
func Herk(t blas.Transpose, alpha float64, a General, beta float64, c Hermitian) {
|
||||
@@ -517,8 +583,10 @@ func Herk(t blas.Transpose, alpha float64, a General, beta float64, c Hermitian)
|
||||
}
|
||||
|
||||
// Her2k performs the Hermitian rank-2k update
|
||||
// C = alpha * A * Bᴴ + conj(alpha) * B * Aᴴ + beta * C if t == blas.NoTrans,
|
||||
// C = alpha * Aᴴ * B + conj(alpha) * Bᴴ * A + beta * C if t == blas.ConjTrans,
|
||||
//
|
||||
// C = alpha * A * Bᴴ + conj(alpha) * B * Aᴴ + beta * C if t == blas.NoTrans,
|
||||
// C = alpha * Aᴴ * B + conj(alpha) * Bᴴ * A + beta * C if t == blas.ConjTrans,
|
||||
//
|
||||
// where C is an n×n Hermitian matrix, A and B are n×k matrices if t == NoTrans
|
||||
// and k×n matrices otherwise, and alpha and beta are scalars.
|
||||
func Her2k(t blas.Transpose, alpha complex128, a, b General, beta float64, c Hermitian) {
|
||||
|
@@ -115,7 +115,9 @@ const (
|
||||
|
||||
// Dotu computes the dot product of the two vectors without
|
||||
// complex conjugation:
|
||||
// xᵀ * y
|
||||
//
|
||||
// xᵀ * y
|
||||
//
|
||||
// Dotu will panic if the lengths of x and y do not match.
|
||||
func Dotu(x, y Vector) complex64 {
|
||||
if x.N != y.N {
|
||||
@@ -126,7 +128,9 @@ func Dotu(x, y Vector) complex64 {
|
||||
|
||||
// Dotc computes the dot product of the two vectors with
|
||||
// complex conjugation:
|
||||
// xᴴ * y.
|
||||
//
|
||||
// xᴴ * y.
|
||||
//
|
||||
// Dotc will panic if the lengths of x and y do not match.
|
||||
func Dotc(x, y Vector) complex64 {
|
||||
if x.N != y.N {
|
||||
@@ -136,7 +140,8 @@ func Dotc(x, y Vector) complex64 {
|
||||
}
|
||||
|
||||
// Nrm2 computes the Euclidean norm of the vector x:
|
||||
// sqrt(\sum_i x[i] * x[i]).
|
||||
//
|
||||
// sqrt(\sum_i x[i] * x[i]).
|
||||
//
|
||||
// Nrm2 will panic if the vector increment is negative.
|
||||
func Nrm2(x Vector) float32 {
|
||||
@@ -148,7 +153,8 @@ func Nrm2(x Vector) float32 {
|
||||
|
||||
// Asum computes the sum of magnitudes of the real and imaginary parts of
|
||||
// elements of the vector x:
|
||||
// \sum_i (|Re x[i]| + |Im x[i]|).
|
||||
//
|
||||
// \sum_i (|Re x[i]| + |Im x[i]|).
|
||||
//
|
||||
// Asum will panic if the vector increment is negative.
|
||||
func Asum(x Vector) float32 {
|
||||
@@ -173,7 +179,9 @@ func Iamax(x Vector) int {
|
||||
}
|
||||
|
||||
// Swap exchanges the elements of two vectors:
|
||||
// x[i], y[i] = y[i], x[i] for all i.
|
||||
//
|
||||
// x[i], y[i] = y[i], x[i] for all i.
|
||||
//
|
||||
// Swap will panic if the lengths of x and y do not match.
|
||||
func Swap(x, y Vector) {
|
||||
if x.N != y.N {
|
||||
@@ -183,7 +191,9 @@ func Swap(x, y Vector) {
|
||||
}
|
||||
|
||||
// Copy copies the elements of x into the elements of y:
|
||||
// y[i] = x[i] for all i.
|
||||
//
|
||||
// y[i] = x[i] for all i.
|
||||
//
|
||||
// Copy will panic if the lengths of x and y do not match.
|
||||
func Copy(x, y Vector) {
|
||||
if x.N != y.N {
|
||||
@@ -193,7 +203,9 @@ func Copy(x, y Vector) {
|
||||
}
|
||||
|
||||
// Axpy computes
|
||||
// y = alpha * x + y,
|
||||
//
|
||||
// y = alpha * x + y,
|
||||
//
|
||||
// where x and y are vectors, and alpha is a scalar.
|
||||
// Axpy will panic if the lengths of x and y do not match.
|
||||
func Axpy(alpha complex64, x, y Vector) {
|
||||
@@ -204,7 +216,9 @@ func Axpy(alpha complex64, x, y Vector) {
|
||||
}
|
||||
|
||||
// Scal computes
|
||||
// x = alpha * x,
|
||||
//
|
||||
// x = alpha * x,
|
||||
//
|
||||
// where x is a vector, and alpha is a scalar.
|
||||
//
|
||||
// Scal will panic if the vector increment is negative.
|
||||
@@ -216,7 +230,9 @@ func Scal(alpha complex64, x Vector) {
|
||||
}
|
||||
|
||||
// Dscal computes
|
||||
// x = alpha * x,
|
||||
//
|
||||
// x = alpha * x,
|
||||
//
|
||||
// where x is a vector, and alpha is a real scalar.
|
||||
//
|
||||
// Dscal will panic if the vector increment is negative.
|
||||
@@ -230,9 +246,11 @@ func Dscal(alpha float32, x Vector) {
|
||||
// Level 2
|
||||
|
||||
// Gemv computes
|
||||
// y = alpha * A * x + beta * y if t == blas.NoTrans,
|
||||
// y = alpha * Aᵀ * x + beta * y if t == blas.Trans,
|
||||
// y = alpha * Aᴴ * x + beta * y if t == blas.ConjTrans,
|
||||
//
|
||||
// y = alpha * A * x + beta * y if t == blas.NoTrans,
|
||||
// y = alpha * Aᵀ * x + beta * y if t == blas.Trans,
|
||||
// y = alpha * Aᴴ * x + beta * y if t == blas.ConjTrans,
|
||||
//
|
||||
// where A is an m×n dense matrix, x and y are vectors, and alpha and beta are
|
||||
// scalars.
|
||||
func Gemv(t blas.Transpose, alpha complex64, a General, x Vector, beta complex64, y Vector) {
|
||||
@@ -240,9 +258,11 @@ func Gemv(t blas.Transpose, alpha complex64, a General, x Vector, beta complex64
|
||||
}
|
||||
|
||||
// Gbmv computes
|
||||
// y = alpha * A * x + beta * y if t == blas.NoTrans,
|
||||
// y = alpha * Aᵀ * x + beta * y if t == blas.Trans,
|
||||
// y = alpha * Aᴴ * x + beta * y if t == blas.ConjTrans,
|
||||
//
|
||||
// y = alpha * A * x + beta * y if t == blas.NoTrans,
|
||||
// y = alpha * Aᵀ * x + beta * y if t == blas.Trans,
|
||||
// y = alpha * Aᴴ * x + beta * y if t == blas.ConjTrans,
|
||||
//
|
||||
// where A is an m×n band matrix, x and y are vectors, and alpha and beta are
|
||||
// scalars.
|
||||
func Gbmv(t blas.Transpose, alpha complex64, a Band, x Vector, beta complex64, y Vector) {
|
||||
@@ -250,36 +270,44 @@ func Gbmv(t blas.Transpose, alpha complex64, a Band, x Vector, beta complex64, y
|
||||
}
|
||||
|
||||
// Trmv computes
|
||||
// x = A * x if t == blas.NoTrans,
|
||||
// x = Aᵀ * x if t == blas.Trans,
|
||||
// x = Aᴴ * x if t == blas.ConjTrans,
|
||||
//
|
||||
// x = A * x if t == blas.NoTrans,
|
||||
// x = Aᵀ * x if t == blas.Trans,
|
||||
// x = Aᴴ * x if t == blas.ConjTrans,
|
||||
//
|
||||
// where A is an n×n triangular matrix, and x is a vector.
|
||||
func Trmv(t blas.Transpose, a Triangular, x Vector) {
|
||||
cblas64.Ctrmv(a.Uplo, t, a.Diag, a.N, a.Data, a.Stride, x.Data, x.Inc)
|
||||
}
|
||||
|
||||
// Tbmv computes
|
||||
// x = A * x if t == blas.NoTrans,
|
||||
// x = Aᵀ * x if t == blas.Trans,
|
||||
// x = Aᴴ * x if t == blas.ConjTrans,
|
||||
//
|
||||
// x = A * x if t == blas.NoTrans,
|
||||
// x = Aᵀ * x if t == blas.Trans,
|
||||
// x = Aᴴ * x if t == blas.ConjTrans,
|
||||
//
|
||||
// where A is an n×n triangular band matrix, and x is a vector.
|
||||
func Tbmv(t blas.Transpose, a TriangularBand, x Vector) {
|
||||
cblas64.Ctbmv(a.Uplo, t, a.Diag, a.N, a.K, a.Data, a.Stride, x.Data, x.Inc)
|
||||
}
|
||||
|
||||
// Tpmv computes
|
||||
// x = A * x if t == blas.NoTrans,
|
||||
// x = Aᵀ * x if t == blas.Trans,
|
||||
// x = Aᴴ * x if t == blas.ConjTrans,
|
||||
//
|
||||
// x = A * x if t == blas.NoTrans,
|
||||
// x = Aᵀ * x if t == blas.Trans,
|
||||
// x = Aᴴ * x if t == blas.ConjTrans,
|
||||
//
|
||||
// where A is an n×n triangular matrix in packed format, and x is a vector.
|
||||
func Tpmv(t blas.Transpose, a TriangularPacked, x Vector) {
|
||||
cblas64.Ctpmv(a.Uplo, t, a.Diag, a.N, a.Data, x.Data, x.Inc)
|
||||
}
|
||||
|
||||
// Trsv solves
|
||||
// A * x = b if t == blas.NoTrans,
|
||||
// Aᵀ * x = b if t == blas.Trans,
|
||||
// Aᴴ * x = b if t == blas.ConjTrans,
|
||||
//
|
||||
// A * x = b if t == blas.NoTrans,
|
||||
// Aᵀ * x = b if t == blas.Trans,
|
||||
// Aᴴ * x = b if t == blas.ConjTrans,
|
||||
//
|
||||
// where A is an n×n triangular matrix and x is a vector.
|
||||
//
|
||||
// At entry to the function, x contains the values of b, and the result is
|
||||
@@ -292,9 +320,11 @@ func Trsv(t blas.Transpose, a Triangular, x Vector) {
|
||||
}
|
||||
|
||||
// Tbsv solves
|
||||
// A * x = b if t == blas.NoTrans,
|
||||
// Aᵀ * x = b if t == blas.Trans,
|
||||
// Aᴴ * x = b if t == blas.ConjTrans,
|
||||
//
|
||||
// A * x = b if t == blas.NoTrans,
|
||||
// Aᵀ * x = b if t == blas.Trans,
|
||||
// Aᴴ * x = b if t == blas.ConjTrans,
|
||||
//
|
||||
// where A is an n×n triangular band matrix, and x is a vector.
|
||||
//
|
||||
// At entry to the function, x contains the values of b, and the result is
|
||||
@@ -307,9 +337,11 @@ func Tbsv(t blas.Transpose, a TriangularBand, x Vector) {
|
||||
}
|
||||
|
||||
// Tpsv solves
|
||||
// A * x = b if t == blas.NoTrans,
|
||||
// Aᵀ * x = b if t == blas.Trans,
|
||||
// Aᴴ * x = b if t == blas.ConjTrans,
|
||||
//
|
||||
// A * x = b if t == blas.NoTrans,
|
||||
// Aᵀ * x = b if t == blas.Trans,
|
||||
// Aᴴ * x = b if t == blas.ConjTrans,
|
||||
//
|
||||
// where A is an n×n triangular matrix in packed format and x is a vector.
|
||||
//
|
||||
// At entry to the function, x contains the values of b, and the result is
|
||||
@@ -322,7 +354,9 @@ func Tpsv(t blas.Transpose, a TriangularPacked, x Vector) {
|
||||
}
|
||||
|
||||
// Hemv computes
|
||||
// y = alpha * A * x + beta * y,
|
||||
//
|
||||
// y = alpha * A * x + beta * y,
|
||||
//
|
||||
// where A is an n×n Hermitian matrix, x and y are vectors, and alpha and
|
||||
// beta are scalars.
|
||||
func Hemv(alpha complex64, a Hermitian, x Vector, beta complex64, y Vector) {
|
||||
@@ -330,7 +364,9 @@ func Hemv(alpha complex64, a Hermitian, x Vector, beta complex64, y Vector) {
|
||||
}
|
||||
|
||||
// Hbmv performs
|
||||
// y = alpha * A * x + beta * y,
|
||||
//
|
||||
// y = alpha * A * x + beta * y,
|
||||
//
|
||||
// where A is an n×n Hermitian band matrix, x and y are vectors, and alpha
|
||||
// and beta are scalars.
|
||||
func Hbmv(alpha complex64, a HermitianBand, x Vector, beta complex64, y Vector) {
|
||||
@@ -338,7 +374,9 @@ func Hbmv(alpha complex64, a HermitianBand, x Vector, beta complex64, y Vector)
|
||||
}
|
||||
|
||||
// Hpmv performs
|
||||
// y = alpha * A * x + beta * y,
|
||||
//
|
||||
// y = alpha * A * x + beta * y,
|
||||
//
|
||||
// where A is an n×n Hermitian matrix in packed format, x and y are vectors,
|
||||
// and alpha and beta are scalars.
|
||||
func Hpmv(alpha complex64, a HermitianPacked, x Vector, beta complex64, y Vector) {
|
||||
@@ -346,28 +384,36 @@ func Hpmv(alpha complex64, a HermitianPacked, x Vector, beta complex64, y Vector
|
||||
}
|
||||
|
||||
// Geru performs a rank-1 update
|
||||
// A += alpha * x * yᵀ,
|
||||
//
|
||||
// A += alpha * x * yᵀ,
|
||||
//
|
||||
// where A is an m×n dense matrix, x and y are vectors, and alpha is a scalar.
|
||||
func Geru(alpha complex64, x, y Vector, a General) {
|
||||
cblas64.Cgeru(a.Rows, a.Cols, alpha, x.Data, x.Inc, y.Data, y.Inc, a.Data, a.Stride)
|
||||
}
|
||||
|
||||
// Gerc performs a rank-1 update
|
||||
// A += alpha * x * yᴴ,
|
||||
//
|
||||
// A += alpha * x * yᴴ,
|
||||
//
|
||||
// where A is an m×n dense matrix, x and y are vectors, and alpha is a scalar.
|
||||
func Gerc(alpha complex64, x, y Vector, a General) {
|
||||
cblas64.Cgerc(a.Rows, a.Cols, alpha, x.Data, x.Inc, y.Data, y.Inc, a.Data, a.Stride)
|
||||
}
|
||||
|
||||
// Her performs a rank-1 update
|
||||
// A += alpha * x * yᵀ,
|
||||
//
|
||||
// A += alpha * x * yᵀ,
|
||||
//
|
||||
// where A is an m×n Hermitian matrix, x and y are vectors, and alpha is a scalar.
|
||||
func Her(alpha float32, x Vector, a Hermitian) {
|
||||
cblas64.Cher(a.Uplo, a.N, alpha, x.Data, x.Inc, a.Data, a.Stride)
|
||||
}
|
||||
|
||||
// Hpr performs a rank-1 update
|
||||
// A += alpha * x * xᴴ,
|
||||
//
|
||||
// A += alpha * x * xᴴ,
|
||||
//
|
||||
// where A is an n×n Hermitian matrix in packed format, x is a vector, and
|
||||
// alpha is a scalar.
|
||||
func Hpr(alpha float32, x Vector, a HermitianPacked) {
|
||||
@@ -375,14 +421,18 @@ func Hpr(alpha float32, x Vector, a HermitianPacked) {
|
||||
}
|
||||
|
||||
// Her2 performs a rank-2 update
|
||||
// A += alpha * x * yᴴ + conj(alpha) * y * xᴴ,
|
||||
//
|
||||
// A += alpha * x * yᴴ + conj(alpha) * y * xᴴ,
|
||||
//
|
||||
// where A is an n×n Hermitian matrix, x and y are vectors, and alpha is a scalar.
|
||||
func Her2(alpha complex64, x, y Vector, a Hermitian) {
|
||||
cblas64.Cher2(a.Uplo, a.N, alpha, x.Data, x.Inc, y.Data, y.Inc, a.Data, a.Stride)
|
||||
}
|
||||
|
||||
// Hpr2 performs a rank-2 update
|
||||
// A += alpha * x * yᴴ + conj(alpha) * y * xᴴ,
|
||||
//
|
||||
// A += alpha * x * yᴴ + conj(alpha) * y * xᴴ,
|
||||
//
|
||||
// where A is an n×n Hermitian matrix in packed format, x and y are vectors,
|
||||
// and alpha is a scalar.
|
||||
func Hpr2(alpha complex64, x, y Vector, a HermitianPacked) {
|
||||
@@ -392,7 +442,9 @@ func Hpr2(alpha complex64, x, y Vector, a HermitianPacked) {
|
||||
// Level 3
|
||||
|
||||
// Gemm computes
|
||||
// C = alpha * A * B + beta * C,
|
||||
//
|
||||
// C = alpha * A * B + beta * C,
|
||||
//
|
||||
// where A, B, and C are dense matrices, and alpha and beta are scalars.
|
||||
// tA and tB specify whether A or B are transposed or conjugated.
|
||||
func Gemm(tA, tB blas.Transpose, alpha complex64, a, b General, beta complex64, c General) {
|
||||
@@ -411,8 +463,10 @@ func Gemm(tA, tB blas.Transpose, alpha complex64, a, b General, beta complex64,
|
||||
}
|
||||
|
||||
// Symm performs
|
||||
// C = alpha * A * B + beta * C if s == blas.Left,
|
||||
// C = alpha * B * A + beta * C if s == blas.Right,
|
||||
//
|
||||
// C = alpha * A * B + beta * C if s == blas.Left,
|
||||
// C = alpha * B * A + beta * C if s == blas.Right,
|
||||
//
|
||||
// where A is an n×n or m×m symmetric matrix, B and C are m×n matrices, and
|
||||
// alpha and beta are scalars.
|
||||
func Symm(s blas.Side, alpha complex64, a Symmetric, b General, beta complex64, c General) {
|
||||
@@ -426,8 +480,10 @@ func Symm(s blas.Side, alpha complex64, a Symmetric, b General, beta complex64,
|
||||
}
|
||||
|
||||
// Syrk performs a symmetric rank-k update
|
||||
// C = alpha * A * Aᵀ + beta * C if t == blas.NoTrans,
|
||||
// C = alpha * Aᵀ * A + beta * C if t == blas.Trans,
|
||||
//
|
||||
// C = alpha * A * Aᵀ + beta * C if t == blas.NoTrans,
|
||||
// C = alpha * Aᵀ * A + beta * C if t == blas.Trans,
|
||||
//
|
||||
// where C is an n×n symmetric matrix, A is an n×k matrix if t == blas.NoTrans
|
||||
// and a k×n matrix otherwise, and alpha and beta are scalars.
|
||||
func Syrk(t blas.Transpose, alpha complex64, a General, beta complex64, c Symmetric) {
|
||||
@@ -441,8 +497,10 @@ func Syrk(t blas.Transpose, alpha complex64, a General, beta complex64, c Symmet
|
||||
}
|
||||
|
||||
// Syr2k performs a symmetric rank-2k update
|
||||
// C = alpha * A * Bᵀ + alpha * B * Aᵀ + beta * C if t == blas.NoTrans,
|
||||
// C = alpha * Aᵀ * B + alpha * Bᵀ * A + beta * C if t == blas.Trans,
|
||||
//
|
||||
// C = alpha * A * Bᵀ + alpha * B * Aᵀ + beta * C if t == blas.NoTrans,
|
||||
// C = alpha * Aᵀ * B + alpha * Bᵀ * A + beta * C if t == blas.Trans,
|
||||
//
|
||||
// where C is an n×n symmetric matrix, A and B are n×k matrices if
|
||||
// t == blas.NoTrans and k×n otherwise, and alpha and beta are scalars.
|
||||
func Syr2k(t blas.Transpose, alpha complex64, a, b General, beta complex64, c Symmetric) {
|
||||
@@ -456,12 +514,14 @@ func Syr2k(t blas.Transpose, alpha complex64, a, b General, beta complex64, c Sy
|
||||
}
|
||||
|
||||
// Trmm performs
|
||||
// B = alpha * A * B if tA == blas.NoTrans and s == blas.Left,
|
||||
// B = alpha * Aᵀ * B if tA == blas.Trans and s == blas.Left,
|
||||
// B = alpha * Aᴴ * B if tA == blas.ConjTrans and s == blas.Left,
|
||||
// B = alpha * B * A if tA == blas.NoTrans and s == blas.Right,
|
||||
// B = alpha * B * Aᵀ if tA == blas.Trans and s == blas.Right,
|
||||
// B = alpha * B * Aᴴ if tA == blas.ConjTrans and s == blas.Right,
|
||||
//
|
||||
// B = alpha * A * B if tA == blas.NoTrans and s == blas.Left,
|
||||
// B = alpha * Aᵀ * B if tA == blas.Trans and s == blas.Left,
|
||||
// B = alpha * Aᴴ * B if tA == blas.ConjTrans and s == blas.Left,
|
||||
// B = alpha * B * A if tA == blas.NoTrans and s == blas.Right,
|
||||
// B = alpha * B * Aᵀ if tA == blas.Trans and s == blas.Right,
|
||||
// B = alpha * B * Aᴴ if tA == blas.ConjTrans and s == blas.Right,
|
||||
//
|
||||
// where A is an n×n or m×m triangular matrix, B is an m×n matrix, and alpha is
|
||||
// a scalar.
|
||||
func Trmm(s blas.Side, tA blas.Transpose, alpha complex64, a Triangular, b General) {
|
||||
@@ -469,12 +529,14 @@ func Trmm(s blas.Side, tA blas.Transpose, alpha complex64, a Triangular, b Gener
|
||||
}
|
||||
|
||||
// Trsm solves
|
||||
// A * X = alpha * B if tA == blas.NoTrans and s == blas.Left,
|
||||
// Aᵀ * X = alpha * B if tA == blas.Trans and s == blas.Left,
|
||||
// Aᴴ * X = alpha * B if tA == blas.ConjTrans and s == blas.Left,
|
||||
// X * A = alpha * B if tA == blas.NoTrans and s == blas.Right,
|
||||
// X * Aᵀ = alpha * B if tA == blas.Trans and s == blas.Right,
|
||||
// X * Aᴴ = alpha * B if tA == blas.ConjTrans and s == blas.Right,
|
||||
//
|
||||
// A * X = alpha * B if tA == blas.NoTrans and s == blas.Left,
|
||||
// Aᵀ * X = alpha * B if tA == blas.Trans and s == blas.Left,
|
||||
// Aᴴ * X = alpha * B if tA == blas.ConjTrans and s == blas.Left,
|
||||
// X * A = alpha * B if tA == blas.NoTrans and s == blas.Right,
|
||||
// X * Aᵀ = alpha * B if tA == blas.Trans and s == blas.Right,
|
||||
// X * Aᴴ = alpha * B if tA == blas.ConjTrans and s == blas.Right,
|
||||
//
|
||||
// where A is an n×n or m×m triangular matrix, X and B are m×n matrices, and
|
||||
// alpha is a scalar.
|
||||
//
|
||||
@@ -487,8 +549,10 @@ func Trsm(s blas.Side, tA blas.Transpose, alpha complex64, a Triangular, b Gener
|
||||
}
|
||||
|
||||
// Hemm performs
|
||||
// C = alpha * A * B + beta * C if s == blas.Left,
|
||||
// C = alpha * B * A + beta * C if s == blas.Right,
|
||||
//
|
||||
// C = alpha * A * B + beta * C if s == blas.Left,
|
||||
// C = alpha * B * A + beta * C if s == blas.Right,
|
||||
//
|
||||
// where A is an n×n or m×m Hermitian matrix, B and C are m×n matrices, and
|
||||
// alpha and beta are scalars.
|
||||
func Hemm(s blas.Side, alpha complex64, a Hermitian, b General, beta complex64, c General) {
|
||||
@@ -502,8 +566,10 @@ func Hemm(s blas.Side, alpha complex64, a Hermitian, b General, beta complex64,
|
||||
}
|
||||
|
||||
// Herk performs the Hermitian rank-k update
|
||||
// C = alpha * A * Aᴴ + beta*C if t == blas.NoTrans,
|
||||
// C = alpha * Aᴴ * A + beta*C if t == blas.ConjTrans,
|
||||
//
|
||||
// C = alpha * A * Aᴴ + beta*C if t == blas.NoTrans,
|
||||
// C = alpha * Aᴴ * A + beta*C if t == blas.ConjTrans,
|
||||
//
|
||||
// where C is an n×n Hermitian matrix, A is an n×k matrix if t == blas.NoTrans
|
||||
// and a k×n matrix otherwise, and alpha and beta are scalars.
|
||||
func Herk(t blas.Transpose, alpha float32, a General, beta float32, c Hermitian) {
|
||||
@@ -517,8 +583,10 @@ func Herk(t blas.Transpose, alpha float32, a General, beta float32, c Hermitian)
|
||||
}
|
||||
|
||||
// Her2k performs the Hermitian rank-2k update
|
||||
// C = alpha * A * Bᴴ + conj(alpha) * B * Aᴴ + beta * C if t == blas.NoTrans,
|
||||
// C = alpha * Aᴴ * B + conj(alpha) * Bᴴ * A + beta * C if t == blas.ConjTrans,
|
||||
//
|
||||
// C = alpha * A * Bᴴ + conj(alpha) * B * Aᴴ + beta * C if t == blas.NoTrans,
|
||||
// C = alpha * Aᴴ * B + conj(alpha) * Bᴴ * A + beta * C if t == blas.ConjTrans,
|
||||
//
|
||||
// where C is an n×n Hermitian matrix, A and B are n×k matrices if t == NoTrans
|
||||
// and k×n matrices otherwise, and alpha and beta are scalars.
|
||||
func Her2k(t blas.Transpose, alpha complex64, a, b General, beta float32, c Hermitian) {
|
||||
|
@@ -13,10 +13,12 @@ import (
|
||||
)
|
||||
|
||||
// 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
|
||||
//
|
||||
// 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.
|
||||
|
@@ -28,7 +28,9 @@ a single vector argument where the increment may only be positive. If the increm
|
||||
is negative, s[0] is the last element in the slice. Note that this is not the same
|
||||
as counting backward from the end of the slice, as len(s) may be longer than
|
||||
necessary. So, for example, if n = 5 and incX = 3, the elements of s are
|
||||
|
||||
[0 * * 1 * * 2 * * 3 * * 4 * * * ...]
|
||||
|
||||
where ∗ elements are never accessed. If incX = -3, the same elements are
|
||||
accessed, just in reverse order (4, 3, 2, 1, 0).
|
||||
|
||||
@@ -36,7 +38,9 @@ Dense matrices are specified by a number of rows, a number of columns, and a str
|
||||
The stride specifies the number of entries in the slice between the first element
|
||||
of successive rows. The stride must be at least as large as the number of columns
|
||||
but may be longer.
|
||||
|
||||
[a00 ... a0n a0* ... a1stride-1 a21 ... amn am* ... amstride-1]
|
||||
|
||||
Thus, dense[i*ld + j] refers to the {i, j}th element of the matrix.
|
||||
|
||||
Symmetric and triangular matrices (non-packed) are stored identically to Dense,
|
||||
@@ -45,41 +49,48 @@ except that only elements in one triangle of the matrix are accessed.
|
||||
Packed symmetric and packed triangular matrices are laid out with the entries
|
||||
condensed such that all of the unreferenced elements are removed. So, the upper triangular
|
||||
matrix
|
||||
[
|
||||
1 2 3
|
||||
0 4 5
|
||||
0 0 6
|
||||
]
|
||||
|
||||
[
|
||||
1 2 3
|
||||
0 4 5
|
||||
0 0 6
|
||||
]
|
||||
|
||||
and the lower-triangular matrix
|
||||
[
|
||||
1 0 0
|
||||
2 3 0
|
||||
4 5 6
|
||||
]
|
||||
|
||||
[
|
||||
1 0 0
|
||||
2 3 0
|
||||
4 5 6
|
||||
]
|
||||
|
||||
will both be compacted as [1 2 3 4 5 6]. The (i, j) element of the original
|
||||
dense matrix can be found at element i*n - (i-1)*i/2 + j for upper triangular,
|
||||
and at element i * (i+1) /2 + j for lower triangular.
|
||||
|
||||
Banded matrices are laid out in a compact format, constructed by removing the
|
||||
zeros in the rows and aligning the diagonals. For example, the matrix
|
||||
[
|
||||
1 2 3 0 0 0
|
||||
4 5 6 7 0 0
|
||||
0 8 9 10 11 0
|
||||
0 0 12 13 14 15
|
||||
0 0 0 16 17 18
|
||||
0 0 0 0 19 20
|
||||
]
|
||||
|
||||
[
|
||||
1 2 3 0 0 0
|
||||
4 5 6 7 0 0
|
||||
0 8 9 10 11 0
|
||||
0 0 12 13 14 15
|
||||
0 0 0 16 17 18
|
||||
0 0 0 0 19 20
|
||||
]
|
||||
|
||||
implicitly becomes (∗ entries are never accessed)
|
||||
[
|
||||
* 1 2 3
|
||||
4 5 6 7
|
||||
8 9 10 11
|
||||
12 13 14 15
|
||||
16 17 18 *
|
||||
19 20 * *
|
||||
]
|
||||
|
||||
[
|
||||
* 1 2 3
|
||||
4 5 6 7
|
||||
8 9 10 11
|
||||
12 13 14 15
|
||||
16 17 18 *
|
||||
19 20 * *
|
||||
]
|
||||
|
||||
which is given to the BLAS routine as [∗ 1 2 3 4 ...].
|
||||
|
||||
See http://www.crest.iu.edu/research/mtl/reference/html/banded.html
|
||||
|
@@ -14,7 +14,9 @@ import (
|
||||
var _ blas.Complex128Level1 = Implementation{}
|
||||
|
||||
// Dzasum returns the sum of the absolute values of the elements of x
|
||||
// \sum_i |Re(x[i])| + |Im(x[i])|
|
||||
//
|
||||
// \sum_i |Re(x[i])| + |Im(x[i])|
|
||||
//
|
||||
// Dzasum returns 0 if incX is negative.
|
||||
func (Implementation) Dzasum(n int, x []complex128, incX int) float64 {
|
||||
if n < 0 {
|
||||
@@ -47,7 +49,9 @@ func (Implementation) Dzasum(n int, x []complex128, incX int) float64 {
|
||||
}
|
||||
|
||||
// Dznrm2 computes the Euclidean norm of the complex vector x,
|
||||
// ‖x‖_2 = sqrt(\sum_i x[i] * conj(x[i])).
|
||||
//
|
||||
// ‖x‖_2 = sqrt(\sum_i x[i] * conj(x[i])).
|
||||
//
|
||||
// This function returns 0 if incX is negative.
|
||||
func (Implementation) Dznrm2(n int, x []complex128, incX int) float64 {
|
||||
if incX < 1 {
|
||||
@@ -164,7 +168,8 @@ func (Implementation) Izamax(n int, x []complex128, incX int) int {
|
||||
}
|
||||
|
||||
// Zaxpy adds alpha times x to y:
|
||||
// y[i] += alpha * x[i] for all i
|
||||
//
|
||||
// y[i] += alpha * x[i] for all i
|
||||
func (Implementation) Zaxpy(n int, alpha complex128, x []complex128, incX int, y []complex128, incY int) {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
@@ -240,7 +245,9 @@ func (Implementation) Zcopy(n int, x []complex128, incX int, y []complex128, inc
|
||||
}
|
||||
|
||||
// Zdotc computes the dot product
|
||||
// xᴴ · y
|
||||
//
|
||||
// xᴴ · y
|
||||
//
|
||||
// of two complex vectors x and y.
|
||||
func (Implementation) Zdotc(n int, x []complex128, incX int, y []complex128, incY int) complex128 {
|
||||
if incX == 0 {
|
||||
@@ -281,7 +288,9 @@ func (Implementation) Zdotc(n int, x []complex128, incX int, y []complex128, inc
|
||||
}
|
||||
|
||||
// Zdotu computes the dot product
|
||||
// xᵀ · y
|
||||
//
|
||||
// xᵀ · y
|
||||
//
|
||||
// of two complex vectors x and y.
|
||||
func (Implementation) Zdotu(n int, x []complex128, incX int, y []complex128, incY int) complex128 {
|
||||
if incX == 0 {
|
||||
|
@@ -16,7 +16,9 @@ import (
|
||||
var _ blas.Complex64Level1 = Implementation{}
|
||||
|
||||
// Scasum returns the sum of the absolute values of the elements of x
|
||||
// \sum_i |Re(x[i])| + |Im(x[i])|
|
||||
//
|
||||
// \sum_i |Re(x[i])| + |Im(x[i])|
|
||||
//
|
||||
// Scasum returns 0 if incX is negative.
|
||||
//
|
||||
// Complex64 implementations are autogenerated and not directly tested.
|
||||
@@ -51,7 +53,9 @@ func (Implementation) Scasum(n int, x []complex64, incX int) float32 {
|
||||
}
|
||||
|
||||
// Scnrm2 computes the Euclidean norm of the complex vector x,
|
||||
// ‖x‖_2 = sqrt(\sum_i x[i] * conj(x[i])).
|
||||
//
|
||||
// ‖x‖_2 = sqrt(\sum_i x[i] * conj(x[i])).
|
||||
//
|
||||
// This function returns 0 if incX is negative.
|
||||
//
|
||||
// Complex64 implementations are autogenerated and not directly tested.
|
||||
@@ -172,7 +176,8 @@ func (Implementation) Icamax(n int, x []complex64, incX int) int {
|
||||
}
|
||||
|
||||
// Caxpy adds alpha times x to y:
|
||||
// y[i] += alpha * x[i] for all i
|
||||
//
|
||||
// y[i] += alpha * x[i] for all i
|
||||
//
|
||||
// Complex64 implementations are autogenerated and not directly tested.
|
||||
func (Implementation) Caxpy(n int, alpha complex64, x []complex64, incX int, y []complex64, incY int) {
|
||||
@@ -252,7 +257,9 @@ func (Implementation) Ccopy(n int, x []complex64, incX int, y []complex64, incY
|
||||
}
|
||||
|
||||
// Cdotc computes the dot product
|
||||
// xᴴ · y
|
||||
//
|
||||
// xᴴ · y
|
||||
//
|
||||
// of two complex vectors x and y.
|
||||
//
|
||||
// Complex64 implementations are autogenerated and not directly tested.
|
||||
@@ -295,7 +302,9 @@ func (Implementation) Cdotc(n int, x []complex64, incX int, y []complex64, incY
|
||||
}
|
||||
|
||||
// Cdotu computes the dot product
|
||||
// xᵀ · y
|
||||
//
|
||||
// xᵀ · y
|
||||
//
|
||||
// of two complex vectors x and y.
|
||||
//
|
||||
// Complex64 implementations are autogenerated and not directly tested.
|
||||
|
@@ -16,7 +16,9 @@ import (
|
||||
var _ blas.Float32Level1 = Implementation{}
|
||||
|
||||
// Snrm2 computes the Euclidean norm of a vector,
|
||||
// sqrt(\sum_i x[i] * x[i]).
|
||||
//
|
||||
// sqrt(\sum_i x[i] * x[i]).
|
||||
//
|
||||
// This function returns 0 if incX is negative.
|
||||
//
|
||||
// Float32 implementations are autogenerated and not directly tested.
|
||||
@@ -46,7 +48,9 @@ func (Implementation) Snrm2(n int, x []float32, incX int) float32 {
|
||||
}
|
||||
|
||||
// Sasum computes the sum of the absolute values of the elements of x.
|
||||
// \sum_i |x[i]|
|
||||
//
|
||||
// \sum_i |x[i]|
|
||||
//
|
||||
// Sasum returns 0 if incX is negative.
|
||||
//
|
||||
// Float32 implementations are autogenerated and not directly tested.
|
||||
@@ -127,7 +131,8 @@ func (Implementation) Isamax(n int, x []float32, incX int) int {
|
||||
}
|
||||
|
||||
// Sswap exchanges the elements of two vectors.
|
||||
// x[i], y[i] = y[i], x[i] for all i
|
||||
//
|
||||
// x[i], y[i] = y[i], x[i] for all i
|
||||
//
|
||||
// Float32 implementations are autogenerated and not directly tested.
|
||||
func (Implementation) Sswap(n int, x []float32, incX int, y []float32, incY int) {
|
||||
@@ -171,7 +176,8 @@ func (Implementation) Sswap(n int, x []float32, incX int, y []float32, incY int)
|
||||
}
|
||||
|
||||
// Scopy copies the elements of x into the elements of y.
|
||||
// y[i] = x[i] for all i
|
||||
//
|
||||
// y[i] = x[i] for all i
|
||||
//
|
||||
// Float32 implementations are autogenerated and not directly tested.
|
||||
func (Implementation) Scopy(n int, x []float32, incX int, y []float32, incY int) {
|
||||
@@ -212,7 +218,8 @@ func (Implementation) Scopy(n int, x []float32, incX int, y []float32, incY int)
|
||||
}
|
||||
|
||||
// Saxpy adds alpha times x to y
|
||||
// y[i] += alpha * x[i] for all i
|
||||
//
|
||||
// y[i] += alpha * x[i] for all i
|
||||
//
|
||||
// Float32 implementations are autogenerated and not directly tested.
|
||||
func (Implementation) Saxpy(n int, alpha float32, x []float32, incX int, y []float32, incY int) {
|
||||
@@ -252,26 +259,32 @@ func (Implementation) Saxpy(n int, alpha float32, x []float32, incX int, y []flo
|
||||
}
|
||||
|
||||
// Srotg computes a plane rotation
|
||||
// ⎡ c s ⎤ ⎡ a ⎤ = ⎡ r ⎤
|
||||
// ⎣ -s c ⎦ ⎣ b ⎦ ⎣ 0 ⎦
|
||||
//
|
||||
// ⎡ c s ⎤ ⎡ a ⎤ = ⎡ r ⎤
|
||||
// ⎣ -s c ⎦ ⎣ b ⎦ ⎣ 0 ⎦
|
||||
//
|
||||
// satisfying c^2 + s^2 = 1.
|
||||
//
|
||||
// The computation uses the formulas
|
||||
// sigma = sgn(a) if |a| > |b|
|
||||
// = sgn(b) if |b| >= |a|
|
||||
// r = sigma*sqrt(a^2 + b^2)
|
||||
// c = 1; s = 0 if r = 0
|
||||
// c = a/r; s = b/r if r != 0
|
||||
// c >= 0 if |a| > |b|
|
||||
//
|
||||
// sigma = sgn(a) if |a| > |b|
|
||||
// = sgn(b) if |b| >= |a|
|
||||
// r = sigma*sqrt(a^2 + b^2)
|
||||
// c = 1; s = 0 if r = 0
|
||||
// c = a/r; s = b/r if r != 0
|
||||
// c >= 0 if |a| > |b|
|
||||
//
|
||||
// The subroutine also computes
|
||||
// z = s if |a| > |b|,
|
||||
// = 1/c if |b| >= |a| and c != 0
|
||||
// = 1 if c = 0
|
||||
//
|
||||
// z = s if |a| > |b|,
|
||||
// = 1/c if |b| >= |a| and c != 0
|
||||
// = 1 if c = 0
|
||||
//
|
||||
// This allows c and s to be reconstructed from z as follows:
|
||||
// If z = 1, set c = 0, s = 1.
|
||||
// If |z| < 1, set c = sqrt(1 - z^2) and s = z.
|
||||
// If |z| > 1, set c = 1/z and s = sqrt(1 - c^2).
|
||||
//
|
||||
// If z = 1, set c = 0, s = 1.
|
||||
// If |z| < 1, set c = sqrt(1 - z^2) and s = z.
|
||||
// If |z| > 1, set c = 1/z and s = sqrt(1 - c^2).
|
||||
//
|
||||
// NOTE: There is a discrepancy between the reference implementation and the
|
||||
// BLAS technical manual regarding the sign for r when a or b are zero. Drotg
|
||||
@@ -440,8 +453,9 @@ func (Implementation) Srotmg(d1, d2, x1, y1 float32) (p blas.SrotmParams, rd1, r
|
||||
}
|
||||
|
||||
// Srot applies a plane transformation.
|
||||
// x[i] = c * x[i] + s * y[i]
|
||||
// y[i] = c * y[i] - s * x[i]
|
||||
//
|
||||
// x[i] = c * x[i] + s * y[i]
|
||||
// y[i] = c * y[i] - s * x[i]
|
||||
//
|
||||
// Float32 implementations are autogenerated and not directly tested.
|
||||
func (Implementation) Srot(n int, x []float32, incX int, y []float32, incY int, c float32, s float32) {
|
||||
@@ -596,7 +610,9 @@ func (Implementation) Srotm(n int, x []float32, incX int, y []float32, incY int,
|
||||
}
|
||||
|
||||
// Sscal scales x by alpha.
|
||||
// x[i] *= alpha
|
||||
//
|
||||
// x[i] *= alpha
|
||||
//
|
||||
// Sscal has no effect if incX < 0.
|
||||
//
|
||||
// Float32 implementations are autogenerated and not directly tested.
|
||||
|
@@ -11,7 +11,8 @@ import (
|
||||
)
|
||||
|
||||
// Dsdot computes the dot product of the two vectors
|
||||
// \sum_i x[i]*y[i]
|
||||
//
|
||||
// \sum_i x[i]*y[i]
|
||||
//
|
||||
// Float32 implementations are autogenerated and not directly tested.
|
||||
func (Implementation) Dsdot(n int, x []float32, incX int, y []float32, incY int) float64 {
|
||||
|
@@ -11,7 +11,8 @@ import (
|
||||
)
|
||||
|
||||
// Sdot computes the dot product of the two vectors
|
||||
// \sum_i x[i]*y[i]
|
||||
//
|
||||
// \sum_i x[i]*y[i]
|
||||
//
|
||||
// Float32 implementations are autogenerated and not directly tested.
|
||||
func (Implementation) Sdot(n int, x []float32, incX int, y []float32, incY int) float32 {
|
||||
|
@@ -11,7 +11,8 @@ import (
|
||||
)
|
||||
|
||||
// Sdsdot computes the dot product of the two vectors plus a constant
|
||||
// alpha + \sum_i x[i]*y[i]
|
||||
//
|
||||
// alpha + \sum_i x[i]*y[i]
|
||||
//
|
||||
// Float32 implementations are autogenerated and not directly tested.
|
||||
func (Implementation) Sdsdot(n int, alpha float32, x []float32, incX int, y []float32, incY int) float32 {
|
||||
|
@@ -14,7 +14,9 @@ import (
|
||||
var _ blas.Float64Level1 = Implementation{}
|
||||
|
||||
// Dnrm2 computes the Euclidean norm of a vector,
|
||||
// sqrt(\sum_i x[i] * x[i]).
|
||||
//
|
||||
// sqrt(\sum_i x[i] * x[i]).
|
||||
//
|
||||
// This function returns 0 if incX is negative.
|
||||
func (Implementation) Dnrm2(n int, x []float64, incX int) float64 {
|
||||
if incX < 1 {
|
||||
@@ -42,7 +44,9 @@ func (Implementation) Dnrm2(n int, x []float64, incX int) float64 {
|
||||
}
|
||||
|
||||
// Dasum computes the sum of the absolute values of the elements of x.
|
||||
// \sum_i |x[i]|
|
||||
//
|
||||
// \sum_i |x[i]|
|
||||
//
|
||||
// Dasum returns 0 if incX is negative.
|
||||
func (Implementation) Dasum(n int, x []float64, incX int) float64 {
|
||||
var sum float64
|
||||
@@ -119,7 +123,8 @@ func (Implementation) Idamax(n int, x []float64, incX int) int {
|
||||
}
|
||||
|
||||
// Dswap exchanges the elements of two vectors.
|
||||
// x[i], y[i] = y[i], x[i] for all i
|
||||
//
|
||||
// x[i], y[i] = y[i], x[i] for all i
|
||||
func (Implementation) Dswap(n int, x []float64, incX int, y []float64, incY int) {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
@@ -161,7 +166,8 @@ func (Implementation) Dswap(n int, x []float64, incX int, y []float64, incY int)
|
||||
}
|
||||
|
||||
// Dcopy copies the elements of x into the elements of y.
|
||||
// y[i] = x[i] for all i
|
||||
//
|
||||
// y[i] = x[i] for all i
|
||||
func (Implementation) Dcopy(n int, x []float64, incX int, y []float64, incY int) {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
@@ -200,7 +206,8 @@ func (Implementation) Dcopy(n int, x []float64, incX int, y []float64, incY int)
|
||||
}
|
||||
|
||||
// Daxpy adds alpha times x to y
|
||||
// y[i] += alpha * x[i] for all i
|
||||
//
|
||||
// y[i] += alpha * x[i] for all i
|
||||
func (Implementation) Daxpy(n int, alpha float64, x []float64, incX int, y []float64, incY int) {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
@@ -238,26 +245,32 @@ func (Implementation) Daxpy(n int, alpha float64, x []float64, incX int, y []flo
|
||||
}
|
||||
|
||||
// Drotg computes a plane rotation
|
||||
// ⎡ c s ⎤ ⎡ a ⎤ = ⎡ r ⎤
|
||||
// ⎣ -s c ⎦ ⎣ b ⎦ ⎣ 0 ⎦
|
||||
//
|
||||
// ⎡ c s ⎤ ⎡ a ⎤ = ⎡ r ⎤
|
||||
// ⎣ -s c ⎦ ⎣ b ⎦ ⎣ 0 ⎦
|
||||
//
|
||||
// satisfying c^2 + s^2 = 1.
|
||||
//
|
||||
// The computation uses the formulas
|
||||
// sigma = sgn(a) if |a| > |b|
|
||||
// = sgn(b) if |b| >= |a|
|
||||
// r = sigma*sqrt(a^2 + b^2)
|
||||
// c = 1; s = 0 if r = 0
|
||||
// c = a/r; s = b/r if r != 0
|
||||
// c >= 0 if |a| > |b|
|
||||
//
|
||||
// sigma = sgn(a) if |a| > |b|
|
||||
// = sgn(b) if |b| >= |a|
|
||||
// r = sigma*sqrt(a^2 + b^2)
|
||||
// c = 1; s = 0 if r = 0
|
||||
// c = a/r; s = b/r if r != 0
|
||||
// c >= 0 if |a| > |b|
|
||||
//
|
||||
// The subroutine also computes
|
||||
// z = s if |a| > |b|,
|
||||
// = 1/c if |b| >= |a| and c != 0
|
||||
// = 1 if c = 0
|
||||
//
|
||||
// z = s if |a| > |b|,
|
||||
// = 1/c if |b| >= |a| and c != 0
|
||||
// = 1 if c = 0
|
||||
//
|
||||
// This allows c and s to be reconstructed from z as follows:
|
||||
// If z = 1, set c = 0, s = 1.
|
||||
// If |z| < 1, set c = sqrt(1 - z^2) and s = z.
|
||||
// If |z| > 1, set c = 1/z and s = sqrt(1 - c^2).
|
||||
//
|
||||
// If z = 1, set c = 0, s = 1.
|
||||
// If |z| < 1, set c = sqrt(1 - z^2) and s = z.
|
||||
// If |z| > 1, set c = 1/z and s = sqrt(1 - c^2).
|
||||
//
|
||||
// NOTE: There is a discrepancy between the reference implementation and the
|
||||
// BLAS technical manual regarding the sign for r when a or b are zero. Drotg
|
||||
@@ -422,8 +435,9 @@ func (Implementation) Drotmg(d1, d2, x1, y1 float64) (p blas.DrotmParams, rd1, r
|
||||
}
|
||||
|
||||
// Drot applies a plane transformation.
|
||||
// x[i] = c * x[i] + s * y[i]
|
||||
// y[i] = c * y[i] - s * x[i]
|
||||
//
|
||||
// x[i] = c * x[i] + s * y[i]
|
||||
// y[i] = c * y[i] - s * x[i]
|
||||
func (Implementation) Drot(n int, x []float64, incX int, y []float64, incY int, c float64, s float64) {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
@@ -574,7 +588,9 @@ func (Implementation) Drotm(n int, x []float64, incX int, y []float64, incY int,
|
||||
}
|
||||
|
||||
// Dscal scales x by alpha.
|
||||
// x[i] *= alpha
|
||||
//
|
||||
// x[i] *= alpha
|
||||
//
|
||||
// Dscal has no effect if incX < 0.
|
||||
func (Implementation) Dscal(n int, alpha float64, x []float64, incX int) {
|
||||
if incX < 1 {
|
||||
|
@@ -9,7 +9,8 @@ import (
|
||||
)
|
||||
|
||||
// Ddot computes the dot product of the two vectors
|
||||
// \sum_i x[i]*y[i]
|
||||
//
|
||||
// \sum_i x[i]*y[i]
|
||||
func (Implementation) Ddot(n int, x []float64, incX int, y []float64, incY int) float64 {
|
||||
if incX == 0 {
|
||||
panic(zeroIncX)
|
||||
|
@@ -14,9 +14,11 @@ import (
|
||||
var _ blas.Complex128Level2 = Implementation{}
|
||||
|
||||
// Zgbmv performs one of the matrix-vector operations
|
||||
// y = alpha * A * x + beta * y if trans = blas.NoTrans
|
||||
// y = alpha * Aᵀ * x + beta * y if trans = blas.Trans
|
||||
// y = alpha * Aᴴ * x + beta * y if trans = blas.ConjTrans
|
||||
//
|
||||
// y = alpha * A * x + beta * y if trans = blas.NoTrans
|
||||
// y = alpha * Aᵀ * x + beta * y if trans = blas.Trans
|
||||
// y = alpha * Aᴴ * x + beta * y if trans = blas.ConjTrans
|
||||
//
|
||||
// where alpha and beta are scalars, x and y are vectors, and A is an m×n band matrix
|
||||
// with kL sub-diagonals and kU super-diagonals.
|
||||
func (Implementation) Zgbmv(trans blas.Transpose, m, n, kL, kU int, alpha complex128, a []complex128, lda int, x []complex128, incX int, beta complex128, y []complex128, incY int) {
|
||||
@@ -209,9 +211,11 @@ func (Implementation) Zgbmv(trans blas.Transpose, m, n, kL, kU int, alpha comple
|
||||
}
|
||||
|
||||
// Zgemv performs one of the matrix-vector operations
|
||||
// y = alpha * A * x + beta * y if trans = blas.NoTrans
|
||||
// y = alpha * Aᵀ * x + beta * y if trans = blas.Trans
|
||||
// y = alpha * Aᴴ * x + beta * y if trans = blas.ConjTrans
|
||||
//
|
||||
// y = alpha * A * x + beta * y if trans = blas.NoTrans
|
||||
// y = alpha * Aᵀ * x + beta * y if trans = blas.Trans
|
||||
// y = alpha * Aᴴ * x + beta * y if trans = blas.ConjTrans
|
||||
//
|
||||
// where alpha and beta are scalars, x and y are vectors, and A is an m×n dense matrix.
|
||||
func (Implementation) Zgemv(trans blas.Transpose, m, n int, alpha complex128, a []complex128, lda int, x []complex128, incX int, beta complex128, y []complex128, incY int) {
|
||||
switch trans {
|
||||
@@ -364,7 +368,9 @@ func (Implementation) Zgemv(trans blas.Transpose, m, n int, alpha complex128, a
|
||||
}
|
||||
|
||||
// Zgerc performs the rank-one operation
|
||||
// A += alpha * x * yᴴ
|
||||
//
|
||||
// A += alpha * x * yᴴ
|
||||
//
|
||||
// where A is an m×n dense matrix, alpha is a scalar, x is an m element vector,
|
||||
// and y is an n element vector.
|
||||
func (Implementation) Zgerc(m, n int, alpha complex128, x []complex128, incX int, y []complex128, incY int, a []complex128, lda int) {
|
||||
@@ -422,7 +428,9 @@ func (Implementation) Zgerc(m, n int, alpha complex128, x []complex128, incX int
|
||||
}
|
||||
|
||||
// Zgeru performs the rank-one operation
|
||||
// A += alpha * x * yᵀ
|
||||
//
|
||||
// A += alpha * x * yᵀ
|
||||
//
|
||||
// where A is an m×n dense matrix, alpha is a scalar, x is an m element vector,
|
||||
// and y is an n element vector.
|
||||
func (Implementation) Zgeru(m, n int, alpha complex128, x []complex128, incX int, y []complex128, incY int, a []complex128, lda int) {
|
||||
@@ -491,7 +499,9 @@ func (Implementation) Zgeru(m, n int, alpha complex128, x []complex128, incX int
|
||||
}
|
||||
|
||||
// Zhbmv performs the matrix-vector operation
|
||||
// y = alpha * A * x + beta * y
|
||||
//
|
||||
// y = alpha * A * x + beta * y
|
||||
//
|
||||
// where alpha and beta are scalars, x and y are vectors, and A is an n×n
|
||||
// Hermitian band matrix with k super-diagonals. The imaginary parts of
|
||||
// the diagonal elements of A are ignored and assumed to be zero.
|
||||
@@ -662,7 +672,9 @@ func (Implementation) Zhbmv(uplo blas.Uplo, n, k int, alpha complex128, a []comp
|
||||
}
|
||||
|
||||
// Zhemv performs the matrix-vector operation
|
||||
// y = alpha * A * x + beta * y
|
||||
//
|
||||
// y = alpha * A * x + beta * y
|
||||
//
|
||||
// where alpha and beta are scalars, x and y are vectors, and A is an n×n
|
||||
// Hermitian matrix. The imaginary parts of the diagonal elements of A are
|
||||
// ignored and assumed to be zero.
|
||||
@@ -822,7 +834,9 @@ func (Implementation) Zhemv(uplo blas.Uplo, n int, alpha complex128, a []complex
|
||||
}
|
||||
|
||||
// Zher performs the Hermitian rank-one operation
|
||||
// A += alpha * x * xᴴ
|
||||
//
|
||||
// A += alpha * x * xᴴ
|
||||
//
|
||||
// where A is an n×n Hermitian matrix, alpha is a real scalar, and x is an n
|
||||
// element vector. On entry, the imaginary parts of the diagonal elements of A
|
||||
// are ignored and assumed to be zero, on return they will be set to zero.
|
||||
@@ -944,7 +958,9 @@ func (Implementation) Zher(uplo blas.Uplo, n int, alpha float64, x []complex128,
|
||||
}
|
||||
|
||||
// Zher2 performs the Hermitian rank-two operation
|
||||
// A += alpha * x * yᴴ + conj(alpha) * y * xᴴ
|
||||
//
|
||||
// A += alpha * x * yᴴ + conj(alpha) * y * xᴴ
|
||||
//
|
||||
// where alpha is a scalar, x and y are n element vectors and A is an n×n
|
||||
// Hermitian matrix. On entry, the imaginary parts of the diagonal elements are
|
||||
// ignored and assumed to be zero. On return they will be set to zero.
|
||||
@@ -1081,7 +1097,9 @@ func (Implementation) Zher2(uplo blas.Uplo, n int, alpha complex128, x []complex
|
||||
}
|
||||
|
||||
// Zhpmv performs the matrix-vector operation
|
||||
// y = alpha * A * x + beta * y
|
||||
//
|
||||
// y = alpha * A * x + beta * y
|
||||
//
|
||||
// where alpha and beta are scalars, x and y are vectors, and A is an n×n
|
||||
// Hermitian matrix in packed form. The imaginary parts of the diagonal
|
||||
// elements of A are ignored and assumed to be zero.
|
||||
@@ -1248,7 +1266,9 @@ func (Implementation) Zhpmv(uplo blas.Uplo, n int, alpha complex128, ap []comple
|
||||
}
|
||||
|
||||
// Zhpr performs the Hermitian rank-1 operation
|
||||
// A += alpha * x * xᴴ
|
||||
//
|
||||
// A += alpha * x * xᴴ
|
||||
//
|
||||
// where alpha is a real scalar, x is a vector, and A is an n×n hermitian matrix
|
||||
// in packed form. On entry, the imaginary parts of the diagonal elements are
|
||||
// assumed to be zero, and on return they are set to zero.
|
||||
@@ -1382,7 +1402,9 @@ func (Implementation) Zhpr(uplo blas.Uplo, n int, alpha float64, x []complex128,
|
||||
}
|
||||
|
||||
// Zhpr2 performs the Hermitian rank-2 operation
|
||||
// A += alpha * x * yᴴ + conj(alpha) * y * xᴴ
|
||||
//
|
||||
// A += alpha * x * yᴴ + conj(alpha) * y * xᴴ
|
||||
//
|
||||
// where alpha is a complex scalar, x and y are n element vectors, and A is an
|
||||
// n×n Hermitian matrix, supplied in packed form. On entry, the imaginary parts
|
||||
// of the diagonal elements are assumed to be zero, and on return they are set to zero.
|
||||
@@ -1529,9 +1551,11 @@ func (Implementation) Zhpr2(uplo blas.Uplo, n int, alpha complex128, x []complex
|
||||
}
|
||||
|
||||
// Ztbmv performs one of the matrix-vector operations
|
||||
// x = A * x if trans = blas.NoTrans
|
||||
// x = Aᵀ * x if trans = blas.Trans
|
||||
// x = Aᴴ * x if trans = blas.ConjTrans
|
||||
//
|
||||
// x = A * x if trans = blas.NoTrans
|
||||
// x = Aᵀ * x if trans = blas.Trans
|
||||
// x = Aᴴ * x if trans = blas.ConjTrans
|
||||
//
|
||||
// where x is an n element vector and A is an n×n triangular band matrix, with
|
||||
// (k+1) diagonals.
|
||||
func (Implementation) Ztbmv(uplo blas.Uplo, trans blas.Transpose, diag blas.Diag, n, k int, a []complex128, lda int, x []complex128, incX int) {
|
||||
@@ -1765,9 +1789,11 @@ func (Implementation) Ztbmv(uplo blas.Uplo, trans blas.Transpose, diag blas.Diag
|
||||
}
|
||||
|
||||
// Ztbsv solves one of the systems of equations
|
||||
// A * x = b if trans == blas.NoTrans
|
||||
// Aᵀ * x = b if trans == blas.Trans
|
||||
// Aᴴ * x = b if trans == blas.ConjTrans
|
||||
//
|
||||
// A * x = b if trans == blas.NoTrans
|
||||
// Aᵀ * x = b if trans == blas.Trans
|
||||
// Aᴴ * x = b if trans == blas.ConjTrans
|
||||
//
|
||||
// where b and x are n element vectors and A is an n×n triangular band matrix
|
||||
// with (k+1) diagonals.
|
||||
//
|
||||
@@ -2007,9 +2033,11 @@ func (Implementation) Ztbsv(uplo blas.Uplo, trans blas.Transpose, diag blas.Diag
|
||||
}
|
||||
|
||||
// Ztpmv performs one of the matrix-vector operations
|
||||
// x = A * x if trans = blas.NoTrans
|
||||
// x = Aᵀ * x if trans = blas.Trans
|
||||
// x = Aᴴ * x if trans = blas.ConjTrans
|
||||
//
|
||||
// x = A * x if trans = blas.NoTrans
|
||||
// x = Aᵀ * x if trans = blas.Trans
|
||||
// x = Aᴴ * x if trans = blas.ConjTrans
|
||||
//
|
||||
// where x is an n element vector and A is an n×n triangular matrix, supplied in
|
||||
// packed form.
|
||||
func (Implementation) Ztpmv(uplo blas.Uplo, trans blas.Transpose, diag blas.Diag, n int, ap []complex128, x []complex128, incX int) {
|
||||
@@ -2245,9 +2273,11 @@ func (Implementation) Ztpmv(uplo blas.Uplo, trans blas.Transpose, diag blas.Diag
|
||||
}
|
||||
|
||||
// Ztpsv solves one of the systems of equations
|
||||
// A * x = b if trans == blas.NoTrans
|
||||
// Aᵀ * x = b if trans == blas.Trans
|
||||
// Aᴴ * x = b if trans == blas.ConjTrans
|
||||
//
|
||||
// A * x = b if trans == blas.NoTrans
|
||||
// Aᵀ * x = b if trans == blas.Trans
|
||||
// Aᴴ * x = b if trans == blas.ConjTrans
|
||||
//
|
||||
// where b and x are n element vectors and A is an n×n triangular matrix in
|
||||
// packed form.
|
||||
//
|
||||
@@ -2481,9 +2511,11 @@ func (Implementation) Ztpsv(uplo blas.Uplo, trans blas.Transpose, diag blas.Diag
|
||||
}
|
||||
|
||||
// Ztrmv performs one of the matrix-vector operations
|
||||
// x = A * x if trans = blas.NoTrans
|
||||
// x = Aᵀ * x if trans = blas.Trans
|
||||
// x = Aᴴ * x if trans = blas.ConjTrans
|
||||
//
|
||||
// x = A * x if trans = blas.NoTrans
|
||||
// x = Aᵀ * x if trans = blas.Trans
|
||||
// x = Aᴴ * x if trans = blas.ConjTrans
|
||||
//
|
||||
// where x is a vector, and A is an n×n triangular matrix.
|
||||
func (Implementation) Ztrmv(uplo blas.Uplo, trans blas.Transpose, diag blas.Diag, n int, a []complex128, lda int, x []complex128, incX int) {
|
||||
switch trans {
|
||||
@@ -2689,9 +2721,11 @@ func (Implementation) Ztrmv(uplo blas.Uplo, trans blas.Transpose, diag blas.Diag
|
||||
}
|
||||
|
||||
// Ztrsv solves one of the systems of equations
|
||||
// A * x = b if trans == blas.NoTrans
|
||||
// Aᵀ * x = b if trans == blas.Trans
|
||||
// Aᴴ * x = b if trans == blas.ConjTrans
|
||||
//
|
||||
// A * x = b if trans == blas.NoTrans
|
||||
// Aᵀ * x = b if trans == blas.Trans
|
||||
// Aᴴ * x = b if trans == blas.ConjTrans
|
||||
//
|
||||
// where b and x are n element vectors and A is an n×n triangular matrix.
|
||||
//
|
||||
// On entry, x contains the values of b, and the solution is
|
||||
|
@@ -16,9 +16,11 @@ import (
|
||||
var _ blas.Complex64Level2 = Implementation{}
|
||||
|
||||
// Cgbmv performs one of the matrix-vector operations
|
||||
// y = alpha * A * x + beta * y if trans = blas.NoTrans
|
||||
// y = alpha * Aᵀ * x + beta * y if trans = blas.Trans
|
||||
// y = alpha * Aᴴ * x + beta * y if trans = blas.ConjTrans
|
||||
//
|
||||
// y = alpha * A * x + beta * y if trans = blas.NoTrans
|
||||
// y = alpha * Aᵀ * x + beta * y if trans = blas.Trans
|
||||
// y = alpha * Aᴴ * x + beta * y if trans = blas.ConjTrans
|
||||
//
|
||||
// where alpha and beta are scalars, x and y are vectors, and A is an m×n band matrix
|
||||
// with kL sub-diagonals and kU super-diagonals.
|
||||
//
|
||||
@@ -213,9 +215,11 @@ func (Implementation) Cgbmv(trans blas.Transpose, m, n, kL, kU int, alpha comple
|
||||
}
|
||||
|
||||
// Cgemv performs one of the matrix-vector operations
|
||||
// y = alpha * A * x + beta * y if trans = blas.NoTrans
|
||||
// y = alpha * Aᵀ * x + beta * y if trans = blas.Trans
|
||||
// y = alpha * Aᴴ * x + beta * y if trans = blas.ConjTrans
|
||||
//
|
||||
// y = alpha * A * x + beta * y if trans = blas.NoTrans
|
||||
// y = alpha * Aᵀ * x + beta * y if trans = blas.Trans
|
||||
// y = alpha * Aᴴ * x + beta * y if trans = blas.ConjTrans
|
||||
//
|
||||
// where alpha and beta are scalars, x and y are vectors, and A is an m×n dense matrix.
|
||||
//
|
||||
// Complex64 implementations are autogenerated and not directly tested.
|
||||
@@ -370,7 +374,9 @@ func (Implementation) Cgemv(trans blas.Transpose, m, n int, alpha complex64, a [
|
||||
}
|
||||
|
||||
// Cgerc performs the rank-one operation
|
||||
// A += alpha * x * yᴴ
|
||||
//
|
||||
// A += alpha * x * yᴴ
|
||||
//
|
||||
// where A is an m×n dense matrix, alpha is a scalar, x is an m element vector,
|
||||
// and y is an n element vector.
|
||||
//
|
||||
@@ -430,7 +436,9 @@ func (Implementation) Cgerc(m, n int, alpha complex64, x []complex64, incX int,
|
||||
}
|
||||
|
||||
// Cgeru performs the rank-one operation
|
||||
// A += alpha * x * yᵀ
|
||||
//
|
||||
// A += alpha * x * yᵀ
|
||||
//
|
||||
// where A is an m×n dense matrix, alpha is a scalar, x is an m element vector,
|
||||
// and y is an n element vector.
|
||||
//
|
||||
@@ -501,7 +509,9 @@ func (Implementation) Cgeru(m, n int, alpha complex64, x []complex64, incX int,
|
||||
}
|
||||
|
||||
// Chbmv performs the matrix-vector operation
|
||||
// y = alpha * A * x + beta * y
|
||||
//
|
||||
// y = alpha * A * x + beta * y
|
||||
//
|
||||
// where alpha and beta are scalars, x and y are vectors, and A is an n×n
|
||||
// Hermitian band matrix with k super-diagonals. The imaginary parts of
|
||||
// the diagonal elements of A are ignored and assumed to be zero.
|
||||
@@ -674,7 +684,9 @@ func (Implementation) Chbmv(uplo blas.Uplo, n, k int, alpha complex64, a []compl
|
||||
}
|
||||
|
||||
// Chemv performs the matrix-vector operation
|
||||
// y = alpha * A * x + beta * y
|
||||
//
|
||||
// y = alpha * A * x + beta * y
|
||||
//
|
||||
// where alpha and beta are scalars, x and y are vectors, and A is an n×n
|
||||
// Hermitian matrix. The imaginary parts of the diagonal elements of A are
|
||||
// ignored and assumed to be zero.
|
||||
@@ -836,7 +848,9 @@ func (Implementation) Chemv(uplo blas.Uplo, n int, alpha complex64, a []complex6
|
||||
}
|
||||
|
||||
// Cher performs the Hermitian rank-one operation
|
||||
// A += alpha * x * xᴴ
|
||||
//
|
||||
// A += alpha * x * xᴴ
|
||||
//
|
||||
// where A is an n×n Hermitian matrix, alpha is a real scalar, and x is an n
|
||||
// element vector. On entry, the imaginary parts of the diagonal elements of A
|
||||
// are ignored and assumed to be zero, on return they will be set to zero.
|
||||
@@ -960,7 +974,9 @@ func (Implementation) Cher(uplo blas.Uplo, n int, alpha float32, x []complex64,
|
||||
}
|
||||
|
||||
// Cher2 performs the Hermitian rank-two operation
|
||||
// A += alpha * x * yᴴ + conj(alpha) * y * xᴴ
|
||||
//
|
||||
// A += alpha * x * yᴴ + conj(alpha) * y * xᴴ
|
||||
//
|
||||
// where alpha is a scalar, x and y are n element vectors and A is an n×n
|
||||
// Hermitian matrix. On entry, the imaginary parts of the diagonal elements are
|
||||
// ignored and assumed to be zero. On return they will be set to zero.
|
||||
@@ -1099,7 +1115,9 @@ func (Implementation) Cher2(uplo blas.Uplo, n int, alpha complex64, x []complex6
|
||||
}
|
||||
|
||||
// Chpmv performs the matrix-vector operation
|
||||
// y = alpha * A * x + beta * y
|
||||
//
|
||||
// y = alpha * A * x + beta * y
|
||||
//
|
||||
// where alpha and beta are scalars, x and y are vectors, and A is an n×n
|
||||
// Hermitian matrix in packed form. The imaginary parts of the diagonal
|
||||
// elements of A are ignored and assumed to be zero.
|
||||
@@ -1268,7 +1286,9 @@ func (Implementation) Chpmv(uplo blas.Uplo, n int, alpha complex64, ap []complex
|
||||
}
|
||||
|
||||
// Chpr performs the Hermitian rank-1 operation
|
||||
// A += alpha * x * xᴴ
|
||||
//
|
||||
// A += alpha * x * xᴴ
|
||||
//
|
||||
// where alpha is a real scalar, x is a vector, and A is an n×n hermitian matrix
|
||||
// in packed form. On entry, the imaginary parts of the diagonal elements are
|
||||
// assumed to be zero, and on return they are set to zero.
|
||||
@@ -1404,7 +1424,9 @@ func (Implementation) Chpr(uplo blas.Uplo, n int, alpha float32, x []complex64,
|
||||
}
|
||||
|
||||
// Chpr2 performs the Hermitian rank-2 operation
|
||||
// A += alpha * x * yᴴ + conj(alpha) * y * xᴴ
|
||||
//
|
||||
// A += alpha * x * yᴴ + conj(alpha) * y * xᴴ
|
||||
//
|
||||
// where alpha is a complex scalar, x and y are n element vectors, and A is an
|
||||
// n×n Hermitian matrix, supplied in packed form. On entry, the imaginary parts
|
||||
// of the diagonal elements are assumed to be zero, and on return they are set to zero.
|
||||
@@ -1553,9 +1575,11 @@ func (Implementation) Chpr2(uplo blas.Uplo, n int, alpha complex64, x []complex6
|
||||
}
|
||||
|
||||
// Ctbmv performs one of the matrix-vector operations
|
||||
// x = A * x if trans = blas.NoTrans
|
||||
// x = Aᵀ * x if trans = blas.Trans
|
||||
// x = Aᴴ * x if trans = blas.ConjTrans
|
||||
//
|
||||
// x = A * x if trans = blas.NoTrans
|
||||
// x = Aᵀ * x if trans = blas.Trans
|
||||
// x = Aᴴ * x if trans = blas.ConjTrans
|
||||
//
|
||||
// where x is an n element vector and A is an n×n triangular band matrix, with
|
||||
// (k+1) diagonals.
|
||||
//
|
||||
@@ -1791,9 +1815,11 @@ func (Implementation) Ctbmv(uplo blas.Uplo, trans blas.Transpose, diag blas.Diag
|
||||
}
|
||||
|
||||
// Ctbsv solves one of the systems of equations
|
||||
// A * x = b if trans == blas.NoTrans
|
||||
// Aᵀ * x = b if trans == blas.Trans
|
||||
// Aᴴ * x = b if trans == blas.ConjTrans
|
||||
//
|
||||
// A * x = b if trans == blas.NoTrans
|
||||
// Aᵀ * x = b if trans == blas.Trans
|
||||
// Aᴴ * x = b if trans == blas.ConjTrans
|
||||
//
|
||||
// where b and x are n element vectors and A is an n×n triangular band matrix
|
||||
// with (k+1) diagonals.
|
||||
//
|
||||
@@ -2035,9 +2061,11 @@ func (Implementation) Ctbsv(uplo blas.Uplo, trans blas.Transpose, diag blas.Diag
|
||||
}
|
||||
|
||||
// Ctpmv performs one of the matrix-vector operations
|
||||
// x = A * x if trans = blas.NoTrans
|
||||
// x = Aᵀ * x if trans = blas.Trans
|
||||
// x = Aᴴ * x if trans = blas.ConjTrans
|
||||
//
|
||||
// x = A * x if trans = blas.NoTrans
|
||||
// x = Aᵀ * x if trans = blas.Trans
|
||||
// x = Aᴴ * x if trans = blas.ConjTrans
|
||||
//
|
||||
// where x is an n element vector and A is an n×n triangular matrix, supplied in
|
||||
// packed form.
|
||||
//
|
||||
@@ -2275,9 +2303,11 @@ func (Implementation) Ctpmv(uplo blas.Uplo, trans blas.Transpose, diag blas.Diag
|
||||
}
|
||||
|
||||
// Ctpsv solves one of the systems of equations
|
||||
// A * x = b if trans == blas.NoTrans
|
||||
// Aᵀ * x = b if trans == blas.Trans
|
||||
// Aᴴ * x = b if trans == blas.ConjTrans
|
||||
//
|
||||
// A * x = b if trans == blas.NoTrans
|
||||
// Aᵀ * x = b if trans == blas.Trans
|
||||
// Aᴴ * x = b if trans == blas.ConjTrans
|
||||
//
|
||||
// where b and x are n element vectors and A is an n×n triangular matrix in
|
||||
// packed form.
|
||||
//
|
||||
@@ -2513,9 +2543,11 @@ func (Implementation) Ctpsv(uplo blas.Uplo, trans blas.Transpose, diag blas.Diag
|
||||
}
|
||||
|
||||
// Ctrmv performs one of the matrix-vector operations
|
||||
// x = A * x if trans = blas.NoTrans
|
||||
// x = Aᵀ * x if trans = blas.Trans
|
||||
// x = Aᴴ * x if trans = blas.ConjTrans
|
||||
//
|
||||
// x = A * x if trans = blas.NoTrans
|
||||
// x = Aᵀ * x if trans = blas.Trans
|
||||
// x = Aᴴ * x if trans = blas.ConjTrans
|
||||
//
|
||||
// where x is a vector, and A is an n×n triangular matrix.
|
||||
//
|
||||
// Complex64 implementations are autogenerated and not directly tested.
|
||||
@@ -2723,9 +2755,11 @@ func (Implementation) Ctrmv(uplo blas.Uplo, trans blas.Transpose, diag blas.Diag
|
||||
}
|
||||
|
||||
// Ctrsv solves one of the systems of equations
|
||||
// A * x = b if trans == blas.NoTrans
|
||||
// Aᵀ * x = b if trans == blas.Trans
|
||||
// Aᴴ * x = b if trans == blas.ConjTrans
|
||||
//
|
||||
// A * x = b if trans == blas.NoTrans
|
||||
// Aᵀ * x = b if trans == blas.Trans
|
||||
// Aᴴ * x = b if trans == blas.ConjTrans
|
||||
//
|
||||
// where b and x are n element vectors and A is an n×n triangular matrix.
|
||||
//
|
||||
// On entry, x contains the values of b, and the solution is
|
||||
|
@@ -14,7 +14,9 @@ import (
|
||||
var _ blas.Float32Level2 = Implementation{}
|
||||
|
||||
// Sger performs the rank-one operation
|
||||
// A += alpha * x * yᵀ
|
||||
//
|
||||
// A += alpha * x * yᵀ
|
||||
//
|
||||
// where A is an m×n dense matrix, x and y are vectors, and alpha is a scalar.
|
||||
//
|
||||
// Float32 implementations are autogenerated and not directly tested.
|
||||
@@ -63,8 +65,10 @@ func (Implementation) Sger(m, n int, alpha float32, x []float32, incX int, y []f
|
||||
}
|
||||
|
||||
// Sgbmv performs one of the matrix-vector operations
|
||||
// y = alpha * A * x + beta * y if tA == blas.NoTrans
|
||||
// y = alpha * Aᵀ * x + beta * y if tA == blas.Trans or blas.ConjTrans
|
||||
//
|
||||
// y = alpha * A * x + beta * y if tA == blas.NoTrans
|
||||
// y = alpha * Aᵀ * x + beta * y if tA == blas.Trans or blas.ConjTrans
|
||||
//
|
||||
// where A is an m×n band matrix with kL sub-diagonals and kU super-diagonals,
|
||||
// x and y are vectors, and alpha and beta are scalars.
|
||||
//
|
||||
@@ -230,8 +234,10 @@ func (Implementation) Sgbmv(tA blas.Transpose, m, n, kL, kU int, alpha float32,
|
||||
}
|
||||
|
||||
// Sgemv computes
|
||||
// y = alpha * A * x + beta * y if tA = blas.NoTrans
|
||||
// y = alpha * Aᵀ * x + beta * y if tA = blas.Trans or blas.ConjTrans
|
||||
//
|
||||
// y = alpha * A * x + beta * y if tA = blas.NoTrans
|
||||
// y = alpha * Aᵀ * x + beta * y if tA = blas.Trans or blas.ConjTrans
|
||||
//
|
||||
// where A is an m×n dense matrix, x and y are vectors, and alpha and beta are scalars.
|
||||
//
|
||||
// Float32 implementations are autogenerated and not directly tested.
|
||||
@@ -302,8 +308,10 @@ func (Implementation) Sgemv(tA blas.Transpose, m, n int, alpha float32, a []floa
|
||||
}
|
||||
|
||||
// Strmv performs one of the matrix-vector operations
|
||||
// x = A * x if tA == blas.NoTrans
|
||||
// x = Aᵀ * x if tA == blas.Trans or blas.ConjTrans
|
||||
//
|
||||
// x = A * x if tA == blas.NoTrans
|
||||
// x = Aᵀ * x if tA == blas.Trans or blas.ConjTrans
|
||||
//
|
||||
// where A is an n×n triangular matrix, and x is a vector.
|
||||
//
|
||||
// Float32 implementations are autogenerated and not directly tested.
|
||||
@@ -456,8 +464,10 @@ func (Implementation) Strmv(ul blas.Uplo, tA blas.Transpose, d blas.Diag, n int,
|
||||
}
|
||||
|
||||
// Strsv solves one of the systems of equations
|
||||
// A * x = b if tA == blas.NoTrans
|
||||
// Aᵀ * x = b if tA == blas.Trans or blas.ConjTrans
|
||||
//
|
||||
// A * x = b if tA == blas.NoTrans
|
||||
// Aᵀ * x = b if tA == blas.Trans or blas.ConjTrans
|
||||
//
|
||||
// where A is an n×n triangular matrix, and x and b are vectors.
|
||||
//
|
||||
// At entry to the function, x contains the values of b, and the result is
|
||||
@@ -639,7 +649,9 @@ func (Implementation) Strsv(ul blas.Uplo, tA blas.Transpose, d blas.Diag, n int,
|
||||
}
|
||||
|
||||
// Ssymv performs the matrix-vector operation
|
||||
// y = alpha * A * x + beta * y
|
||||
//
|
||||
// y = alpha * A * x + beta * y
|
||||
//
|
||||
// where A is an n×n symmetric matrix, x and y are vectors, and alpha and
|
||||
// beta are scalars.
|
||||
//
|
||||
@@ -809,8 +821,10 @@ func (Implementation) Ssymv(ul blas.Uplo, n int, alpha float32, a []float32, lda
|
||||
}
|
||||
|
||||
// Stbmv performs one of the matrix-vector operations
|
||||
// x = A * x if tA == blas.NoTrans
|
||||
// x = Aᵀ * x if tA == blas.Trans or blas.ConjTrans
|
||||
//
|
||||
// x = A * x if tA == blas.NoTrans
|
||||
// x = Aᵀ * x if tA == blas.Trans or blas.ConjTrans
|
||||
//
|
||||
// where A is an n×n triangular band matrix with k+1 diagonals, and x is a vector.
|
||||
//
|
||||
// Float32 implementations are autogenerated and not directly tested.
|
||||
@@ -1020,8 +1034,10 @@ func (Implementation) Stbmv(ul blas.Uplo, tA blas.Transpose, d blas.Diag, n, k i
|
||||
}
|
||||
|
||||
// Stpmv performs one of the matrix-vector operations
|
||||
// x = A * x if tA == blas.NoTrans
|
||||
// x = Aᵀ * x if tA == blas.Trans or blas.ConjTrans
|
||||
//
|
||||
// x = A * x if tA == blas.NoTrans
|
||||
// x = Aᵀ * x if tA == blas.Trans or blas.ConjTrans
|
||||
//
|
||||
// where A is an n×n triangular matrix in packed format, and x is a vector.
|
||||
//
|
||||
// Float32 implementations are autogenerated and not directly tested.
|
||||
@@ -1201,8 +1217,10 @@ func (Implementation) Stpmv(ul blas.Uplo, tA blas.Transpose, d blas.Diag, n int,
|
||||
}
|
||||
|
||||
// Stbsv solves one of the systems of equations
|
||||
// A * x = b if tA == blas.NoTrans
|
||||
// Aᵀ * x = b if tA == blas.Trans or tA == blas.ConjTrans
|
||||
//
|
||||
// A * x = b if tA == blas.NoTrans
|
||||
// Aᵀ * x = b if tA == blas.Trans or tA == blas.ConjTrans
|
||||
//
|
||||
// where A is an n×n triangular band matrix with k+1 diagonals,
|
||||
// and x and b are vectors.
|
||||
//
|
||||
@@ -1425,7 +1443,9 @@ func (Implementation) Stbsv(ul blas.Uplo, tA blas.Transpose, d blas.Diag, n, k i
|
||||
}
|
||||
|
||||
// Ssbmv performs the matrix-vector operation
|
||||
// y = alpha * A * x + beta * y
|
||||
//
|
||||
// y = alpha * A * x + beta * y
|
||||
//
|
||||
// where A is an n×n symmetric band matrix with k super-diagonals, x and y are
|
||||
// vectors, and alpha and beta are scalars.
|
||||
//
|
||||
@@ -1597,7 +1617,9 @@ func (Implementation) Ssbmv(ul blas.Uplo, n, k int, alpha float32, a []float32,
|
||||
}
|
||||
|
||||
// Ssyr performs the symmetric rank-one update
|
||||
// A += alpha * x * xᵀ
|
||||
//
|
||||
// A += alpha * x * xᵀ
|
||||
//
|
||||
// where A is an n×n symmetric matrix, and x is a vector.
|
||||
//
|
||||
// Float32 implementations are autogenerated and not directly tested.
|
||||
@@ -1697,7 +1719,9 @@ func (Implementation) Ssyr(ul blas.Uplo, n int, alpha float32, x []float32, incX
|
||||
}
|
||||
|
||||
// Ssyr2 performs the symmetric rank-two update
|
||||
// A += alpha * x * yᵀ + alpha * y * xᵀ
|
||||
//
|
||||
// A += alpha * x * yᵀ + alpha * y * xᵀ
|
||||
//
|
||||
// where A is an n×n symmetric matrix, x and y are vectors, and alpha is a scalar.
|
||||
//
|
||||
// Float32 implementations are autogenerated and not directly tested.
|
||||
@@ -1806,8 +1830,10 @@ func (Implementation) Ssyr2(ul blas.Uplo, n int, alpha float32, x []float32, inc
|
||||
}
|
||||
|
||||
// Stpsv solves one of the systems of equations
|
||||
// A * x = b if tA == blas.NoTrans
|
||||
// Aᵀ * x = b if tA == blas.Trans or blas.ConjTrans
|
||||
//
|
||||
// A * x = b if tA == blas.NoTrans
|
||||
// Aᵀ * x = b if tA == blas.Trans or blas.ConjTrans
|
||||
//
|
||||
// where A is an n×n triangular matrix in packed format, and x and b are vectors.
|
||||
//
|
||||
// At entry to the function, x contains the values of b, and the result is
|
||||
@@ -1992,7 +2018,9 @@ func (Implementation) Stpsv(ul blas.Uplo, tA blas.Transpose, d blas.Diag, n int,
|
||||
}
|
||||
|
||||
// Sspmv performs the matrix-vector operation
|
||||
// y = alpha * A * x + beta * y
|
||||
//
|
||||
// y = alpha * A * x + beta * y
|
||||
//
|
||||
// where A is an n×n symmetric matrix in packed format, x and y are vectors,
|
||||
// and alpha and beta are scalars.
|
||||
//
|
||||
@@ -2161,7 +2189,9 @@ func (Implementation) Sspmv(ul blas.Uplo, n int, alpha float32, ap []float32, x
|
||||
}
|
||||
|
||||
// Sspr performs the symmetric rank-one operation
|
||||
// A += alpha * x * xᵀ
|
||||
//
|
||||
// A += alpha * x * xᵀ
|
||||
//
|
||||
// where A is an n×n symmetric matrix in packed format, x is a vector, and
|
||||
// alpha is a scalar.
|
||||
//
|
||||
@@ -2255,7 +2285,9 @@ func (Implementation) Sspr(ul blas.Uplo, n int, alpha float32, x []float32, incX
|
||||
}
|
||||
|
||||
// Sspr2 performs the symmetric rank-2 update
|
||||
// A += alpha * x * yᵀ + alpha * y * xᵀ
|
||||
//
|
||||
// A += alpha * x * yᵀ + alpha * y * xᵀ
|
||||
//
|
||||
// where A is an n×n symmetric matrix in packed format, x and y are vectors,
|
||||
// and alpha is a scalar.
|
||||
//
|
||||
|
@@ -12,7 +12,9 @@ import (
|
||||
var _ blas.Float64Level2 = Implementation{}
|
||||
|
||||
// Dger performs the rank-one operation
|
||||
// A += alpha * x * yᵀ
|
||||
//
|
||||
// A += alpha * x * yᵀ
|
||||
//
|
||||
// where A is an m×n dense matrix, x and y are vectors, and alpha is a scalar.
|
||||
func (Implementation) Dger(m, n int, alpha float64, x []float64, incX int, y []float64, incY int, a []float64, lda int) {
|
||||
if m < 0 {
|
||||
@@ -59,8 +61,10 @@ func (Implementation) Dger(m, n int, alpha float64, x []float64, incX int, y []f
|
||||
}
|
||||
|
||||
// Dgbmv performs one of the matrix-vector operations
|
||||
// y = alpha * A * x + beta * y if tA == blas.NoTrans
|
||||
// y = alpha * Aᵀ * x + beta * y if tA == blas.Trans or blas.ConjTrans
|
||||
//
|
||||
// y = alpha * A * x + beta * y if tA == blas.NoTrans
|
||||
// y = alpha * Aᵀ * x + beta * y if tA == blas.Trans or blas.ConjTrans
|
||||
//
|
||||
// where A is an m×n band matrix with kL sub-diagonals and kU super-diagonals,
|
||||
// x and y are vectors, and alpha and beta are scalars.
|
||||
func (Implementation) Dgbmv(tA blas.Transpose, m, n, kL, kU int, alpha float64, a []float64, lda int, x []float64, incX int, beta float64, y []float64, incY int) {
|
||||
@@ -224,8 +228,10 @@ func (Implementation) Dgbmv(tA blas.Transpose, m, n, kL, kU int, alpha float64,
|
||||
}
|
||||
|
||||
// Dgemv computes
|
||||
// y = alpha * A * x + beta * y if tA = blas.NoTrans
|
||||
// y = alpha * Aᵀ * x + beta * y if tA = blas.Trans or blas.ConjTrans
|
||||
//
|
||||
// y = alpha * A * x + beta * y if tA = blas.NoTrans
|
||||
// y = alpha * Aᵀ * x + beta * y if tA = blas.Trans or blas.ConjTrans
|
||||
//
|
||||
// where A is an m×n dense matrix, x and y are vectors, and alpha and beta are scalars.
|
||||
func (Implementation) Dgemv(tA blas.Transpose, m, n int, alpha float64, a []float64, lda int, x []float64, incX int, beta float64, y []float64, incY int) {
|
||||
if tA != blas.NoTrans && tA != blas.Trans && tA != blas.ConjTrans {
|
||||
@@ -294,8 +300,10 @@ func (Implementation) Dgemv(tA blas.Transpose, m, n int, alpha float64, a []floa
|
||||
}
|
||||
|
||||
// Dtrmv performs one of the matrix-vector operations
|
||||
// x = A * x if tA == blas.NoTrans
|
||||
// x = Aᵀ * x if tA == blas.Trans or blas.ConjTrans
|
||||
//
|
||||
// x = A * x if tA == blas.NoTrans
|
||||
// x = Aᵀ * x if tA == blas.Trans or blas.ConjTrans
|
||||
//
|
||||
// where A is an n×n triangular matrix, and x is a vector.
|
||||
func (Implementation) Dtrmv(ul blas.Uplo, tA blas.Transpose, d blas.Diag, n int, a []float64, lda int, x []float64, incX int) {
|
||||
if ul != blas.Lower && ul != blas.Upper {
|
||||
@@ -446,8 +454,10 @@ func (Implementation) Dtrmv(ul blas.Uplo, tA blas.Transpose, d blas.Diag, n int,
|
||||
}
|
||||
|
||||
// Dtrsv solves one of the systems of equations
|
||||
// A * x = b if tA == blas.NoTrans
|
||||
// Aᵀ * x = b if tA == blas.Trans or blas.ConjTrans
|
||||
//
|
||||
// A * x = b if tA == blas.NoTrans
|
||||
// Aᵀ * x = b if tA == blas.Trans or blas.ConjTrans
|
||||
//
|
||||
// where A is an n×n triangular matrix, and x and b are vectors.
|
||||
//
|
||||
// At entry to the function, x contains the values of b, and the result is
|
||||
@@ -627,7 +637,9 @@ func (Implementation) Dtrsv(ul blas.Uplo, tA blas.Transpose, d blas.Diag, n int,
|
||||
}
|
||||
|
||||
// Dsymv performs the matrix-vector operation
|
||||
// y = alpha * A * x + beta * y
|
||||
//
|
||||
// y = alpha * A * x + beta * y
|
||||
//
|
||||
// where A is an n×n symmetric matrix, x and y are vectors, and alpha and
|
||||
// beta are scalars.
|
||||
func (Implementation) Dsymv(ul blas.Uplo, n int, alpha float64, a []float64, lda int, x []float64, incX int, beta float64, y []float64, incY int) {
|
||||
@@ -795,8 +807,10 @@ func (Implementation) Dsymv(ul blas.Uplo, n int, alpha float64, a []float64, lda
|
||||
}
|
||||
|
||||
// Dtbmv performs one of the matrix-vector operations
|
||||
// x = A * x if tA == blas.NoTrans
|
||||
// x = Aᵀ * x if tA == blas.Trans or blas.ConjTrans
|
||||
//
|
||||
// x = A * x if tA == blas.NoTrans
|
||||
// x = Aᵀ * x if tA == blas.Trans or blas.ConjTrans
|
||||
//
|
||||
// where A is an n×n triangular band matrix with k+1 diagonals, and x is a vector.
|
||||
func (Implementation) Dtbmv(ul blas.Uplo, tA blas.Transpose, d blas.Diag, n, k int, a []float64, lda int, x []float64, incX int) {
|
||||
if ul != blas.Lower && ul != blas.Upper {
|
||||
@@ -1004,8 +1018,10 @@ func (Implementation) Dtbmv(ul blas.Uplo, tA blas.Transpose, d blas.Diag, n, k i
|
||||
}
|
||||
|
||||
// Dtpmv performs one of the matrix-vector operations
|
||||
// x = A * x if tA == blas.NoTrans
|
||||
// x = Aᵀ * x if tA == blas.Trans or blas.ConjTrans
|
||||
//
|
||||
// x = A * x if tA == blas.NoTrans
|
||||
// x = Aᵀ * x if tA == blas.Trans or blas.ConjTrans
|
||||
//
|
||||
// where A is an n×n triangular matrix in packed format, and x is a vector.
|
||||
func (Implementation) Dtpmv(ul blas.Uplo, tA blas.Transpose, d blas.Diag, n int, ap []float64, x []float64, incX int) {
|
||||
if ul != blas.Lower && ul != blas.Upper {
|
||||
@@ -1183,8 +1199,10 @@ func (Implementation) Dtpmv(ul blas.Uplo, tA blas.Transpose, d blas.Diag, n int,
|
||||
}
|
||||
|
||||
// Dtbsv solves one of the systems of equations
|
||||
// A * x = b if tA == blas.NoTrans
|
||||
// Aᵀ * x = b if tA == blas.Trans or tA == blas.ConjTrans
|
||||
//
|
||||
// A * x = b if tA == blas.NoTrans
|
||||
// Aᵀ * x = b if tA == blas.Trans or tA == blas.ConjTrans
|
||||
//
|
||||
// where A is an n×n triangular band matrix with k+1 diagonals,
|
||||
// and x and b are vectors.
|
||||
//
|
||||
@@ -1405,7 +1423,9 @@ func (Implementation) Dtbsv(ul blas.Uplo, tA blas.Transpose, d blas.Diag, n, k i
|
||||
}
|
||||
|
||||
// Dsbmv performs the matrix-vector operation
|
||||
// y = alpha * A * x + beta * y
|
||||
//
|
||||
// y = alpha * A * x + beta * y
|
||||
//
|
||||
// where A is an n×n symmetric band matrix with k super-diagonals, x and y are
|
||||
// vectors, and alpha and beta are scalars.
|
||||
func (Implementation) Dsbmv(ul blas.Uplo, n, k int, alpha float64, a []float64, lda int, x []float64, incX int, beta float64, y []float64, incY int) {
|
||||
@@ -1575,7 +1595,9 @@ func (Implementation) Dsbmv(ul blas.Uplo, n, k int, alpha float64, a []float64,
|
||||
}
|
||||
|
||||
// Dsyr performs the symmetric rank-one update
|
||||
// A += alpha * x * xᵀ
|
||||
//
|
||||
// A += alpha * x * xᵀ
|
||||
//
|
||||
// where A is an n×n symmetric matrix, and x is a vector.
|
||||
func (Implementation) Dsyr(ul blas.Uplo, n int, alpha float64, x []float64, incX int, a []float64, lda int) {
|
||||
if ul != blas.Lower && ul != blas.Upper {
|
||||
@@ -1673,7 +1695,9 @@ func (Implementation) Dsyr(ul blas.Uplo, n int, alpha float64, x []float64, incX
|
||||
}
|
||||
|
||||
// Dsyr2 performs the symmetric rank-two update
|
||||
// A += alpha * x * yᵀ + alpha * y * xᵀ
|
||||
//
|
||||
// A += alpha * x * yᵀ + alpha * y * xᵀ
|
||||
//
|
||||
// where A is an n×n symmetric matrix, x and y are vectors, and alpha is a scalar.
|
||||
func (Implementation) Dsyr2(ul blas.Uplo, n int, alpha float64, x []float64, incX int, y []float64, incY int, a []float64, lda int) {
|
||||
if ul != blas.Lower && ul != blas.Upper {
|
||||
@@ -1780,8 +1804,10 @@ func (Implementation) Dsyr2(ul blas.Uplo, n int, alpha float64, x []float64, inc
|
||||
}
|
||||
|
||||
// Dtpsv solves one of the systems of equations
|
||||
// A * x = b if tA == blas.NoTrans
|
||||
// Aᵀ * x = b if tA == blas.Trans or blas.ConjTrans
|
||||
//
|
||||
// A * x = b if tA == blas.NoTrans
|
||||
// Aᵀ * x = b if tA == blas.Trans or blas.ConjTrans
|
||||
//
|
||||
// where A is an n×n triangular matrix in packed format, and x and b are vectors.
|
||||
//
|
||||
// At entry to the function, x contains the values of b, and the result is
|
||||
@@ -1964,7 +1990,9 @@ func (Implementation) Dtpsv(ul blas.Uplo, tA blas.Transpose, d blas.Diag, n int,
|
||||
}
|
||||
|
||||
// Dspmv performs the matrix-vector operation
|
||||
// y = alpha * A * x + beta * y
|
||||
//
|
||||
// y = alpha * A * x + beta * y
|
||||
//
|
||||
// where A is an n×n symmetric matrix in packed format, x and y are vectors,
|
||||
// and alpha and beta are scalars.
|
||||
func (Implementation) Dspmv(ul blas.Uplo, n int, alpha float64, ap []float64, x []float64, incX int, beta float64, y []float64, incY int) {
|
||||
@@ -2131,7 +2159,9 @@ func (Implementation) Dspmv(ul blas.Uplo, n int, alpha float64, ap []float64, x
|
||||
}
|
||||
|
||||
// Dspr performs the symmetric rank-one operation
|
||||
// A += alpha * x * xᵀ
|
||||
//
|
||||
// A += alpha * x * xᵀ
|
||||
//
|
||||
// where A is an n×n symmetric matrix in packed format, x is a vector, and
|
||||
// alpha is a scalar.
|
||||
func (Implementation) Dspr(ul blas.Uplo, n int, alpha float64, x []float64, incX int, ap []float64) {
|
||||
@@ -2223,7 +2253,9 @@ func (Implementation) Dspr(ul blas.Uplo, n int, alpha float64, x []float64, incX
|
||||
}
|
||||
|
||||
// Dspr2 performs the symmetric rank-2 update
|
||||
// A += alpha * x * yᵀ + alpha * y * xᵀ
|
||||
//
|
||||
// A += alpha * x * yᵀ + alpha * y * xᵀ
|
||||
//
|
||||
// where A is an n×n symmetric matrix in packed format, x and y are vectors,
|
||||
// and alpha is a scalar.
|
||||
func (Implementation) Dspr2(ul blas.Uplo, n int, alpha float64, x []float64, incX int, y []float64, incY int, ap []float64) {
|
||||
|
@@ -14,9 +14,13 @@ import (
|
||||
var _ blas.Complex128Level3 = Implementation{}
|
||||
|
||||
// Zgemm performs one of the matrix-matrix operations
|
||||
// C = alpha * op(A) * op(B) + beta * C
|
||||
//
|
||||
// C = alpha * op(A) * op(B) + beta * C
|
||||
//
|
||||
// where op(X) is one of
|
||||
// op(X) = X or op(X) = Xᵀ or op(X) = Xᴴ,
|
||||
//
|
||||
// op(X) = X or op(X) = Xᵀ or op(X) = Xᴴ,
|
||||
//
|
||||
// alpha and beta are scalars, and A, B and C are matrices, with op(A) an m×k matrix,
|
||||
// op(B) a k×n matrix and C an m×n matrix.
|
||||
func (Implementation) Zgemm(tA, tB blas.Transpose, m, n, k int, alpha complex128, a []complex128, lda int, b []complex128, ldb int, beta complex128, c []complex128, ldc int) {
|
||||
@@ -258,8 +262,10 @@ func (Implementation) Zgemm(tA, tB blas.Transpose, m, n, k int, alpha complex128
|
||||
}
|
||||
|
||||
// Zhemm performs one of the matrix-matrix operations
|
||||
// C = alpha*A*B + beta*C if side == blas.Left
|
||||
// C = alpha*B*A + beta*C if side == blas.Right
|
||||
//
|
||||
// C = alpha*A*B + beta*C if side == blas.Left
|
||||
// C = alpha*B*A + beta*C if side == blas.Right
|
||||
//
|
||||
// where alpha and beta are scalars, A is an m×m or n×n hermitian matrix and B
|
||||
// and C are m×n matrices. The imaginary parts of the diagonal elements of A are
|
||||
// assumed to be zero.
|
||||
@@ -405,8 +411,10 @@ func (Implementation) Zhemm(side blas.Side, uplo blas.Uplo, m, n int, alpha comp
|
||||
}
|
||||
|
||||
// Zherk performs one of the hermitian rank-k operations
|
||||
// C = alpha*A*Aᴴ + beta*C if trans == blas.NoTrans
|
||||
// C = alpha*Aᴴ*A + beta*C if trans == blas.ConjTrans
|
||||
//
|
||||
// C = alpha*A*Aᴴ + beta*C if trans == blas.NoTrans
|
||||
// C = alpha*Aᴴ*A + beta*C if trans == blas.ConjTrans
|
||||
//
|
||||
// where alpha and beta are real scalars, C is an n×n hermitian matrix and A is
|
||||
// an n×k matrix in the first case and a k×n matrix in the second case.
|
||||
//
|
||||
@@ -603,8 +611,10 @@ func (Implementation) Zherk(uplo blas.Uplo, trans blas.Transpose, n, k int, alph
|
||||
}
|
||||
|
||||
// Zher2k performs one of the hermitian rank-2k operations
|
||||
// C = alpha*A*Bᴴ + conj(alpha)*B*Aᴴ + beta*C if trans == blas.NoTrans
|
||||
// C = alpha*Aᴴ*B + conj(alpha)*Bᴴ*A + beta*C if trans == blas.ConjTrans
|
||||
//
|
||||
// C = alpha*A*Bᴴ + conj(alpha)*B*Aᴴ + beta*C if trans == blas.NoTrans
|
||||
// C = alpha*Aᴴ*B + conj(alpha)*Bᴴ*A + beta*C if trans == blas.ConjTrans
|
||||
//
|
||||
// where alpha and beta are scalars with beta real, C is an n×n hermitian matrix
|
||||
// and A and B are n×k matrices in the first case and k×n matrices in the second case.
|
||||
//
|
||||
@@ -799,8 +809,10 @@ func (Implementation) Zher2k(uplo blas.Uplo, trans blas.Transpose, n, k int, alp
|
||||
}
|
||||
|
||||
// Zsymm performs one of the matrix-matrix operations
|
||||
// C = alpha*A*B + beta*C if side == blas.Left
|
||||
// C = alpha*B*A + beta*C if side == blas.Right
|
||||
//
|
||||
// C = alpha*A*B + beta*C if side == blas.Left
|
||||
// C = alpha*B*A + beta*C if side == blas.Right
|
||||
//
|
||||
// where alpha and beta are scalars, A is an m×m or n×n symmetric matrix and B
|
||||
// and C are m×n matrices.
|
||||
func (Implementation) Zsymm(side blas.Side, uplo blas.Uplo, m, n int, alpha complex128, a []complex128, lda int, b []complex128, ldb int, beta complex128, c []complex128, ldc int) {
|
||||
@@ -943,8 +955,10 @@ func (Implementation) Zsymm(side blas.Side, uplo blas.Uplo, m, n int, alpha comp
|
||||
}
|
||||
|
||||
// Zsyrk performs one of the symmetric rank-k operations
|
||||
// C = alpha*A*Aᵀ + beta*C if trans == blas.NoTrans
|
||||
// C = alpha*Aᵀ*A + beta*C if trans == blas.Trans
|
||||
//
|
||||
// C = alpha*A*Aᵀ + beta*C if trans == blas.NoTrans
|
||||
// C = alpha*Aᵀ*A + beta*C if trans == blas.Trans
|
||||
//
|
||||
// where alpha and beta are scalars, C is an n×n symmetric matrix and A is
|
||||
// an n×k matrix in the first case and a k×n matrix in the second case.
|
||||
func (Implementation) Zsyrk(uplo blas.Uplo, trans blas.Transpose, n, k int, alpha complex128, a []complex128, lda int, beta complex128, c []complex128, ldc int) {
|
||||
@@ -1101,8 +1115,10 @@ func (Implementation) Zsyrk(uplo blas.Uplo, trans blas.Transpose, n, k int, alph
|
||||
}
|
||||
|
||||
// Zsyr2k performs one of the symmetric rank-2k operations
|
||||
// C = alpha*A*Bᵀ + alpha*B*Aᵀ + beta*C if trans == blas.NoTrans
|
||||
// C = alpha*Aᵀ*B + alpha*Bᵀ*A + beta*C if trans == blas.Trans
|
||||
//
|
||||
// C = alpha*A*Bᵀ + alpha*B*Aᵀ + beta*C if trans == blas.NoTrans
|
||||
// C = alpha*Aᵀ*B + alpha*Bᵀ*A + beta*C if trans == blas.Trans
|
||||
//
|
||||
// where alpha and beta are scalars, C is an n×n symmetric matrix and A and B
|
||||
// are n×k matrices in the first case and k×n matrices in the second case.
|
||||
func (Implementation) Zsyr2k(uplo blas.Uplo, trans blas.Transpose, n, k int, alpha complex128, a []complex128, lda int, b []complex128, ldb int, beta complex128, c []complex128, ldc int) {
|
||||
@@ -1274,13 +1290,16 @@ func (Implementation) Zsyr2k(uplo blas.Uplo, trans blas.Transpose, n, k int, alp
|
||||
}
|
||||
|
||||
// Ztrmm performs one of the matrix-matrix operations
|
||||
// B = alpha * op(A) * B if side == blas.Left,
|
||||
// B = alpha * B * op(A) if side == blas.Right,
|
||||
//
|
||||
// B = alpha * op(A) * B if side == blas.Left,
|
||||
// B = alpha * B * op(A) if side == blas.Right,
|
||||
//
|
||||
// where alpha is a scalar, B is an m×n matrix, A is a unit, or non-unit,
|
||||
// upper or lower triangular matrix and op(A) is one of
|
||||
// op(A) = A if trans == blas.NoTrans,
|
||||
// op(A) = Aᵀ if trans == blas.Trans,
|
||||
// op(A) = Aᴴ if trans == blas.ConjTrans.
|
||||
//
|
||||
// op(A) = A if trans == blas.NoTrans,
|
||||
// op(A) = Aᵀ if trans == blas.Trans,
|
||||
// op(A) = Aᴴ if trans == blas.ConjTrans.
|
||||
func (Implementation) Ztrmm(side blas.Side, uplo blas.Uplo, trans blas.Transpose, diag blas.Diag, m, n int, alpha complex128, a []complex128, lda int, b []complex128, ldb int) {
|
||||
na := m
|
||||
if side == blas.Right {
|
||||
@@ -1502,13 +1521,17 @@ func (Implementation) Ztrmm(side blas.Side, uplo blas.Uplo, trans blas.Transpose
|
||||
}
|
||||
|
||||
// Ztrsm solves one of the matrix equations
|
||||
// op(A) * X = alpha * B if side == blas.Left,
|
||||
// X * op(A) = alpha * B if side == blas.Right,
|
||||
//
|
||||
// op(A) * X = alpha * B if side == blas.Left,
|
||||
// X * op(A) = alpha * B if side == blas.Right,
|
||||
//
|
||||
// where alpha is a scalar, X and B are m×n matrices, A is a unit or
|
||||
// non-unit, upper or lower triangular matrix and op(A) is one of
|
||||
// op(A) = A if transA == blas.NoTrans,
|
||||
// op(A) = Aᵀ if transA == blas.Trans,
|
||||
// op(A) = Aᴴ if transA == blas.ConjTrans.
|
||||
//
|
||||
// op(A) = A if transA == blas.NoTrans,
|
||||
// op(A) = Aᵀ if transA == blas.Trans,
|
||||
// op(A) = Aᴴ if transA == blas.ConjTrans.
|
||||
//
|
||||
// On return the matrix X is overwritten on B.
|
||||
func (Implementation) Ztrsm(side blas.Side, uplo blas.Uplo, transA blas.Transpose, diag blas.Diag, m, n int, alpha complex128, a []complex128, lda int, b []complex128, ldb int) {
|
||||
na := m
|
||||
|
@@ -16,9 +16,13 @@ import (
|
||||
var _ blas.Complex64Level3 = Implementation{}
|
||||
|
||||
// Cgemm performs one of the matrix-matrix operations
|
||||
// C = alpha * op(A) * op(B) + beta * C
|
||||
//
|
||||
// C = alpha * op(A) * op(B) + beta * C
|
||||
//
|
||||
// where op(X) is one of
|
||||
// op(X) = X or op(X) = Xᵀ or op(X) = Xᴴ,
|
||||
//
|
||||
// op(X) = X or op(X) = Xᵀ or op(X) = Xᴴ,
|
||||
//
|
||||
// alpha and beta are scalars, and A, B and C are matrices, with op(A) an m×k matrix,
|
||||
// op(B) a k×n matrix and C an m×n matrix.
|
||||
//
|
||||
@@ -262,8 +266,10 @@ func (Implementation) Cgemm(tA, tB blas.Transpose, m, n, k int, alpha complex64,
|
||||
}
|
||||
|
||||
// Chemm performs one of the matrix-matrix operations
|
||||
// C = alpha*A*B + beta*C if side == blas.Left
|
||||
// C = alpha*B*A + beta*C if side == blas.Right
|
||||
//
|
||||
// C = alpha*A*B + beta*C if side == blas.Left
|
||||
// C = alpha*B*A + beta*C if side == blas.Right
|
||||
//
|
||||
// where alpha and beta are scalars, A is an m×m or n×n hermitian matrix and B
|
||||
// and C are m×n matrices. The imaginary parts of the diagonal elements of A are
|
||||
// assumed to be zero.
|
||||
@@ -411,8 +417,10 @@ func (Implementation) Chemm(side blas.Side, uplo blas.Uplo, m, n int, alpha comp
|
||||
}
|
||||
|
||||
// Cherk performs one of the hermitian rank-k operations
|
||||
// C = alpha*A*Aᴴ + beta*C if trans == blas.NoTrans
|
||||
// C = alpha*Aᴴ*A + beta*C if trans == blas.ConjTrans
|
||||
//
|
||||
// C = alpha*A*Aᴴ + beta*C if trans == blas.NoTrans
|
||||
// C = alpha*Aᴴ*A + beta*C if trans == blas.ConjTrans
|
||||
//
|
||||
// where alpha and beta are real scalars, C is an n×n hermitian matrix and A is
|
||||
// an n×k matrix in the first case and a k×n matrix in the second case.
|
||||
//
|
||||
@@ -611,8 +619,10 @@ func (Implementation) Cherk(uplo blas.Uplo, trans blas.Transpose, n, k int, alph
|
||||
}
|
||||
|
||||
// Cher2k performs one of the hermitian rank-2k operations
|
||||
// C = alpha*A*Bᴴ + conj(alpha)*B*Aᴴ + beta*C if trans == blas.NoTrans
|
||||
// C = alpha*Aᴴ*B + conj(alpha)*Bᴴ*A + beta*C if trans == blas.ConjTrans
|
||||
//
|
||||
// C = alpha*A*Bᴴ + conj(alpha)*B*Aᴴ + beta*C if trans == blas.NoTrans
|
||||
// C = alpha*Aᴴ*B + conj(alpha)*Bᴴ*A + beta*C if trans == blas.ConjTrans
|
||||
//
|
||||
// where alpha and beta are scalars with beta real, C is an n×n hermitian matrix
|
||||
// and A and B are n×k matrices in the first case and k×n matrices in the second case.
|
||||
//
|
||||
@@ -809,8 +819,10 @@ func (Implementation) Cher2k(uplo blas.Uplo, trans blas.Transpose, n, k int, alp
|
||||
}
|
||||
|
||||
// Csymm performs one of the matrix-matrix operations
|
||||
// C = alpha*A*B + beta*C if side == blas.Left
|
||||
// C = alpha*B*A + beta*C if side == blas.Right
|
||||
//
|
||||
// C = alpha*A*B + beta*C if side == blas.Left
|
||||
// C = alpha*B*A + beta*C if side == blas.Right
|
||||
//
|
||||
// where alpha and beta are scalars, A is an m×m or n×n symmetric matrix and B
|
||||
// and C are m×n matrices.
|
||||
//
|
||||
@@ -955,8 +967,10 @@ func (Implementation) Csymm(side blas.Side, uplo blas.Uplo, m, n int, alpha comp
|
||||
}
|
||||
|
||||
// Csyrk performs one of the symmetric rank-k operations
|
||||
// C = alpha*A*Aᵀ + beta*C if trans == blas.NoTrans
|
||||
// C = alpha*Aᵀ*A + beta*C if trans == blas.Trans
|
||||
//
|
||||
// C = alpha*A*Aᵀ + beta*C if trans == blas.NoTrans
|
||||
// C = alpha*Aᵀ*A + beta*C if trans == blas.Trans
|
||||
//
|
||||
// where alpha and beta are scalars, C is an n×n symmetric matrix and A is
|
||||
// an n×k matrix in the first case and a k×n matrix in the second case.
|
||||
//
|
||||
@@ -1115,8 +1129,10 @@ func (Implementation) Csyrk(uplo blas.Uplo, trans blas.Transpose, n, k int, alph
|
||||
}
|
||||
|
||||
// Csyr2k performs one of the symmetric rank-2k operations
|
||||
// C = alpha*A*Bᵀ + alpha*B*Aᵀ + beta*C if trans == blas.NoTrans
|
||||
// C = alpha*Aᵀ*B + alpha*Bᵀ*A + beta*C if trans == blas.Trans
|
||||
//
|
||||
// C = alpha*A*Bᵀ + alpha*B*Aᵀ + beta*C if trans == blas.NoTrans
|
||||
// C = alpha*Aᵀ*B + alpha*Bᵀ*A + beta*C if trans == blas.Trans
|
||||
//
|
||||
// where alpha and beta are scalars, C is an n×n symmetric matrix and A and B
|
||||
// are n×k matrices in the first case and k×n matrices in the second case.
|
||||
//
|
||||
@@ -1290,13 +1306,16 @@ func (Implementation) Csyr2k(uplo blas.Uplo, trans blas.Transpose, n, k int, alp
|
||||
}
|
||||
|
||||
// Ctrmm performs one of the matrix-matrix operations
|
||||
// B = alpha * op(A) * B if side == blas.Left,
|
||||
// B = alpha * B * op(A) if side == blas.Right,
|
||||
//
|
||||
// B = alpha * op(A) * B if side == blas.Left,
|
||||
// B = alpha * B * op(A) if side == blas.Right,
|
||||
//
|
||||
// where alpha is a scalar, B is an m×n matrix, A is a unit, or non-unit,
|
||||
// upper or lower triangular matrix and op(A) is one of
|
||||
// op(A) = A if trans == blas.NoTrans,
|
||||
// op(A) = Aᵀ if trans == blas.Trans,
|
||||
// op(A) = Aᴴ if trans == blas.ConjTrans.
|
||||
//
|
||||
// op(A) = A if trans == blas.NoTrans,
|
||||
// op(A) = Aᵀ if trans == blas.Trans,
|
||||
// op(A) = Aᴴ if trans == blas.ConjTrans.
|
||||
//
|
||||
// Complex64 implementations are autogenerated and not directly tested.
|
||||
func (Implementation) Ctrmm(side blas.Side, uplo blas.Uplo, trans blas.Transpose, diag blas.Diag, m, n int, alpha complex64, a []complex64, lda int, b []complex64, ldb int) {
|
||||
@@ -1520,13 +1539,17 @@ func (Implementation) Ctrmm(side blas.Side, uplo blas.Uplo, trans blas.Transpose
|
||||
}
|
||||
|
||||
// Ctrsm solves one of the matrix equations
|
||||
// op(A) * X = alpha * B if side == blas.Left,
|
||||
// X * op(A) = alpha * B if side == blas.Right,
|
||||
//
|
||||
// op(A) * X = alpha * B if side == blas.Left,
|
||||
// X * op(A) = alpha * B if side == blas.Right,
|
||||
//
|
||||
// where alpha is a scalar, X and B are m×n matrices, A is a unit or
|
||||
// non-unit, upper or lower triangular matrix and op(A) is one of
|
||||
// op(A) = A if transA == blas.NoTrans,
|
||||
// op(A) = Aᵀ if transA == blas.Trans,
|
||||
// op(A) = Aᴴ if transA == blas.ConjTrans.
|
||||
//
|
||||
// op(A) = A if transA == blas.NoTrans,
|
||||
// op(A) = Aᵀ if transA == blas.Trans,
|
||||
// op(A) = Aᴴ if transA == blas.ConjTrans.
|
||||
//
|
||||
// On return the matrix X is overwritten on B.
|
||||
//
|
||||
// Complex64 implementations are autogenerated and not directly tested.
|
||||
|
@@ -14,10 +14,12 @@ import (
|
||||
var _ blas.Float32Level3 = Implementation{}
|
||||
|
||||
// Strsm solves one of the matrix equations
|
||||
// A * X = alpha * B if tA == blas.NoTrans and side == blas.Left
|
||||
// Aᵀ * X = alpha * B if tA == blas.Trans or blas.ConjTrans, and side == blas.Left
|
||||
// X * A = alpha * B if tA == blas.NoTrans and side == blas.Right
|
||||
// X * Aᵀ = alpha * B if tA == blas.Trans or blas.ConjTrans, and side == blas.Right
|
||||
//
|
||||
// A * X = alpha * B if tA == blas.NoTrans and side == blas.Left
|
||||
// Aᵀ * X = alpha * B if tA == blas.Trans or blas.ConjTrans, and side == blas.Left
|
||||
// X * A = alpha * B if tA == blas.NoTrans and side == blas.Right
|
||||
// X * Aᵀ = alpha * B if tA == blas.Trans or blas.ConjTrans, and side == blas.Right
|
||||
//
|
||||
// where A is an n×n or m×m triangular matrix, X and B are m×n matrices, and alpha is a
|
||||
// scalar.
|
||||
//
|
||||
@@ -219,8 +221,10 @@ func (Implementation) Strsm(s blas.Side, ul blas.Uplo, tA blas.Transpose, d blas
|
||||
}
|
||||
|
||||
// Ssymm performs one of the matrix-matrix operations
|
||||
// C = alpha * A * B + beta * C if side == blas.Left
|
||||
// C = alpha * B * A + beta * C if side == blas.Right
|
||||
//
|
||||
// C = alpha * A * B + beta * C if side == blas.Left
|
||||
// C = alpha * B * A + beta * C if side == blas.Right
|
||||
//
|
||||
// where A is an n×n or m×m symmetric matrix, B and C are m×n matrices, and alpha
|
||||
// is a scalar.
|
||||
//
|
||||
@@ -364,8 +368,10 @@ func (Implementation) Ssymm(s blas.Side, ul blas.Uplo, m, n int, alpha float32,
|
||||
}
|
||||
|
||||
// Ssyrk performs one of the symmetric rank-k operations
|
||||
// C = alpha * A * Aᵀ + beta * C if tA == blas.NoTrans
|
||||
// C = alpha * Aᵀ * A + beta * C if tA == blas.Trans or tA == blas.ConjTrans
|
||||
//
|
||||
// C = alpha * A * Aᵀ + beta * C if tA == blas.NoTrans
|
||||
// C = alpha * Aᵀ * A + beta * C if tA == blas.Trans or tA == blas.ConjTrans
|
||||
//
|
||||
// where A is an n×k or k×n matrix, C is an n×n symmetric matrix, and alpha and
|
||||
// beta are scalars.
|
||||
//
|
||||
@@ -516,8 +522,10 @@ func (Implementation) Ssyrk(ul blas.Uplo, tA blas.Transpose, n, k int, alpha flo
|
||||
}
|
||||
|
||||
// Ssyr2k performs one of the symmetric rank 2k operations
|
||||
// C = alpha * A * Bᵀ + alpha * B * Aᵀ + beta * C if tA == blas.NoTrans
|
||||
// C = alpha * Aᵀ * B + alpha * Bᵀ * A + beta * C if tA == blas.Trans or tA == blas.ConjTrans
|
||||
//
|
||||
// C = alpha * A * Bᵀ + alpha * B * Aᵀ + beta * C if tA == blas.NoTrans
|
||||
// C = alpha * Aᵀ * B + alpha * Bᵀ * A + beta * C if tA == blas.Trans or tA == blas.ConjTrans
|
||||
//
|
||||
// where A and B are n×k or k×n matrices, C is an n×n symmetric matrix, and
|
||||
// alpha and beta are scalars.
|
||||
//
|
||||
@@ -717,10 +725,12 @@ func (Implementation) Ssyr2k(ul blas.Uplo, tA blas.Transpose, n, k int, alpha fl
|
||||
}
|
||||
|
||||
// Strmm performs one of the matrix-matrix operations
|
||||
// B = alpha * A * B if tA == blas.NoTrans and side == blas.Left
|
||||
// B = alpha * Aᵀ * B if tA == blas.Trans or blas.ConjTrans, and side == blas.Left
|
||||
// B = alpha * B * A if tA == blas.NoTrans and side == blas.Right
|
||||
// B = alpha * B * Aᵀ if tA == blas.Trans or blas.ConjTrans, and side == blas.Right
|
||||
//
|
||||
// B = alpha * A * B if tA == blas.NoTrans and side == blas.Left
|
||||
// B = alpha * Aᵀ * B if tA == blas.Trans or blas.ConjTrans, and side == blas.Left
|
||||
// B = alpha * B * A if tA == blas.NoTrans and side == blas.Right
|
||||
// B = alpha * B * Aᵀ if tA == blas.Trans or blas.ConjTrans, and side == blas.Right
|
||||
//
|
||||
// where A is an n×n or m×m triangular matrix, B is an m×n matrix, and alpha is a scalar.
|
||||
//
|
||||
// Float32 implementations are autogenerated and not directly tested.
|
||||
|
@@ -12,10 +12,12 @@ import (
|
||||
var _ blas.Float64Level3 = Implementation{}
|
||||
|
||||
// Dtrsm solves one of the matrix equations
|
||||
// A * X = alpha * B if tA == blas.NoTrans and side == blas.Left
|
||||
// Aᵀ * X = alpha * B if tA == blas.Trans or blas.ConjTrans, and side == blas.Left
|
||||
// X * A = alpha * B if tA == blas.NoTrans and side == blas.Right
|
||||
// X * Aᵀ = alpha * B if tA == blas.Trans or blas.ConjTrans, and side == blas.Right
|
||||
//
|
||||
// A * X = alpha * B if tA == blas.NoTrans and side == blas.Left
|
||||
// Aᵀ * X = alpha * B if tA == blas.Trans or blas.ConjTrans, and side == blas.Left
|
||||
// X * A = alpha * B if tA == blas.NoTrans and side == blas.Right
|
||||
// X * Aᵀ = alpha * B if tA == blas.Trans or blas.ConjTrans, and side == blas.Right
|
||||
//
|
||||
// where A is an n×n or m×m triangular matrix, X and B are m×n matrices, and alpha is a
|
||||
// scalar.
|
||||
//
|
||||
@@ -215,8 +217,10 @@ func (Implementation) Dtrsm(s blas.Side, ul blas.Uplo, tA blas.Transpose, d blas
|
||||
}
|
||||
|
||||
// Dsymm performs one of the matrix-matrix operations
|
||||
// C = alpha * A * B + beta * C if side == blas.Left
|
||||
// C = alpha * B * A + beta * C if side == blas.Right
|
||||
//
|
||||
// C = alpha * A * B + beta * C if side == blas.Left
|
||||
// C = alpha * B * A + beta * C if side == blas.Right
|
||||
//
|
||||
// where A is an n×n or m×m symmetric matrix, B and C are m×n matrices, and alpha
|
||||
// is a scalar.
|
||||
func (Implementation) Dsymm(s blas.Side, ul blas.Uplo, m, n int, alpha float64, a []float64, lda int, b []float64, ldb int, beta float64, c []float64, ldc int) {
|
||||
@@ -358,8 +362,10 @@ func (Implementation) Dsymm(s blas.Side, ul blas.Uplo, m, n int, alpha float64,
|
||||
}
|
||||
|
||||
// Dsyrk performs one of the symmetric rank-k operations
|
||||
// C = alpha * A * Aᵀ + beta * C if tA == blas.NoTrans
|
||||
// C = alpha * Aᵀ * A + beta * C if tA == blas.Trans or tA == blas.ConjTrans
|
||||
//
|
||||
// C = alpha * A * Aᵀ + beta * C if tA == blas.NoTrans
|
||||
// C = alpha * Aᵀ * A + beta * C if tA == blas.Trans or tA == blas.ConjTrans
|
||||
//
|
||||
// where A is an n×k or k×n matrix, C is an n×n symmetric matrix, and alpha and
|
||||
// beta are scalars.
|
||||
func (Implementation) Dsyrk(ul blas.Uplo, tA blas.Transpose, n, k int, alpha float64, a []float64, lda int, beta float64, c []float64, ldc int) {
|
||||
@@ -508,8 +514,10 @@ func (Implementation) Dsyrk(ul blas.Uplo, tA blas.Transpose, n, k int, alpha flo
|
||||
}
|
||||
|
||||
// Dsyr2k performs one of the symmetric rank 2k operations
|
||||
// C = alpha * A * Bᵀ + alpha * B * Aᵀ + beta * C if tA == blas.NoTrans
|
||||
// C = alpha * Aᵀ * B + alpha * Bᵀ * A + beta * C if tA == blas.Trans or tA == blas.ConjTrans
|
||||
//
|
||||
// C = alpha * A * Bᵀ + alpha * B * Aᵀ + beta * C if tA == blas.NoTrans
|
||||
// C = alpha * Aᵀ * B + alpha * Bᵀ * A + beta * C if tA == blas.Trans or tA == blas.ConjTrans
|
||||
//
|
||||
// where A and B are n×k or k×n matrices, C is an n×n symmetric matrix, and
|
||||
// alpha and beta are scalars.
|
||||
func (Implementation) Dsyr2k(ul blas.Uplo, tA blas.Transpose, n, k int, alpha float64, a []float64, lda int, b []float64, ldb int, beta float64, c []float64, ldc int) {
|
||||
@@ -707,10 +715,12 @@ func (Implementation) Dsyr2k(ul blas.Uplo, tA blas.Transpose, n, k int, alpha fl
|
||||
}
|
||||
|
||||
// Dtrmm performs one of the matrix-matrix operations
|
||||
// B = alpha * A * B if tA == blas.NoTrans and side == blas.Left
|
||||
// B = alpha * Aᵀ * B if tA == blas.Trans or blas.ConjTrans, and side == blas.Left
|
||||
// B = alpha * B * A if tA == blas.NoTrans and side == blas.Right
|
||||
// B = alpha * B * Aᵀ if tA == blas.Trans or blas.ConjTrans, and side == blas.Right
|
||||
//
|
||||
// B = alpha * A * B if tA == blas.NoTrans and side == blas.Left
|
||||
// B = alpha * Aᵀ * B if tA == blas.Trans or blas.ConjTrans, and side == blas.Left
|
||||
// B = alpha * B * A if tA == blas.NoTrans and side == blas.Right
|
||||
// B = alpha * B * Aᵀ if tA == blas.Trans or blas.ConjTrans, and side == blas.Right
|
||||
//
|
||||
// where A is an n×n or m×m triangular matrix, B is an m×n matrix, and alpha is a scalar.
|
||||
func (Implementation) Dtrmm(s blas.Side, ul blas.Uplo, tA blas.Transpose, d blas.Diag, m, n int, alpha float64, a []float64, lda int, b []float64, ldb int) {
|
||||
if s != blas.Left && s != blas.Right {
|
||||
|
@@ -15,10 +15,12 @@ import (
|
||||
)
|
||||
|
||||
// Sgemm 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
|
||||
//
|
||||
// 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.
|
||||
|
@@ -546,9 +546,13 @@ func rndComplex128(rnd *rand.Rand) complex128 {
|
||||
}
|
||||
|
||||
// zmm returns the result of one of the matrix-matrix operations
|
||||
// alpha * op(A) * op(B) + beta * C
|
||||
//
|
||||
// alpha * op(A) * op(B) + beta * C
|
||||
//
|
||||
// where op(X) is one of
|
||||
// op(X) = X or op(X) = Xᵀ or op(X) = Xᴴ,
|
||||
//
|
||||
// op(X) = X or op(X) = Xᵀ or op(X) = Xᴴ,
|
||||
//
|
||||
// alpha and beta are scalars, and A, B and C are matrices, with op(A) an m×k matrix,
|
||||
// op(B) a k×n matrix and C an m×n matrix.
|
||||
//
|
||||
|
@@ -117,7 +117,9 @@ func Complex(dst []complex128, real, imag []float64) []complex128 {
|
||||
|
||||
// CumProd finds the cumulative product of elements of s and store it in
|
||||
// place into dst so that
|
||||
// dst[i] = s[i] * s[i-1] * s[i-2] * ... * s[0]
|
||||
//
|
||||
// dst[i] = s[i] * s[i-1] * s[i-2] * ... * s[0]
|
||||
//
|
||||
// It panics if the argument lengths do not match.
|
||||
func CumProd(dst, s []complex128) []complex128 {
|
||||
if len(dst) != len(s) {
|
||||
@@ -131,7 +133,9 @@ func CumProd(dst, s []complex128) []complex128 {
|
||||
|
||||
// CumSum finds the cumulative sum of elements of s and stores it in place
|
||||
// into dst so that
|
||||
// dst[i] = s[i] + s[i-1] + s[i-2] + ... + s[0]
|
||||
//
|
||||
// dst[i] = s[i] + s[i-1] + s[i-2] + ... + s[0]
|
||||
//
|
||||
// It panics if the argument lengths do not match.
|
||||
func CumSum(dst, s []complex128) []complex128 {
|
||||
if len(dst) != len(s) {
|
||||
@@ -348,7 +352,7 @@ func Imag(dst []float64, src []complex128) []float64 {
|
||||
// will return all zeros if l or u is zero.
|
||||
// Also returns the mutated slice dst, so that it can be used in range, like:
|
||||
//
|
||||
// for i, x := range LogSpan(dst, l, u) { ... }
|
||||
// for i, x := range LogSpan(dst, l, u) { ... }
|
||||
func LogSpan(dst []complex128, l, u complex128) []complex128 {
|
||||
Span(dst, cmplx.Log(l), cmplx.Log(u))
|
||||
for i := range dst {
|
||||
@@ -627,7 +631,7 @@ func ScaleTo(dst []complex128, c complex128, s []complex128) []complex128 {
|
||||
// Span also returns the mutated slice dst, so that it can be used in range expressions,
|
||||
// like:
|
||||
//
|
||||
// for i, x := range Span(dst, l, u) { ... }
|
||||
// for i, x := range Span(dst, l, u) { ... }
|
||||
func Span(dst []complex128, l, u complex128) []complex128 {
|
||||
n := len(dst)
|
||||
if n < 2 {
|
||||
|
@@ -23,7 +23,8 @@ const minNormalFloat64 = 0x1p-1022
|
||||
|
||||
// EqualWithinRel returns true when the difference between a and b
|
||||
// is not greater than tol times the greater absolute value of a and b,
|
||||
// abs(a-b) <= tol * max(abs(a), abs(b)).
|
||||
//
|
||||
// abs(a-b) <= tol * max(abs(a), abs(b)).
|
||||
func EqualWithinRel(a, b complex128, tol float64) bool {
|
||||
if a == b {
|
||||
return true
|
||||
@@ -61,9 +62,10 @@ func ParseWithNA(s, missing string) (value complex128, weight float64, err error
|
||||
// Round returns the half away from zero rounded value of x with prec precision.
|
||||
//
|
||||
// Special cases are:
|
||||
// Round(±0) = +0
|
||||
// Round(±Inf) = ±Inf
|
||||
// Round(NaN) = NaN
|
||||
//
|
||||
// Round(±0) = +0
|
||||
// Round(±Inf) = ±Inf
|
||||
// Round(NaN) = NaN
|
||||
func Round(x complex128, prec int) complex128 {
|
||||
if x == 0 {
|
||||
// Make sure zero is returned
|
||||
@@ -76,9 +78,10 @@ func Round(x complex128, prec int) complex128 {
|
||||
// RoundEven returns the half even rounded value of x with prec precision.
|
||||
//
|
||||
// Special cases are:
|
||||
// RoundEven(±0) = +0
|
||||
// RoundEven(±Inf) = ±Inf
|
||||
// RoundEven(NaN) = NaN
|
||||
//
|
||||
// RoundEven(±0) = +0
|
||||
// RoundEven(±Inf) = ±Inf
|
||||
// RoundEven(NaN) = NaN
|
||||
func RoundEven(x complex128, prec int) complex128 {
|
||||
if x == 0 {
|
||||
// Make sure zero is returned
|
||||
|
@@ -12,7 +12,9 @@ import (
|
||||
// CrossLaplacian computes a Laplacian-like quantity for a function of two vectors
|
||||
// at the locations x and y.
|
||||
// It computes
|
||||
// ∇_y · ∇_x f(x,y) = \sum_i ∂^2 f(x,y)/∂x_i ∂y_i
|
||||
//
|
||||
// ∇_y · ∇_x f(x,y) = \sum_i ∂^2 f(x,y)/∂x_i ∂y_i
|
||||
//
|
||||
// The two input vector lengths must be the same.
|
||||
//
|
||||
// Finite difference formula and other options are specified by settings. If
|
||||
|
@@ -17,7 +17,9 @@ type Point struct {
|
||||
|
||||
// Formula represents a finite difference formula on a regularly spaced grid
|
||||
// that approximates the derivative of order k of a function f at x as
|
||||
// d^k f(x) ≈ (1 / Step^k) * \sum_i Coeff_i * f(x + Step * Loc_i).
|
||||
//
|
||||
// d^k f(x) ≈ (1 / Step^k) * \sum_i Coeff_i * f(x + Step * Loc_i).
|
||||
//
|
||||
// Step must be positive, or the finite difference formula will panic.
|
||||
type Formula struct {
|
||||
// Stencil is the set of sampling Points which are used to estimate the
|
||||
|
@@ -13,7 +13,9 @@ import (
|
||||
|
||||
// Hessian approximates the Hessian matrix of the multivariate function f at
|
||||
// the location x. That is
|
||||
// H_{i,j} = ∂^2 f(x)/∂x_i ∂x_j
|
||||
//
|
||||
// H_{i,j} = ∂^2 f(x)/∂x_i ∂x_j
|
||||
//
|
||||
// The resulting H will be stored in dst. Finite difference formula and other
|
||||
// options are specified by settings. If settings is nil, the Hessian will be
|
||||
// estimated using the Forward formula and a default step size.
|
||||
|
@@ -28,13 +28,16 @@ type JacobianSettings struct {
|
||||
// The Jacobian matrix J is the matrix of all first-order partial derivatives of f.
|
||||
// If f maps an n-dimensional vector x to an m-dimensional vector y = f(x), J is
|
||||
// an m×n matrix whose elements are given as
|
||||
// J_{i,j} = ∂f_i/∂x_j,
|
||||
//
|
||||
// J_{i,j} = ∂f_i/∂x_j,
|
||||
//
|
||||
// or expanded out
|
||||
// [ ∂f_1/∂x_1 ... ∂f_1/∂x_n ]
|
||||
// [ . . . ]
|
||||
// J = [ . . . ]
|
||||
// [ . . . ]
|
||||
// [ ∂f_m/∂x_1 ... ∂f_m/∂x_n ]
|
||||
//
|
||||
// [ ∂f_1/∂x_1 ... ∂f_1/∂x_n ]
|
||||
// [ . . . ]
|
||||
// J = [ . . . ]
|
||||
// [ . . . ]
|
||||
// [ ∂f_m/∂x_1 ... ∂f_m/∂x_n ]
|
||||
//
|
||||
// dst must be non-nil, the number of its columns must equal the length of x, and
|
||||
// the derivative order of the formula must be 1, otherwise Jacobian will panic.
|
||||
|
@@ -8,7 +8,9 @@ import "sync"
|
||||
|
||||
// Laplacian computes the Laplacian of the multivariate function f at the location
|
||||
// x. That is, Laplacian returns
|
||||
// ∆ f(x) = ∇ · ∇ f(x) = \sum_i ∂^2 f(x)/∂x_i^2
|
||||
//
|
||||
// ∆ f(x) = ∇ · ∇ f(x) = \sum_i ∂^2 f(x)/∂x_i^2
|
||||
//
|
||||
// The finite difference formula and other options are specified by settings.
|
||||
// The order of the difference formula must be 2 or Laplacian will panic.
|
||||
func Laplacian(f func(x []float64) float64, x []float64, settings *Settings) float64 {
|
||||
|
@@ -14,10 +14,10 @@ import "gonum.org/v1/gonum/mat"
|
||||
// derivative methods.
|
||||
//
|
||||
// References:
|
||||
// - Kowalik, J.S., Osborne, M.R.: Methods for Unconstrained Optimization
|
||||
// Problems. Elsevier North-Holland, New York, 1968
|
||||
// - More, J., Garbow, B.S., Hillstrom, K.E.: Testing unconstrained
|
||||
// optimization software. ACM Trans Math Softw 7 (1981), 17-41
|
||||
// - Kowalik, J.S., Osborne, M.R.: Methods for Unconstrained Optimization
|
||||
// Problems. Elsevier North-Holland, New York, 1968
|
||||
// - More, J., Garbow, B.S., Hillstrom, K.E.: Testing unconstrained
|
||||
// optimization software. ACM Trans Math Softw 7 (1981), 17-41
|
||||
type Watson struct{}
|
||||
|
||||
func (Watson) Func(x []float64) (sum float64) {
|
||||
|
@@ -7,31 +7,33 @@
|
||||
// to be used to verify window behaviour against foreign implementations.
|
||||
// For example, the behavior of a NumPy window can be captured using this
|
||||
// python code:
|
||||
// import matplotlib.pyplot as plt
|
||||
// import numpy as np
|
||||
// from numpy.fft import fft
|
||||
//
|
||||
// window = np.blackman(20)
|
||||
// print("# beta = %f" % np.mean(window))
|
||||
// import matplotlib.pyplot as plt
|
||||
// import numpy as np
|
||||
// from numpy.fft import fft
|
||||
//
|
||||
// plt.figure()
|
||||
// window = np.blackman(20)
|
||||
// print("# beta = %f" % np.mean(window))
|
||||
//
|
||||
// A = fft(window, 1000)
|
||||
// mag = np.abs(A)
|
||||
// with np.errstate(divide='ignore', invalid='ignore'):
|
||||
// mag = 20 * np.log10(mag)
|
||||
// mag -= max(mag)
|
||||
// freq = np.linspace(0, len(window)/2, len(A)/2)
|
||||
// plt.figure()
|
||||
//
|
||||
// for m in mag[:len(mag)/2]:
|
||||
// print(m)
|
||||
// A = fft(window, 1000)
|
||||
// mag = np.abs(A)
|
||||
// with np.errstate(divide='ignore', invalid='ignore'):
|
||||
// mag = 20 * np.log10(mag)
|
||||
// mag -= max(mag)
|
||||
// freq = np.linspace(0, len(window)/2, len(A)/2)
|
||||
//
|
||||
// plt.plot(freq, mag[:len(mag)/2])
|
||||
// plt.title("Spectral leakage")
|
||||
// plt.ylabel("Amplitude (dB)")
|
||||
// plt.xlabel("DFT bin")
|
||||
// for m in mag[:len(mag)/2]:
|
||||
// print(m)
|
||||
//
|
||||
// plt.plot(freq, mag[:len(mag)/2])
|
||||
// plt.title("Spectral leakage")
|
||||
// plt.ylabel("Amplitude (dB)")
|
||||
// plt.xlabel("DFT bin")
|
||||
//
|
||||
// plt.show()
|
||||
//
|
||||
// plt.show()
|
||||
// and then be exported to leakage and compared with the Gonum
|
||||
// implementation.
|
||||
package main
|
||||
|
@@ -9,7 +9,7 @@
|
||||
// when performing a Fourier transform on a signal of limited length.
|
||||
// See https://en.wikipedia.org/wiki/Window_function for more details.
|
||||
//
|
||||
// Spectral leakage parameters
|
||||
// # Spectral leakage parameters
|
||||
//
|
||||
// Application of window functions to an input will result in changes
|
||||
// to the frequency content of the signal in an effect called spectral
|
||||
@@ -23,7 +23,8 @@
|
||||
// constant component of the spectrum resulting from use of the window
|
||||
// compared to that produced using the rectangular window, expressed in
|
||||
// a logarithmic scale.
|
||||
// β_w = 20 log10(A_w / A_rect) dB
|
||||
//
|
||||
// β_w = 20 log10(A_w / A_rect) dB
|
||||
//
|
||||
// The ΔF_0 parameter describes the normalized width of the main lobe of
|
||||
// the frequency spectrum at zero amplitude.
|
||||
@@ -34,7 +35,9 @@
|
||||
// The K parameter describes the relative width of the main lobe of the
|
||||
// frequency spectrum produced by the window compared with the rectangular
|
||||
// window. The rectangular window has the lowest ΔF_0 at a value of 2.
|
||||
// K_w = ΔF_0_w/ΔF_0_rect.
|
||||
//
|
||||
// K_w = ΔF_0_w/ΔF_0_rect.
|
||||
//
|
||||
// The value of K divides windows into high resolution windows (K≤3) and
|
||||
// low resolution windows (K>3).
|
||||
//
|
||||
|
@@ -16,7 +16,9 @@ import "math"
|
||||
// limited length sequence of values without any modification.
|
||||
//
|
||||
// The sequence weights are
|
||||
// w[k] = 1,
|
||||
//
|
||||
// w[k] = 1,
|
||||
//
|
||||
// for k=0,1,...,N-1 where N is the length of the window.
|
||||
//
|
||||
// Spectral leakage parameters: ΔF_0 = 2, ΔF_0.5 = 0.89, K = 1, ɣ_max = -13, β = 0.
|
||||
@@ -31,7 +33,9 @@ func Rectangular(seq []float64) []float64 {
|
||||
// Sine window is a high-resolution window.
|
||||
//
|
||||
// The sequence weights are
|
||||
// w[k] = sin(π*k/(N-1)),
|
||||
//
|
||||
// w[k] = sin(π*k/(N-1)),
|
||||
//
|
||||
// for k=0,1,...,N-1 where N is the length of the window.
|
||||
//
|
||||
// Spectral leakage parameters: ΔF_0 = 3, ΔF_0.5 = 1.23, K = 1.5, ɣ_max = -23, β = -3.93.
|
||||
@@ -50,7 +54,9 @@ func Sine(seq []float64) []float64 {
|
||||
// The Lanczos window is a high-resolution window.
|
||||
//
|
||||
// The sequence weights are
|
||||
// w[k] = sinc(2*k/(N-1) - 1),
|
||||
//
|
||||
// w[k] = sinc(2*k/(N-1) - 1),
|
||||
//
|
||||
// for k=0,1,...,N-1 where N is the length of the window.
|
||||
//
|
||||
// Spectral leakage parameters: ΔF_0 = 3.24, ΔF_0.5 = 1.3, K = 1.62, ɣ_max = -26.4, β = -4.6.
|
||||
@@ -75,7 +81,9 @@ func Lanczos(seq []float64) []float64 {
|
||||
// The Triangular window is a high-resolution window.
|
||||
//
|
||||
// The sequence weights are
|
||||
// w[k] = 1 - |k/A -1|, A=(N-1)/2,
|
||||
//
|
||||
// w[k] = 1 - |k/A -1|, A=(N-1)/2,
|
||||
//
|
||||
// for k=0,1,...,N-1 where N is the length of the window.
|
||||
//
|
||||
// Spectral leakage parameters: ΔF_0 = 4, ΔF_0.5 = 1.33, K = 2, ɣ_max = -26.5, β = -6.
|
||||
@@ -94,7 +102,9 @@ func Triangular(seq []float64) []float64 {
|
||||
// The Hann window is a high-resolution window.
|
||||
//
|
||||
// The sequence weights are
|
||||
// w[k] = 0.5*(1 - cos(2*π*k/(N-1))),
|
||||
//
|
||||
// w[k] = 0.5*(1 - cos(2*π*k/(N-1))),
|
||||
//
|
||||
// for k=0,1,...,N-1 where N is the length of the window.
|
||||
//
|
||||
// Spectral leakage parameters: ΔF_0 = 4, ΔF_0.5 = 1.5, K = 2, ɣ_max = -31.5, β = -6.
|
||||
@@ -114,7 +124,9 @@ func Hann(seq []float64) []float64 {
|
||||
// The Bartlett-Hann window is a high-resolution window.
|
||||
//
|
||||
// The sequence weights are
|
||||
// w[k] = 0.62 - 0.48*|k/(N-1)-0.5| - 0.38*cos(2*π*k/(N-1)),
|
||||
//
|
||||
// w[k] = 0.62 - 0.48*|k/(N-1)-0.5| - 0.38*cos(2*π*k/(N-1)),
|
||||
//
|
||||
// for k=0,1,...,N-1 where N is the length of the window.
|
||||
//
|
||||
// Spectral leakage parameters: ΔF_0 = 4, ΔF_0.5 = 1.45, K = 2, ɣ_max = -35.9, β = -6.
|
||||
@@ -140,7 +152,9 @@ func BartlettHann(seq []float64) []float64 {
|
||||
// the highest ɣ_max.
|
||||
//
|
||||
// The sequence weights are
|
||||
// w[k] = 25/46 - 21/46 * cos(2*π*k/(N-1)),
|
||||
//
|
||||
// w[k] = 25/46 - 21/46 * cos(2*π*k/(N-1)),
|
||||
//
|
||||
// for k=0,1,...,N-1 where N is the length of the window.
|
||||
//
|
||||
// Spectral leakage parameters: ΔF_0 = 4, ΔF_0.5 = 1.33, K = 2, ɣ_max = -42, β = -5.37.
|
||||
@@ -165,7 +179,9 @@ func Hamming(seq []float64) []float64 {
|
||||
// The Blackman window is a high-resolution window.
|
||||
//
|
||||
// The sequence weights are
|
||||
// w[k] = 0.42 - 0.5*cos(2*π*k/(N-1)) + 0.08*cos(4*π*k/(N-1)),
|
||||
//
|
||||
// w[k] = 0.42 - 0.5*cos(2*π*k/(N-1)) + 0.08*cos(4*π*k/(N-1)),
|
||||
//
|
||||
// for k=0,1,...,N-1 where N is the length of the window.
|
||||
//
|
||||
// Spectral leakage parameters: ΔF_0 = 6, ΔF_0.5 = 1.7, K = 3, ɣ_max = -58, β = -7.54.
|
||||
@@ -192,8 +208,10 @@ func Blackman(seq []float64) []float64 {
|
||||
// The Blackman-Harris window is a low-resolution window.
|
||||
//
|
||||
// The sequence weights are
|
||||
// w[k] = 0.35875 - 0.48829*cos(2*π*k/(N-1)) +
|
||||
// 0.14128*cos(4*π*k/(N-1)) - 0.01168*cos(6*π*k/(N-1)),
|
||||
//
|
||||
// w[k] = 0.35875 - 0.48829*cos(2*π*k/(N-1)) +
|
||||
// 0.14128*cos(4*π*k/(N-1)) - 0.01168*cos(6*π*k/(N-1)),
|
||||
//
|
||||
// for k=0,1,...,N-1 where N is the length of the window.
|
||||
//
|
||||
// Spectral leakage parameters: ΔF_0 = 8, ΔF_0.5 = 1.97, K = 4, ɣ_max = -92, β = -8.91.
|
||||
@@ -220,8 +238,10 @@ func BlackmanHarris(seq []float64) []float64 {
|
||||
// The Nuttall window is a low-resolution window.
|
||||
//
|
||||
// The sequence weights are
|
||||
// w[k] = 0.355768 - 0.487396*cos(2*π*k/(N-1)) + 0.144232*cos(4*π*k/(N-1)) -
|
||||
// 0.012604*cos(6*π*k/(N-1)),
|
||||
//
|
||||
// w[k] = 0.355768 - 0.487396*cos(2*π*k/(N-1)) + 0.144232*cos(4*π*k/(N-1)) -
|
||||
// 0.012604*cos(6*π*k/(N-1)),
|
||||
//
|
||||
// for k=0,1,...,N-1 where N is the length of the window.
|
||||
//
|
||||
// Spectral leakage parameters: ΔF_0 = 8, ΔF_0.5 = 1.98, K = 4, ɣ_max = -93, β = -9.
|
||||
@@ -249,8 +269,10 @@ func Nuttall(seq []float64) []float64 {
|
||||
// The Blackman-Nuttall window is a low-resolution window.
|
||||
//
|
||||
// The sequence weights are
|
||||
// w[k] = 0.3635819 - 0.4891775*cos(2*π*k/(N-1)) + 0.1365995*cos(4*π*k/(N-1)) -
|
||||
// 0.0106411*cos(6*π*k/(N-1)),
|
||||
//
|
||||
// w[k] = 0.3635819 - 0.4891775*cos(2*π*k/(N-1)) + 0.1365995*cos(4*π*k/(N-1)) -
|
||||
// 0.0106411*cos(6*π*k/(N-1)),
|
||||
//
|
||||
// for k=0,1,...,N-1 where N is the length of the window.
|
||||
//
|
||||
// Spectral leakage parameters: ΔF_0 = 8, ΔF_0.5 = 1.94, K = 4, ɣ_max = -98, β = -8.8.
|
||||
@@ -278,9 +300,11 @@ func BlackmanNuttall(seq []float64) []float64 {
|
||||
// The Flat Top window is a low-resolution window.
|
||||
//
|
||||
// The sequence weights are
|
||||
// w[k] = 0.21557895 - 0.41663158*cos(2*π*k/(N-1)) +
|
||||
// 0.277263158*cos(4*π*k/(N-1)) - 0.083578947*cos(6*π*k/(N-1)) +
|
||||
// 0.006947368*cos(4*π*k/(N-1)),
|
||||
//
|
||||
// w[k] = 0.21557895 - 0.41663158*cos(2*π*k/(N-1)) +
|
||||
// 0.277263158*cos(4*π*k/(N-1)) - 0.083578947*cos(6*π*k/(N-1)) +
|
||||
// 0.006947368*cos(4*π*k/(N-1)),
|
||||
//
|
||||
// for k=0,1,...,N-1 where N is the length of the window.
|
||||
//
|
||||
// Spectral leakage parameters: ΔF_0 = 10, ΔF_0.5 = 3.72, K = 5, ɣ_max = -93.0, β = -13.34.
|
||||
|
@@ -16,7 +16,9 @@ import "math"
|
||||
// limited length sequence of values without any modification.
|
||||
//
|
||||
// The sequence weights are
|
||||
// w[k] = 1,
|
||||
//
|
||||
// w[k] = 1,
|
||||
//
|
||||
// for k=0,1,...,N-1 where N is the length of the window.
|
||||
//
|
||||
// Spectral leakage parameters: ΔF_0 = 2, ΔF_0.5 = 0.89, K = 1, ɣ_max = -13, β = 0.
|
||||
@@ -32,7 +34,9 @@ func RectangularComplex(seq []complex128) []complex128 {
|
||||
// Sine window is a high-resolution window.
|
||||
//
|
||||
// The sequence weights are
|
||||
// w[k] = sin(π*k/(N-1)),
|
||||
//
|
||||
// w[k] = sin(π*k/(N-1)),
|
||||
//
|
||||
// for k=0,1,...,N-1 where N is the length of the window.
|
||||
//
|
||||
// Spectral leakage parameters: ΔF_0 = 3, ΔF_0.5 = 1.23, K = 1.5, ɣ_max = -23, β = -3.93.
|
||||
@@ -53,7 +57,9 @@ func SineComplex(seq []complex128) []complex128 {
|
||||
// The Lanczos window is a high-resolution window.
|
||||
//
|
||||
// The sequence weights are
|
||||
// w[k] = sinc(2*k/(N-1) - 1),
|
||||
//
|
||||
// w[k] = sinc(2*k/(N-1) - 1),
|
||||
//
|
||||
// for k=0,1,...,N-1 where N is the length of the window.
|
||||
//
|
||||
// Spectral leakage parameters: ΔF_0 = 3.24, ΔF_0.5 = 1.3, K = 1.62, ɣ_max = -26.4, β = -4.6.
|
||||
@@ -79,7 +85,9 @@ func LanczosComplex(seq []complex128) []complex128 {
|
||||
// The Triangular window is a high-resolution window.
|
||||
//
|
||||
// The sequence weights are
|
||||
// w[k] = 1 - |k/A -1|, A=(N-1)/2,
|
||||
//
|
||||
// w[k] = 1 - |k/A -1|, A=(N-1)/2,
|
||||
//
|
||||
// for k=0,1,...,N-1 where N is the length of the window.
|
||||
//
|
||||
// Spectral leakage parameters: ΔF_0 = 4, ΔF_0.5 = 1.33, K = 2, ɣ_max = -26.5, β = -6.
|
||||
@@ -99,7 +107,9 @@ func TriangularComplex(seq []complex128) []complex128 {
|
||||
// The Hann window is a high-resolution window.
|
||||
//
|
||||
// The sequence weights are
|
||||
// w[k] = 0.5*(1 - cos(2*π*k/(N-1))),
|
||||
//
|
||||
// w[k] = 0.5*(1 - cos(2*π*k/(N-1))),
|
||||
//
|
||||
// for k=0,1,...,N-1 where N is the length of the window.
|
||||
//
|
||||
// Spectral leakage parameters: ΔF_0 = 4, ΔF_0.5 = 1.5, K = 2, ɣ_max = -31.5, β = -6.
|
||||
@@ -120,7 +130,9 @@ func HannComplex(seq []complex128) []complex128 {
|
||||
// The Bartlett-Hann window is a high-resolution window.
|
||||
//
|
||||
// The sequence weights are
|
||||
// w[k] = 0.62 - 0.48*|k/(N-1)-0.5| - 0.38*cos(2*π*k/(N-1)),
|
||||
//
|
||||
// w[k] = 0.62 - 0.48*|k/(N-1)-0.5| - 0.38*cos(2*π*k/(N-1)),
|
||||
//
|
||||
// for k=0,1,...,N-1 where N is the length of the window.
|
||||
//
|
||||
// Spectral leakage parameters: ΔF_0 = 4, ΔF_0.5 = 1.45, K = 2, ɣ_max = -35.9, β = -6.
|
||||
@@ -148,7 +160,9 @@ func BartlettHannComplex(seq []complex128) []complex128 {
|
||||
// the highest ɣ_max.
|
||||
//
|
||||
// The sequence weights are
|
||||
// w[k] = 25/46 - 21/46 * cos(2*π*k/(N-1)),
|
||||
//
|
||||
// w[k] = 25/46 - 21/46 * cos(2*π*k/(N-1)),
|
||||
//
|
||||
// for k=0,1,...,N-1 where N is the length of the window.
|
||||
//
|
||||
// Spectral leakage parameters: ΔF_0 = 4, ΔF_0.5 = 1.33, K = 2, ɣ_max = -42, β = -5.37.
|
||||
@@ -174,7 +188,9 @@ func HammingComplex(seq []complex128) []complex128 {
|
||||
// The Blackman window is a high-resolution window.
|
||||
//
|
||||
// The sequence weights are
|
||||
// w[k] = 0.42 - 0.5*cos(2*π*k/(N-1)) + 0.08*cos(4*π*k/(N-1)),
|
||||
//
|
||||
// w[k] = 0.42 - 0.5*cos(2*π*k/(N-1)) + 0.08*cos(4*π*k/(N-1)),
|
||||
//
|
||||
// for k=0,1,...,N-1 where N is the length of the window.
|
||||
//
|
||||
// Spectral leakage parameters: ΔF_0 = 6, ΔF_0.5 = 1.7, K = 3, ɣ_max = -58, β = -7.54.
|
||||
@@ -202,8 +218,10 @@ func BlackmanComplex(seq []complex128) []complex128 {
|
||||
// The Blackman-Harris window is a low-resolution window.
|
||||
//
|
||||
// The sequence weights are
|
||||
// w[k] = 0.35875 - 0.48829*cos(2*π*k/(N-1)) +
|
||||
// 0.14128*cos(4*π*k/(N-1)) - 0.01168*cos(6*π*k/(N-1)),
|
||||
//
|
||||
// w[k] = 0.35875 - 0.48829*cos(2*π*k/(N-1)) +
|
||||
// 0.14128*cos(4*π*k/(N-1)) - 0.01168*cos(6*π*k/(N-1)),
|
||||
//
|
||||
// for k=0,1,...,N-1 where N is the length of the window.
|
||||
//
|
||||
// Spectral leakage parameters: ΔF_0 = 8, ΔF_0.5 = 1.97, K = 4, ɣ_max = -92, β = -8.91.
|
||||
@@ -232,8 +250,10 @@ func BlackmanHarrisComplex(seq []complex128) []complex128 {
|
||||
// The Nuttall window is a low-resolution window.
|
||||
//
|
||||
// The sequence weights are
|
||||
// w[k] = 0.355768 - 0.487396*cos(2*π*k/(N-1)) + 0.144232*cos(4*π*k/(N-1)) -
|
||||
// 0.012604*cos(6*π*k/(N-1)),
|
||||
//
|
||||
// w[k] = 0.355768 - 0.487396*cos(2*π*k/(N-1)) + 0.144232*cos(4*π*k/(N-1)) -
|
||||
// 0.012604*cos(6*π*k/(N-1)),
|
||||
//
|
||||
// for k=0,1,...,N-1 where N is the length of the window.
|
||||
//
|
||||
// Spectral leakage parameters: ΔF_0 = 8, ΔF_0.5 = 1.98, K = 4, ɣ_max = -93, β = -9.
|
||||
@@ -262,8 +282,10 @@ func NuttallComplex(seq []complex128) []complex128 {
|
||||
// The Blackman-Nuttall window is a low-resolution window.
|
||||
//
|
||||
// The sequence weights are
|
||||
// w[k] = 0.3635819 - 0.4891775*cos(2*π*k/(N-1)) + 0.1365995*cos(4*π*k/(N-1)) -
|
||||
// 0.0106411*cos(6*π*k/(N-1)),
|
||||
//
|
||||
// w[k] = 0.3635819 - 0.4891775*cos(2*π*k/(N-1)) + 0.1365995*cos(4*π*k/(N-1)) -
|
||||
// 0.0106411*cos(6*π*k/(N-1)),
|
||||
//
|
||||
// for k=0,1,...,N-1 where N is the length of the window.
|
||||
//
|
||||
// Spectral leakage parameters: ΔF_0 = 8, ΔF_0.5 = 1.94, K = 4, ɣ_max = -98, β = -8.8.
|
||||
@@ -292,9 +314,11 @@ func BlackmanNuttallComplex(seq []complex128) []complex128 {
|
||||
// The Flat Top window is a low-resolution window.
|
||||
//
|
||||
// The sequence weights are
|
||||
// w[k] = 0.21557895 - 0.41663158*cos(2*π*k/(N-1)) +
|
||||
// 0.277263158*cos(4*π*k/(N-1)) - 0.083578947*cos(6*π*k/(N-1)) +
|
||||
// 0.006947368*cos(4*π*k/(N-1)),
|
||||
//
|
||||
// w[k] = 0.21557895 - 0.41663158*cos(2*π*k/(N-1)) +
|
||||
// 0.277263158*cos(4*π*k/(N-1)) - 0.083578947*cos(6*π*k/(N-1)) +
|
||||
// 0.006947368*cos(4*π*k/(N-1)),
|
||||
//
|
||||
// for k=0,1,...,N-1 where N is the length of the window.
|
||||
//
|
||||
// Spectral leakage parameters: ΔF_0 = 10, ΔF_0.5 = 3.72, K = 5, ɣ_max = -93.0, β = -13.34.
|
||||
|
@@ -14,20 +14,23 @@ import "math"
|
||||
// The Gaussian window is an adjustable window.
|
||||
//
|
||||
// The sequence weights are
|
||||
// w[k] = exp(-0.5 * ((k-M)/(σ*M))² ), M = (N-1)/2,
|
||||
//
|
||||
// w[k] = exp(-0.5 * ((k-M)/(σ*M))² ), M = (N-1)/2,
|
||||
//
|
||||
// for k=0,1,...,N-1 where N is the length of the window.
|
||||
//
|
||||
// The properties of the window depend on the value of σ (sigma).
|
||||
// It can be used as high or low resolution window, depending of the σ value.
|
||||
//
|
||||
// Spectral leakage parameters are summarized in the table:
|
||||
// | σ=0.3 | σ=0.5 | σ=1.2 |
|
||||
// -------|---------------------------|
|
||||
// ΔF_0 | 8 | 3.4 | 2.2 |
|
||||
// ΔF_0.5 | 1.82 | 1.2 | 0.94 |
|
||||
// K | 4 | 1.7 | 1.1 |
|
||||
// ɣ_max | -65 | -31.5 | -15.5 |
|
||||
// β | -8.52 | -4.48 | -0.96 |
|
||||
//
|
||||
// | σ=0.3 | σ=0.5 | σ=1.2 |
|
||||
// -------|---------------------------|
|
||||
// ΔF_0 | 8 | 3.4 | 2.2 |
|
||||
// ΔF_0.5 | 1.82 | 1.2 | 0.94 |
|
||||
// K | 4 | 1.7 | 1.1 |
|
||||
// ɣ_max | -65 | -31.5 | -15.5 |
|
||||
// β | -8.52 | -4.48 | -0.96 |
|
||||
type Gaussian struct {
|
||||
Sigma float64
|
||||
}
|
||||
@@ -63,18 +66,21 @@ func (g Gaussian) TransformComplex(seq []complex128) []complex128 {
|
||||
// The Tukey window is an adjustable window.
|
||||
//
|
||||
// The sequence weights are
|
||||
// w[k] = 0.5 * (1 + cos(π*(|k - M| - αM)/((1-α) * M))), |k - M| ≥ αM
|
||||
// = 1, |k - M| < αM
|
||||
//
|
||||
// w[k] = 0.5 * (1 + cos(π*(|k - M| - αM)/((1-α) * M))), |k - M| ≥ αM
|
||||
// = 1, |k - M| < αM
|
||||
//
|
||||
// with M = (N - 1)/2 for k=0,1,...,N-1 where N is the length of the window.
|
||||
//
|
||||
// Spectral leakage parameters are summarized in the table:
|
||||
// | α=0.3 | α=0.5 | α=0.7 |
|
||||
// -------|--------------------------|
|
||||
// ΔF_0 | 1.33 | 1.22 | 1.13 |
|
||||
// ΔF_0.5 | 1.28 | 1.16 | 1.04 |
|
||||
// K | 0.67 | 0.61 | 0.57 |
|
||||
// ɣ_max | -18.2 | -15.1 | -13.8 |
|
||||
// β | -1.41 | -2.50 | -3.74 |
|
||||
//
|
||||
// | α=0.3 | α=0.5 | α=0.7 |
|
||||
// -------|--------------------------|
|
||||
// ΔF_0 | 1.33 | 1.22 | 1.13 |
|
||||
// ΔF_0.5 | 1.28 | 1.16 | 1.04 |
|
||||
// K | 0.67 | 0.61 | 0.57 |
|
||||
// ɣ_max | -18.2 | -15.1 | -13.8 |
|
||||
// β | -1.41 | -2.50 | -3.74 |
|
||||
type Tukey struct {
|
||||
Alpha float64
|
||||
}
|
||||
|
@@ -361,7 +361,7 @@ func HasNaN(s []float64) bool {
|
||||
// will return all zeros if l or u is zero.
|
||||
// Also returns the mutated slice dst, so that it can be used in range, like:
|
||||
//
|
||||
// for i, x := range LogSpan(dst, l, u) { ... }
|
||||
// for i, x := range LogSpan(dst, l, u) { ... }
|
||||
func LogSpan(dst []float64, l, u float64) []float64 {
|
||||
Span(dst, math.Log(l), math.Log(u))
|
||||
for i := range dst {
|
||||
@@ -681,7 +681,7 @@ func ScaleTo(dst []float64, c float64, s []float64) []float64 {
|
||||
// Span also returns the mutated slice dst, so that it can be used in range expressions,
|
||||
// like:
|
||||
//
|
||||
// for i, x := range Span(dst, l, u) { ... }
|
||||
// for i, x := range Span(dst, l, u) { ... }
|
||||
func Span(dst []float64, l, u float64) []float64 {
|
||||
n := len(dst)
|
||||
if n < 2 {
|
||||
@@ -765,8 +765,8 @@ func Sum(s []float64) float64 {
|
||||
}
|
||||
|
||||
// Within returns the first index i where s[i] <= v < s[i+1]. Within panics if:
|
||||
// - len(s) < 2
|
||||
// - s is not sorted
|
||||
// - len(s) < 2
|
||||
// - s is not sorted
|
||||
func Within(s []float64, v float64) int {
|
||||
if len(s) < 2 {
|
||||
panic(shortSpan)
|
||||
|
@@ -21,7 +21,8 @@ const minNormalFloat64 = 0x1p-1022
|
||||
|
||||
// EqualWithinRel returns true when the difference between a and b
|
||||
// is not greater than tol times the greater absolute value of a and b,
|
||||
// abs(a-b) <= tol * max(abs(a), abs(b)).
|
||||
//
|
||||
// abs(a-b) <= tol * max(abs(a), abs(b)).
|
||||
func EqualWithinRel(a, b, tol float64) bool {
|
||||
if a == b {
|
||||
return true
|
||||
@@ -105,9 +106,10 @@ func ParseWithNA(s, missing string) (value, weight float64, err error) {
|
||||
// Round returns the half away from zero rounded value of x with prec precision.
|
||||
//
|
||||
// Special cases are:
|
||||
// Round(±0) = +0
|
||||
// Round(±Inf) = ±Inf
|
||||
// Round(NaN) = NaN
|
||||
//
|
||||
// Round(±0) = +0
|
||||
// Round(±Inf) = ±Inf
|
||||
// Round(NaN) = NaN
|
||||
func Round(x float64, prec int) float64 {
|
||||
if x == 0 {
|
||||
// Make sure zero is returned
|
||||
@@ -135,9 +137,10 @@ func Round(x float64, prec int) float64 {
|
||||
// RoundEven returns the half even rounded value of x with prec precision.
|
||||
//
|
||||
// Special cases are:
|
||||
// RoundEven(±0) = +0
|
||||
// RoundEven(±Inf) = ±Inf
|
||||
// RoundEven(NaN) = NaN
|
||||
//
|
||||
// RoundEven(±0) = +0
|
||||
// RoundEven(±Inf) = ±Inf
|
||||
// RoundEven(NaN) = NaN
|
||||
func RoundEven(x float64, prec int) float64 {
|
||||
if x == 0 {
|
||||
// Make sure zero is returned
|
||||
|
@@ -21,9 +21,12 @@ import (
|
||||
// Q will panic if g has any edge with negative edge weight.
|
||||
//
|
||||
// If g is undirected, Q is calculated according to
|
||||
// Q = 1/2m \sum_{ij} [ A_{ij} - (\gamma k_i k_j)/2m ] \delta(c_i,c_j),
|
||||
//
|
||||
// Q = 1/2m \sum_{ij} [ A_{ij} - (\gamma k_i k_j)/2m ] \delta(c_i,c_j),
|
||||
//
|
||||
// If g is directed, it is calculated according to
|
||||
// Q = 1/m \sum_{ij} [ A_{ij} - (\gamma k_i^in k_j^out)/m ] \delta(c_i,c_j).
|
||||
//
|
||||
// Q = 1/m \sum_{ij} [ A_{ij} - (\gamma k_i^in k_j^out)/m ] \delta(c_i,c_j).
|
||||
//
|
||||
// graph.Undirect may be used as a shim to allow calculation of Q for
|
||||
// directed graphs with the undirected modularity function.
|
||||
@@ -73,9 +76,12 @@ type ReducedGraph interface {
|
||||
// generator. Modularize will panic if g has any edge with negative edge weight.
|
||||
//
|
||||
// If g is undirected it is modularised to minimise
|
||||
// Q = 1/2m \sum_{ij} [ A_{ij} - (\gamma k_i k_j)/2m ] \delta(c_i,c_j),
|
||||
//
|
||||
// Q = 1/2m \sum_{ij} [ A_{ij} - (\gamma k_i k_j)/2m ] \delta(c_i,c_j),
|
||||
//
|
||||
// If g is directed it is modularised to minimise
|
||||
// Q = 1/m \sum_{ij} [ A_{ij} - (\gamma k_i^in k_j^out)/m ] \delta(c_i,c_j).
|
||||
//
|
||||
// Q = 1/m \sum_{ij} [ A_{ij} - (\gamma k_i^in k_j^out)/m ] \delta(c_i,c_j).
|
||||
//
|
||||
// The concrete type of the ReducedGraph will be a pointer to either a
|
||||
// ReducedUndirected or a ReducedDirected depending on the type of g.
|
||||
@@ -120,9 +126,12 @@ type Multiplex interface {
|
||||
// negative edge weight.
|
||||
//
|
||||
// If g is undirected, Q is calculated according to
|
||||
// Q_{layer} = w_{layer} \sum_{ij} [ A_{layer}*_{ij} - (\gamma_{layer} k_i k_j)/2m_{layer} ] \delta(c_i,c_j),
|
||||
//
|
||||
// Q_{layer} = w_{layer} \sum_{ij} [ A_{layer}*_{ij} - (\gamma_{layer} k_i k_j)/2m_{layer} ] \delta(c_i,c_j),
|
||||
//
|
||||
// If g is directed, it is calculated according to
|
||||
// Q_{layer} = w_{layer} \sum_{ij} [ A_{layer}*_{ij} - (\gamma_{layer} k_i^in k_j^out)/m_{layer} ] \delta(c_i,c_j).
|
||||
//
|
||||
// Q_{layer} = w_{layer} \sum_{ij} [ A_{layer}*_{ij} - (\gamma_{layer} k_i^in k_j^out)/m_{layer} ] \delta(c_i,c_j).
|
||||
//
|
||||
// Note that Q values for multiplex graphs are not scaled by the total layer edge weight.
|
||||
//
|
||||
@@ -183,9 +192,12 @@ type ReducedMultiplex interface {
|
||||
// edge weight that does not sign-match the layer weight.
|
||||
//
|
||||
// If g is undirected it is modularised to minimise
|
||||
// Q = \sum w_{layer} \sum_{ij} [ A_{layer}*_{ij} - (\gamma_{layer} k_i k_j)/2m ] \delta(c_i,c_j).
|
||||
//
|
||||
// Q = \sum w_{layer} \sum_{ij} [ A_{layer}*_{ij} - (\gamma_{layer} k_i k_j)/2m ] \delta(c_i,c_j).
|
||||
//
|
||||
// If g is directed it is modularised to minimise
|
||||
// Q = \sum w_{layer} \sum_{ij} [ A_{layer}*_{ij} - (\gamma_{layer} k_i^in k_j^out)/m_{layer} ] \delta(c_i,c_j).
|
||||
//
|
||||
// Q = \sum w_{layer} \sum_{ij} [ A_{layer}*_{ij} - (\gamma_{layer} k_i^in k_j^out)/m_{layer} ] \delta(c_i,c_j).
|
||||
//
|
||||
// The concrete type of the ReducedMultiplex will be a pointer to a
|
||||
// ReducedUndirectedMultiplex.
|
||||
|
@@ -22,8 +22,7 @@ import (
|
||||
// is γ as defined in Reichardt and Bornholdt doi:10.1103/PhysRevE.74.016110.
|
||||
// qDirected will panic if g has any edge with negative edge weight.
|
||||
//
|
||||
// Q = 1/m \sum_{ij} [ A_{ij} - (\gamma k_i^in k_j^out)/m ] \delta(c_i,c_j)
|
||||
//
|
||||
// Q = 1/m \sum_{ij} [ A_{ij} - (\gamma k_i^in k_j^out)/m ] \delta(c_i,c_j)
|
||||
func qDirected(g graph.Directed, communities [][]graph.Node, resolution float64) float64 {
|
||||
nodes := graph.NodesOf(g.Nodes())
|
||||
weight := positiveWeightFuncFor(g)
|
||||
|
@@ -38,7 +38,7 @@ type DirectedMultiplex interface {
|
||||
// qUndirectedMultiplex will panic if the graph has any layer weight-scaled edge with
|
||||
// negative edge weight.
|
||||
//
|
||||
// Q_{layer} = w_{layer} \sum_{ij} [ A_{layer}*_{ij} - (\gamma_{layer} k_i k_j)/2m ] \delta(c_i,c_j)
|
||||
// Q_{layer} = w_{layer} \sum_{ij} [ A_{layer}*_{ij} - (\gamma_{layer} k_i k_j)/2m ] \delta(c_i,c_j)
|
||||
//
|
||||
// Note that Q values for multiplex graphs are not scaled by the total layer edge weight.
|
||||
func qDirectedMultiplex(g DirectedMultiplex, communities [][]graph.Node, weights, resolutions []float64) []float64 {
|
||||
|
@@ -22,7 +22,7 @@ import (
|
||||
// is γ as defined in Reichardt and Bornholdt doi:10.1103/PhysRevE.74.016110.
|
||||
// qUndirected will panic if g has any edge with negative edge weight.
|
||||
//
|
||||
// Q = 1/2m \sum_{ij} [ A_{ij} - (\gamma k_i k_j)/2m ] \delta(c_i,c_j)
|
||||
// Q = 1/2m \sum_{ij} [ A_{ij} - (\gamma k_i k_j)/2m ] \delta(c_i,c_j)
|
||||
//
|
||||
// graph.Undirect may be used as a shim to allow calculation of Q for
|
||||
// directed graphs.
|
||||
|
@@ -38,7 +38,7 @@ type UndirectedMultiplex interface {
|
||||
// qUndirectedMultiplex will panic if the graph has any layer weight-scaled edge with
|
||||
// negative edge weight.
|
||||
//
|
||||
// Q_{layer} = w_{layer} \sum_{ij} [ A_{layer}*_{ij} - (\gamma_{layer} k_i k_j)/2m ] \delta(c_i,c_j)
|
||||
// Q_{layer} = w_{layer} \sum_{ij} [ A_{layer}*_{ij} - (\gamma_{layer} k_i k_j)/2m ] \delta(c_i,c_j)
|
||||
//
|
||||
// Note that Q values for multiplex graphs are not scaled by the total layer edge weight.
|
||||
//
|
||||
|
@@ -11,7 +11,7 @@
|
||||
//
|
||||
// DOT grammar: http://www.graphviz.org/doc/info/lang.html
|
||||
//
|
||||
// Attribute quoting
|
||||
// # Attribute quoting
|
||||
//
|
||||
// Attributes and IDs are quoted if needed during marshalling, to conform with
|
||||
// valid DOT syntax. Quoted IDs and attributes are unquoted during unmarshaling,
|
||||
|
@@ -636,11 +636,11 @@ var (
|
||||
//
|
||||
// An ID is one of the following:
|
||||
//
|
||||
// 1. Any string of alphabetic ([a-zA-Z\200-\377]) characters, underscores ('_')
|
||||
// or digits ([0-9]), not beginning with a digit;
|
||||
// 2. a numeral [-]?(.[0-9]+ | [0-9]+(.[0-9]*)? );
|
||||
// 3. any double-quoted string ("...") possibly containing escaped quotes (\");
|
||||
// 4. an HTML string (<...>).
|
||||
// 1. Any string of alphabetic ([a-zA-Z\200-\377]) characters, underscores ('_')
|
||||
// or digits ([0-9]), not beginning with a digit;
|
||||
// 2. a numeral [-]?(.[0-9]+ | [0-9]+(.[0-9]*)? );
|
||||
// 3. any double-quoted string ("...") possibly containing escaped quotes (\");
|
||||
// 4. an HTML string (<...>).
|
||||
func isID(s string) bool {
|
||||
// 1. an identifier.
|
||||
if reIdent.MatchString(s) {
|
||||
|
@@ -21,12 +21,12 @@ import (
|
||||
//
|
||||
// Examples.
|
||||
//
|
||||
// digraph G {
|
||||
// A -> B
|
||||
// }
|
||||
// graph H {
|
||||
// C - D
|
||||
// }
|
||||
// digraph G {
|
||||
// A -> B
|
||||
// }
|
||||
// graph H {
|
||||
// C - D
|
||||
// }
|
||||
type File struct {
|
||||
// Graphs.
|
||||
Graphs []*Graph
|
||||
@@ -50,10 +50,10 @@ func (f *File) String() string {
|
||||
//
|
||||
// Examples.
|
||||
//
|
||||
// digraph G {
|
||||
// A -> {B C}
|
||||
// B -> C
|
||||
// }
|
||||
// digraph G {
|
||||
// A -> {B C}
|
||||
// B -> C
|
||||
// }
|
||||
type Graph struct {
|
||||
// Strict graph; multi-edges forbidden.
|
||||
Strict bool
|
||||
@@ -91,11 +91,11 @@ func (g *Graph) String() string {
|
||||
|
||||
// A Stmt represents a statement, and has one of the following underlying types.
|
||||
//
|
||||
// *NodeStmt
|
||||
// *EdgeStmt
|
||||
// *AttrStmt
|
||||
// *Attr
|
||||
// *Subgraph
|
||||
// *NodeStmt
|
||||
// *EdgeStmt
|
||||
// *AttrStmt
|
||||
// *Attr
|
||||
// *Subgraph
|
||||
type Stmt interface {
|
||||
fmt.Stringer
|
||||
// isStmt ensures that only statements can be assigned to the Stmt interface.
|
||||
@@ -108,7 +108,7 @@ type Stmt interface {
|
||||
//
|
||||
// Examples.
|
||||
//
|
||||
// A [color=blue]
|
||||
// A [color=blue]
|
||||
type NodeStmt struct {
|
||||
// Node.
|
||||
Node *Node
|
||||
@@ -139,9 +139,9 @@ func (e *NodeStmt) String() string {
|
||||
//
|
||||
// Examples.
|
||||
//
|
||||
// A -> B
|
||||
// A -> {B C}
|
||||
// A -> B -> C
|
||||
// A -> B
|
||||
// A -> {B C}
|
||||
// A -> B -> C
|
||||
type EdgeStmt struct {
|
||||
// Source vertex.
|
||||
From Vertex
|
||||
@@ -196,9 +196,9 @@ func (e *Edge) String() string {
|
||||
//
|
||||
// Examples.
|
||||
//
|
||||
// graph [rankdir=LR]
|
||||
// node [color=blue fillcolor=red]
|
||||
// edge [minlen=1]
|
||||
// graph [rankdir=LR]
|
||||
// node [color=blue fillcolor=red]
|
||||
// edge [minlen=1]
|
||||
type AttrStmt struct {
|
||||
// Graph component kind to which the attributes are assigned.
|
||||
Kind Kind
|
||||
@@ -250,7 +250,7 @@ func (k Kind) String() string {
|
||||
//
|
||||
// Examples.
|
||||
//
|
||||
// rank=same
|
||||
// rank=same
|
||||
type Attr struct {
|
||||
// Attribute key.
|
||||
Key string
|
||||
@@ -269,7 +269,7 @@ func (a *Attr) String() string {
|
||||
//
|
||||
// Examples.
|
||||
//
|
||||
// subgraph S {A B C}
|
||||
// subgraph S {A B C}
|
||||
type Subgraph struct {
|
||||
// Subgraph ID; or empty if none.
|
||||
ID string
|
||||
@@ -305,8 +305,8 @@ func (*Subgraph) isStmt() {}
|
||||
|
||||
// A Vertex represents a vertex, and has one of the following underlying types.
|
||||
//
|
||||
// *Node
|
||||
// *Subgraph
|
||||
// *Node
|
||||
// *Subgraph
|
||||
type Vertex interface {
|
||||
fmt.Stringer
|
||||
// isVertex ensures that only vertices can be assigned to the Vertex
|
||||
@@ -320,8 +320,8 @@ type Vertex interface {
|
||||
//
|
||||
// Examples.
|
||||
//
|
||||
// A
|
||||
// A:nw
|
||||
// A
|
||||
// A:nw
|
||||
type Node struct {
|
||||
// Node ID.
|
||||
ID string
|
||||
|
@@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build debug
|
||||
// +build debug
|
||||
|
||||
package rdf
|
||||
|
@@ -692,11 +692,12 @@ func split(statements []*Statement) [][]*Statement {
|
||||
//
|
||||
// The correspondence between the parameters for the function in the paper
|
||||
// with the implementation here is as follows:
|
||||
// - G = statements
|
||||
// - hash = hash
|
||||
// - P = parts (already sorted by hashBNodesPerSplit)
|
||||
// - G⊥ = lowest
|
||||
// - B = hash.blanks
|
||||
// - G = statements
|
||||
// - hash = hash
|
||||
// - P = parts (already sorted by hashBNodesPerSplit)
|
||||
// - G⊥ = lowest
|
||||
// - B = hash.blanks
|
||||
//
|
||||
// The additional parameter dist specifies that distinguish should treat
|
||||
// coequal trivial parts as a coarse of intermediate part and distinguish
|
||||
// the nodes in that merged part.
|
||||
|
@@ -2,6 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build !debug
|
||||
// +build !debug
|
||||
|
||||
package rdf
|
||||
|
@@ -237,14 +237,13 @@ func (q Query) Not(p Query) Query {
|
||||
// is wanted, fn should return its input and false when the partial
|
||||
// traversal returns an empty result.
|
||||
//
|
||||
// result := start.Repeat(func(q rdf.Query) (rdf.Query, bool) {
|
||||
// r := q.Out(condition)
|
||||
// if r.Len() == 0 {
|
||||
// return q, false
|
||||
// }
|
||||
// return r, true
|
||||
// }).Result()
|
||||
//
|
||||
// result := start.Repeat(func(q rdf.Query) (rdf.Query, bool) {
|
||||
// r := q.Out(condition)
|
||||
// if r.Len() == 0 {
|
||||
// return q, false
|
||||
// }
|
||||
// return r, true
|
||||
// }).Result()
|
||||
func (q Query) Repeat(fn func(Query) (q Query, ok bool)) Query {
|
||||
for {
|
||||
var ok bool
|
||||
|
@@ -171,13 +171,12 @@ func Equal(a, b Nodes) bool {
|
||||
// The union of two sets, a and b, is the set containing all the
|
||||
// elements of each, for instance:
|
||||
//
|
||||
// {a,b,c} UNION {d,e,f} = {a,b,c,d,e,f}
|
||||
// {a,b,c} UNION {d,e,f} = {a,b,c,d,e,f}
|
||||
//
|
||||
// Since sets may not have repetition, unions of two sets that overlap
|
||||
// do not contain repeat elements, that is:
|
||||
//
|
||||
// {a,b,c} UNION {b,c,d} = {a,b,c,d}
|
||||
//
|
||||
// {a,b,c} UNION {b,c,d} = {a,b,c,d}
|
||||
func UnionOfNodes(a, b Nodes) Nodes {
|
||||
if same(a, b) {
|
||||
return CloneNodes(a)
|
||||
@@ -199,18 +198,17 @@ func UnionOfNodes(a, b Nodes) Nodes {
|
||||
// The intersection of two sets, a and b, is the set containing all
|
||||
// the elements shared between the two sets, for instance:
|
||||
//
|
||||
// {a,b,c} INTERSECT {b,c,d} = {b,c}
|
||||
// {a,b,c} INTERSECT {b,c,d} = {b,c}
|
||||
//
|
||||
// The intersection between a set and itself is itself, and thus
|
||||
// effectively a copy operation:
|
||||
//
|
||||
// {a,b,c} INTERSECT {a,b,c} = {a,b,c}
|
||||
// {a,b,c} INTERSECT {a,b,c} = {a,b,c}
|
||||
//
|
||||
// The intersection between two sets that share no elements is the empty
|
||||
// set:
|
||||
//
|
||||
// {a,b,c} INTERSECT {d,e,f} = {}
|
||||
//
|
||||
// {a,b,c} INTERSECT {d,e,f} = {}
|
||||
func IntersectionOfNodes(a, b Nodes) Nodes {
|
||||
if same(a, b) {
|
||||
return CloneNodes(a)
|
||||
|
@@ -31,6 +31,7 @@ type emptyInterface struct {
|
||||
// Having a clone here allows us to embed a map iterator
|
||||
// inside type mapIter so that mapIters can be re-used
|
||||
// without doing any allocations.
|
||||
//
|
||||
//lint:ignore U1000 This is a verbatim copy of the runtime type.
|
||||
type hiter struct {
|
||||
key unsafe.Pointer
|
||||
|
@@ -14,7 +14,7 @@ import (
|
||||
|
||||
// Betweenness returns the non-zero betweenness centrality for nodes in the unweighted graph g.
|
||||
//
|
||||
// C_B(v) = \sum_{s ≠ v ≠ t ∈ V} (\sigma_{st}(v) / \sigma_{st})
|
||||
// C_B(v) = \sum_{s ≠ v ≠ t ∈ V} (\sigma_{st}(v) / \sigma_{st})
|
||||
//
|
||||
// where \sigma_{st} and \sigma_{st}(v) are the number of shortest paths from s to t,
|
||||
// and the subset of those paths containing v respectively.
|
||||
@@ -52,7 +52,7 @@ func Betweenness(g graph.Graph) map[int64]float64 {
|
||||
// EdgeBetweenness returns the non-zero betweenness centrality for edges in the
|
||||
// unweighted graph g. For an edge e the centrality C_B is computed as
|
||||
//
|
||||
// C_B(e) = \sum_{s ≠ t ∈ V} (\sigma_{st}(e) / \sigma_{st}),
|
||||
// C_B(e) = \sum_{s ≠ t ∈ V} (\sigma_{st}(e) / \sigma_{st}),
|
||||
//
|
||||
// where \sigma_{st} and \sigma_{st}(e) are the number of shortest paths from s
|
||||
// to t, and the subset of those paths containing e, respectively.
|
||||
@@ -146,7 +146,7 @@ func brandes(g graph.Graph, accumulate func(s graph.Node, stack linear.NodeStack
|
||||
// BetweennessWeighted returns the non-zero betweenness centrality for nodes in the weighted
|
||||
// graph g used to construct the given shortest paths.
|
||||
//
|
||||
// C_B(v) = \sum_{s ≠ v ≠ t ∈ V} (\sigma_{st}(v) / \sigma_{st})
|
||||
// C_B(v) = \sum_{s ≠ v ≠ t ∈ V} (\sigma_{st}(v) / \sigma_{st})
|
||||
//
|
||||
// where \sigma_{st} and \sigma_{st}(v) are the number of shortest paths from s to t,
|
||||
// and the subset of those paths containing v respectively.
|
||||
@@ -196,7 +196,7 @@ func BetweennessWeighted(g graph.Weighted, p path.AllShortest) map[int64]float64
|
||||
// EdgeBetweennessWeighted returns the non-zero betweenness centrality for edges in
|
||||
// the weighted graph g. For an edge e the centrality C_B is computed as
|
||||
//
|
||||
// C_B(e) = \sum_{s ≠ t ∈ V} (\sigma_{st}(e) / \sigma_{st}),
|
||||
// C_B(e) = \sum_{s ≠ t ∈ V} (\sigma_{st}(e) / \sigma_{st}),
|
||||
//
|
||||
// where \sigma_{st} and \sigma_{st}(e) are the number of shortest paths from s
|
||||
// to t, and the subset of those paths containing e, respectively.
|
||||
|
@@ -14,7 +14,9 @@ import (
|
||||
// h, according to the Laplacian with a diffusion time of t.
|
||||
// The resulting heat distribution is returned, written into the map dst and
|
||||
// returned,
|
||||
// d = exp(-Lt)×h
|
||||
//
|
||||
// d = exp(-Lt)×h
|
||||
//
|
||||
// where L is the graph Laplacian. Indexing into h and dst is defined by the
|
||||
// Laplacian Index field. If dst is nil, a new map is created.
|
||||
//
|
||||
@@ -45,7 +47,9 @@ func Diffuse(dst, h map[int64]float64, by spectral.Laplacian, t float64) map[int
|
||||
// DiffuseToEquilibrium performs a heat diffusion across nodes of the
|
||||
// graph described by the given Laplacian using the initial heat
|
||||
// distribution, h, according to the Laplacian until the update function
|
||||
// h_{n+1} = h_n - L×h_n
|
||||
//
|
||||
// h_{n+1} = h_n - L×h_n
|
||||
//
|
||||
// results in a 2-norm update difference within tol, or iters updates have
|
||||
// been made.
|
||||
// The resulting heat distribution is returned as eq, written into the map dst,
|
||||
|
@@ -14,7 +14,7 @@ import (
|
||||
// Closeness returns the closeness centrality for nodes in the graph g used to
|
||||
// construct the given shortest paths.
|
||||
//
|
||||
// C(v) = 1 / \sum_u d(u,v)
|
||||
// C(v) = 1 / \sum_u d(u,v)
|
||||
//
|
||||
// For directed graphs the incoming paths are used. Infinite distances are
|
||||
// not considered.
|
||||
@@ -43,7 +43,7 @@ func Closeness(g graph.Graph, p path.AllShortest) map[int64]float64 {
|
||||
// Farness returns the farness for nodes in the graph g used to construct
|
||||
// the given shortest paths.
|
||||
//
|
||||
// F(v) = \sum_u d(u,v)
|
||||
// F(v) = \sum_u d(u,v)
|
||||
//
|
||||
// For directed graphs the incoming paths are used. Infinite distances are
|
||||
// not considered.
|
||||
@@ -72,7 +72,7 @@ func Farness(g graph.Graph, p path.AllShortest) map[int64]float64 {
|
||||
// Harmonic returns the harmonic centrality for nodes in the graph g used to
|
||||
// construct the given shortest paths.
|
||||
//
|
||||
// H(v)= \sum_{u ≠ v} 1 / d(u,v)
|
||||
// H(v)= \sum_{u ≠ v} 1 / d(u,v)
|
||||
//
|
||||
// For directed graphs the incoming paths are used. Infinite distances are
|
||||
// not considered.
|
||||
@@ -103,7 +103,7 @@ func Harmonic(g graph.Graph, p path.AllShortest) map[int64]float64 {
|
||||
// Residual returns the Dangalchev's residual closeness for nodes in the graph
|
||||
// g used to construct the given shortest paths.
|
||||
//
|
||||
// C(v)= \sum_{u ≠ v} 1 / 2^d(u,v)
|
||||
// C(v)= \sum_{u ≠ v} 1 / 2^d(u,v)
|
||||
//
|
||||
// For directed graphs the incoming paths are used. Infinite distances are
|
||||
// not considered.
|
||||
|
@@ -16,8 +16,7 @@ import (
|
||||
|
||||
// DStarLite implements the D* Lite dynamic re-planning path search algorithm.
|
||||
//
|
||||
// doi:10.1109/tro.2004.838026 and ISBN:0-262-51129-0 pp476-483
|
||||
//
|
||||
// doi:10.1109/tro.2004.838026 and ISBN:0-262-51129-0 pp476-483
|
||||
type DStarLite struct {
|
||||
s, t *dStarLiteNode
|
||||
last *dStarLiteNode
|
||||
@@ -426,8 +425,7 @@ func (k key) isBadKey() bool { return k != k }
|
||||
|
||||
// less returns whether k is less than other. From ISBN:0-262-51129-0 pp476-483:
|
||||
//
|
||||
// k ≤ k' iff k₁ < k'₁ OR (k₁ == k'₁ AND k₂ ≤ k'₂)
|
||||
//
|
||||
// k ≤ k' iff k₁ < k'₁ OR (k₁ == k'₁ AND k₂ ≤ k'₂)
|
||||
func (k key) less(other key) bool {
|
||||
if k.isBadKey() || other.isBadKey() {
|
||||
panic("D* Lite: poisoned key")
|
||||
|
@@ -87,7 +87,6 @@ func sortedFrom(sccs [][]graph.Node, order func([]graph.Node)) ([]graph.Node, er
|
||||
// Generally speaking, a directed graph where the number of strongly connected components is equal
|
||||
// to the number of nodes is acyclic, unless you count reflexive edges as a cycle (which requires
|
||||
// only a little extra testing.)
|
||||
//
|
||||
func TarjanSCC(g graph.Directed) [][]graph.Node {
|
||||
return tarjanSCCstabilized(g, nil)
|
||||
}
|
||||
@@ -130,7 +129,6 @@ func tarjanSCCstabilized(g graph.Directed, order func([]graph.Node)) [][]graph.N
|
||||
// algorithm. The implementation is from the pseudocode at
|
||||
//
|
||||
// http://en.wikipedia.org/wiki/Tarjan%27s_strongly_connected_components_algorithm?oldid=642744644
|
||||
//
|
||||
type tarjan struct {
|
||||
succ func(id int64) []graph.Node
|
||||
|
||||
|
@@ -3,5 +3,4 @@
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
// Package quad provides numerical evaluation of definite integrals of single-variable functions.
|
||||
//
|
||||
package quad // import "gonum.org/v1/gonum/integrate/quad"
|
||||
|
@@ -13,7 +13,8 @@ import (
|
||||
|
||||
// Hermite generates sample locations and weights for performing quadrature with
|
||||
// a squared-exponential weight
|
||||
// int_-inf^inf e^(-x^2) f(x) dx .
|
||||
//
|
||||
// int_-inf^inf e^(-x^2) f(x) dx .
|
||||
type Hermite struct{}
|
||||
|
||||
func (h Hermite) FixedLocations(x, weight []float64, min, max float64) {
|
||||
|
@@ -7,7 +7,8 @@ package quad
|
||||
import "math"
|
||||
|
||||
// Legendre integrates an unweighted function over finite bounds
|
||||
// int_min^max f(x) dx
|
||||
//
|
||||
// int_min^max f(x) dx
|
||||
type Legendre struct{}
|
||||
|
||||
func (l Legendre) FixedLocations(x, weight []float64, min, max float64) {
|
||||
|
@@ -12,7 +12,8 @@ import (
|
||||
// FixedLocationer computes a set of quadrature locations and weights and stores
|
||||
// them in-place into x and weight respectively. The number of points generated is equal to
|
||||
// the len(x). The weights and locations should be chosen such that
|
||||
// int_min^max f(x) dx ≈ \sum_i w_i f(x_i)
|
||||
//
|
||||
// int_min^max f(x) dx ≈ \sum_i w_i f(x_i)
|
||||
type FixedLocationer interface {
|
||||
FixedLocations(x, weight []float64, min, max float64)
|
||||
}
|
||||
@@ -26,7 +27,9 @@ type FixedLocationSingler interface {
|
||||
// Fixed approximates the integral of the function f from min to max using a fixed
|
||||
// n-point quadrature rule. During evaluation, f will be evaluated n times using
|
||||
// the weights and locations specified by rule. That is, Fixed estimates
|
||||
// int_min^max f(x) dx ≈ \sum_i w_i f(x_i)
|
||||
//
|
||||
// int_min^max f(x) dx ≈ \sum_i w_i f(x_i)
|
||||
//
|
||||
// If rule is nil, an acceptable default is chosen, otherwise it is
|
||||
// assumed that the properties of the integral match the assumptions of rule.
|
||||
// For example, Legendre assumes that the integration bounds are finite. If
|
||||
|
@@ -10,10 +10,14 @@ import (
|
||||
)
|
||||
|
||||
// Romberg returns an approximate value of the integral
|
||||
// \int_a^b f(x)dx
|
||||
//
|
||||
// \int_a^b f(x)dx
|
||||
//
|
||||
// computed using the Romberg's method. The function f is given
|
||||
// as a slice of equally-spaced samples, that is,
|
||||
// f[i] = f(a + i*dx)
|
||||
//
|
||||
// f[i] = f(a + i*dx)
|
||||
//
|
||||
// and dx is the spacing between the samples.
|
||||
//
|
||||
// The length of f must be 2^k + 1, where k is a positive integer,
|
||||
|
@@ -7,10 +7,14 @@ package integrate
|
||||
import "sort"
|
||||
|
||||
// Simpsons returns an approximate value of the integral
|
||||
// \int_a^b f(x)dx
|
||||
//
|
||||
// \int_a^b f(x)dx
|
||||
//
|
||||
// computed using the Simpsons's method. The function f is given as a slice of
|
||||
// samples evaluated at locations in x, that is,
|
||||
// f[i] = f(x[i]), x[0] = a, x[len(x)-1] = b
|
||||
//
|
||||
// f[i] = f(x[i]), x[0] = a, x[len(x)-1] = b
|
||||
//
|
||||
// The slice x must be sorted in strictly increasing order. x and f must be of
|
||||
// equal length and the length must be at least 3.
|
||||
//
|
||||
|
@@ -11,7 +11,9 @@ import (
|
||||
)
|
||||
|
||||
// Integral is a definite integral
|
||||
// ∫_a^b f(x)dx
|
||||
//
|
||||
// ∫_a^b f(x)dx
|
||||
//
|
||||
// with a known value.
|
||||
type Integral struct {
|
||||
Name string
|
||||
@@ -21,7 +23,8 @@ type Integral struct {
|
||||
}
|
||||
|
||||
// Constant returns the integral of a constant function
|
||||
// ∫_{-1}^2 alpha dx
|
||||
//
|
||||
// ∫_{-1}^2 alpha dx
|
||||
func Constant(alpha float64) Integral {
|
||||
return Integral{
|
||||
Name: fmt.Sprintf("∫_{-1}^{2} %vdx", alpha),
|
||||
@@ -35,7 +38,8 @@ func Constant(alpha float64) Integral {
|
||||
}
|
||||
|
||||
// Poly returns the integral of a polynomial
|
||||
// ∫_{-1}^2 x^degree dx
|
||||
//
|
||||
// ∫_{-1}^2 x^degree dx
|
||||
func Poly(degree int) Integral {
|
||||
d := float64(degree)
|
||||
return Integral{
|
||||
@@ -50,7 +54,8 @@ func Poly(degree int) Integral {
|
||||
}
|
||||
|
||||
// Sin returns the integral
|
||||
// ∫_0^1 sin(x)dx
|
||||
//
|
||||
// ∫_0^1 sin(x)dx
|
||||
func Sin() Integral {
|
||||
return Integral{
|
||||
Name: "∫_0^1 sin(x)dx",
|
||||
@@ -64,7 +69,8 @@ func Sin() Integral {
|
||||
}
|
||||
|
||||
// XExpMinusX returns the integral
|
||||
// ∫_0^1 x*exp(-x)dx
|
||||
//
|
||||
// ∫_0^1 x*exp(-x)dx
|
||||
func XExpMinusX() Integral {
|
||||
return Integral{
|
||||
Name: "∫_0^1 x*exp(-x)dx",
|
||||
@@ -78,7 +84,8 @@ func XExpMinusX() Integral {
|
||||
}
|
||||
|
||||
// Sqrt returns the integral
|
||||
// ∫_0^1 sqrt(x)dx
|
||||
//
|
||||
// ∫_0^1 sqrt(x)dx
|
||||
func Sqrt() Integral {
|
||||
return Integral{
|
||||
Name: "∫_0^1 sqrt(x)dx",
|
||||
@@ -92,7 +99,8 @@ func Sqrt() Integral {
|
||||
}
|
||||
|
||||
// ExpOverX2Plus1 returns the integral
|
||||
// ∫_0^1 exp(x)/(x*x+1)dx
|
||||
//
|
||||
// ∫_0^1 exp(x)/(x*x+1)dx
|
||||
func ExpOverX2Plus1() Integral {
|
||||
return Integral{
|
||||
Name: "∫_0^1 exp(x)/(x*x+1)dx",
|
||||
|
@@ -7,18 +7,26 @@ package integrate
|
||||
import "sort"
|
||||
|
||||
// Trapezoidal returns an approximate value of the integral
|
||||
// \int_a^b f(x) dx
|
||||
//
|
||||
// \int_a^b f(x) dx
|
||||
//
|
||||
// computed using the trapezoidal rule. The function f is given as a slice of
|
||||
// samples evaluated at locations in x, that is,
|
||||
// f[i] = f(x[i]), x[0] = a, x[len(x)-1] = b
|
||||
//
|
||||
// f[i] = f(x[i]), x[0] = a, x[len(x)-1] = b
|
||||
//
|
||||
// The slice x must be sorted in strictly increasing order. x and f must be of
|
||||
// equal length and the length must be at least 2.
|
||||
//
|
||||
// The trapezoidal rule approximates f by a piecewise linear function and
|
||||
// estimates
|
||||
// \int_x[i]^x[i+1] f(x) dx
|
||||
//
|
||||
// \int_x[i]^x[i+1] f(x) dx
|
||||
//
|
||||
// as
|
||||
// (x[i+1] - x[i]) * (f[i] + f[i+1])/2
|
||||
//
|
||||
// (x[i+1] - x[i]) * (f[i] + f[i+1])/2
|
||||
//
|
||||
// More details on the trapezoidal rule can be found at:
|
||||
// https://en.wikipedia.org/wiki/Trapezoidal_rule
|
||||
func Trapezoidal(x, f []float64) float64 {
|
||||
|
@@ -5,9 +5,10 @@
|
||||
package c128
|
||||
|
||||
// ScalUnitaryTo is
|
||||
// for i, v := range x {
|
||||
// dst[i] = alpha * v
|
||||
// }
|
||||
//
|
||||
// for i, v := range x {
|
||||
// dst[i] = alpha * v
|
||||
// }
|
||||
func ScalUnitaryTo(dst []complex128, alpha complex128, x []complex128) {
|
||||
for i, v := range x {
|
||||
dst[i] = alpha * v
|
||||
@@ -15,12 +16,13 @@ func ScalUnitaryTo(dst []complex128, alpha complex128, x []complex128) {
|
||||
}
|
||||
|
||||
// ScalIncTo is
|
||||
// var idst, ix uintptr
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// dst[idst] = alpha * x[ix]
|
||||
// ix += incX
|
||||
// idst += incDst
|
||||
// }
|
||||
//
|
||||
// var idst, ix uintptr
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// dst[idst] = alpha * x[ix]
|
||||
// ix += incX
|
||||
// idst += incDst
|
||||
// }
|
||||
func ScalIncTo(dst []complex128, incDst uintptr, alpha complex128, x []complex128, n, incX uintptr) {
|
||||
var idst, ix uintptr
|
||||
for i := 0; i < int(n); i++ {
|
||||
|
@@ -10,9 +10,10 @@ import (
|
||||
)
|
||||
|
||||
// Add is
|
||||
// for i, v := range s {
|
||||
// dst[i] += v
|
||||
// }
|
||||
//
|
||||
// for i, v := range s {
|
||||
// dst[i] += v
|
||||
// }
|
||||
func Add(dst, s []complex128) {
|
||||
for i, v := range s {
|
||||
dst[i] += v
|
||||
@@ -20,9 +21,10 @@ func Add(dst, s []complex128) {
|
||||
}
|
||||
|
||||
// AddConst is
|
||||
// for i := range x {
|
||||
// x[i] += alpha
|
||||
// }
|
||||
//
|
||||
// for i := range x {
|
||||
// x[i] += alpha
|
||||
// }
|
||||
func AddConst(alpha complex128, x []complex128) {
|
||||
for i := range x {
|
||||
x[i] += alpha
|
||||
@@ -30,14 +32,15 @@ func AddConst(alpha complex128, x []complex128) {
|
||||
}
|
||||
|
||||
// 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
|
||||
//
|
||||
// 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(dst, s []complex128) []complex128 {
|
||||
if len(s) == 0 {
|
||||
return dst
|
||||
@@ -50,14 +53,15 @@ func CumSum(dst, s []complex128) []complex128 {
|
||||
}
|
||||
|
||||
// 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
|
||||
//
|
||||
// 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 CumProd(dst, s []complex128) []complex128 {
|
||||
if len(s) == 0 {
|
||||
return dst
|
||||
@@ -70,9 +74,10 @@ func CumProd(dst, s []complex128) []complex128 {
|
||||
}
|
||||
|
||||
// Div is
|
||||
// for i, v := range s {
|
||||
// dst[i] /= v
|
||||
// }
|
||||
//
|
||||
// for i, v := range s {
|
||||
// dst[i] /= v
|
||||
// }
|
||||
func Div(dst, s []complex128) {
|
||||
for i, v := range s {
|
||||
dst[i] /= v
|
||||
@@ -80,10 +85,11 @@ func Div(dst, s []complex128) {
|
||||
}
|
||||
|
||||
// DivTo is
|
||||
// for i, v := range s {
|
||||
// dst[i] = v / t[i]
|
||||
// }
|
||||
// return dst
|
||||
//
|
||||
// for i, v := range s {
|
||||
// dst[i] = v / t[i]
|
||||
// }
|
||||
// return dst
|
||||
func DivTo(dst, s, t []complex128) []complex128 {
|
||||
for i, v := range s {
|
||||
dst[i] = v / t[i]
|
||||
@@ -92,10 +98,11 @@ func DivTo(dst, s, t []complex128) []complex128 {
|
||||
}
|
||||
|
||||
// DotUnitary is
|
||||
// for i, v := range x {
|
||||
// sum += cmplx.Conj(v) * y[i]
|
||||
// }
|
||||
// return sum
|
||||
//
|
||||
// for i, v := range x {
|
||||
// sum += cmplx.Conj(v) * y[i]
|
||||
// }
|
||||
// return sum
|
||||
func DotUnitary(x, y []complex128) (sum complex128) {
|
||||
for i, v := range x {
|
||||
sum += cmplx.Conj(v) * y[i]
|
||||
@@ -159,10 +166,11 @@ func L2NormUnitary(x []complex128) (norm float64) {
|
||||
}
|
||||
|
||||
// Sum is
|
||||
// var sum complex128
|
||||
// for i := range x {
|
||||
// sum += x[i]
|
||||
// }
|
||||
//
|
||||
// var sum complex128
|
||||
// for i := range x {
|
||||
// sum += x[i]
|
||||
// }
|
||||
func Sum(x []complex128) complex128 {
|
||||
var sum complex128
|
||||
for _, v := range x {
|
||||
|
@@ -8,90 +8,102 @@
|
||||
package c128
|
||||
|
||||
// AxpyUnitary is
|
||||
// for i, v := range x {
|
||||
// y[i] += alpha * v
|
||||
// }
|
||||
//
|
||||
// for i, v := range x {
|
||||
// y[i] += alpha * v
|
||||
// }
|
||||
func AxpyUnitary(alpha complex128, x, y []complex128)
|
||||
|
||||
// AxpyUnitaryTo is
|
||||
// for i, v := range x {
|
||||
// dst[i] = alpha*v + y[i]
|
||||
// }
|
||||
//
|
||||
// for i, v := range x {
|
||||
// dst[i] = alpha*v + y[i]
|
||||
// }
|
||||
func AxpyUnitaryTo(dst []complex128, alpha complex128, x, y []complex128)
|
||||
|
||||
// AxpyInc is
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// y[iy] += alpha * x[ix]
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
//
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// y[iy] += alpha * x[ix]
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
func AxpyInc(alpha complex128, x, y []complex128, 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
|
||||
// }
|
||||
//
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// dst[idst] = alpha*x[ix] + y[iy]
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// idst += incDst
|
||||
// }
|
||||
func AxpyIncTo(dst []complex128, incDst, idst uintptr, alpha complex128, x, y []complex128, n, incX, incY, ix, iy uintptr)
|
||||
|
||||
// DscalUnitary is
|
||||
// for i, v := range x {
|
||||
// x[i] = complex(real(v)*alpha, imag(v)*alpha)
|
||||
// }
|
||||
//
|
||||
// for i, v := range x {
|
||||
// x[i] = complex(real(v)*alpha, imag(v)*alpha)
|
||||
// }
|
||||
func DscalUnitary(alpha float64, x []complex128)
|
||||
|
||||
// DscalInc is
|
||||
// var ix uintptr
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// x[ix] = complex(real(x[ix])*alpha, imag(x[ix])*alpha)
|
||||
// ix += inc
|
||||
// }
|
||||
//
|
||||
// var ix uintptr
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// x[ix] = complex(real(x[ix])*alpha, imag(x[ix])*alpha)
|
||||
// ix += inc
|
||||
// }
|
||||
func DscalInc(alpha float64, x []complex128, n, inc uintptr)
|
||||
|
||||
// ScalInc is
|
||||
// var ix uintptr
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// x[ix] *= alpha
|
||||
// ix += incX
|
||||
// }
|
||||
//
|
||||
// var ix uintptr
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// x[ix] *= alpha
|
||||
// ix += incX
|
||||
// }
|
||||
func ScalInc(alpha complex128, x []complex128, n, inc uintptr)
|
||||
|
||||
// ScalUnitary is
|
||||
// for i := range x {
|
||||
// x[i] *= alpha
|
||||
// }
|
||||
//
|
||||
// for i := range x {
|
||||
// x[i] *= alpha
|
||||
// }
|
||||
func ScalUnitary(alpha complex128, x []complex128)
|
||||
|
||||
// DotcUnitary is
|
||||
// for i, v := range x {
|
||||
// sum += y[i] * cmplx.Conj(v)
|
||||
// }
|
||||
// return sum
|
||||
//
|
||||
// for i, v := range x {
|
||||
// sum += y[i] * cmplx.Conj(v)
|
||||
// }
|
||||
// return sum
|
||||
func DotcUnitary(x, y []complex128) (sum complex128)
|
||||
|
||||
// DotcInc is
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// sum += y[iy] * cmplx.Conj(x[ix])
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
// return sum
|
||||
//
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// sum += y[iy] * cmplx.Conj(x[ix])
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
// return sum
|
||||
func DotcInc(x, y []complex128, n, incX, incY, ix, iy uintptr) (sum complex128)
|
||||
|
||||
// DotuUnitary is
|
||||
// for i, v := range x {
|
||||
// sum += y[i] * v
|
||||
// }
|
||||
// return sum
|
||||
//
|
||||
// for i, v := range x {
|
||||
// sum += y[i] * v
|
||||
// }
|
||||
// return sum
|
||||
func DotuUnitary(x, y []complex128) (sum complex128)
|
||||
|
||||
// DotuInc is
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// sum += y[iy] * x[ix]
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
// return sum
|
||||
//
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// sum += y[iy] * x[ix]
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
// return sum
|
||||
func DotuInc(x, y []complex128, n, incX, incY, ix, iy uintptr) (sum complex128)
|
||||
|
@@ -10,9 +10,10 @@ package c128
|
||||
import "math/cmplx"
|
||||
|
||||
// AxpyUnitary is
|
||||
// for i, v := range x {
|
||||
// y[i] += alpha * v
|
||||
// }
|
||||
//
|
||||
// for i, v := range x {
|
||||
// y[i] += alpha * v
|
||||
// }
|
||||
func AxpyUnitary(alpha complex128, x, y []complex128) {
|
||||
for i, v := range x {
|
||||
y[i] += alpha * v
|
||||
@@ -20,9 +21,10 @@ func AxpyUnitary(alpha complex128, x, y []complex128) {
|
||||
}
|
||||
|
||||
// AxpyUnitaryTo is
|
||||
// for i, v := range x {
|
||||
// dst[i] = alpha*v + y[i]
|
||||
// }
|
||||
//
|
||||
// for i, v := range x {
|
||||
// dst[i] = alpha*v + y[i]
|
||||
// }
|
||||
func AxpyUnitaryTo(dst []complex128, alpha complex128, x, y []complex128) {
|
||||
for i, v := range x {
|
||||
dst[i] = alpha*v + y[i]
|
||||
@@ -30,11 +32,12 @@ func AxpyUnitaryTo(dst []complex128, alpha complex128, x, y []complex128) {
|
||||
}
|
||||
|
||||
// AxpyInc is
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// y[iy] += alpha * x[ix]
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
//
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// y[iy] += alpha * x[ix]
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
func AxpyInc(alpha complex128, x, y []complex128, n, incX, incY, ix, iy uintptr) {
|
||||
for i := 0; i < int(n); i++ {
|
||||
y[iy] += alpha * x[ix]
|
||||
@@ -44,12 +47,13 @@ func AxpyInc(alpha complex128, x, y []complex128, 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
|
||||
// }
|
||||
//
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// dst[idst] = alpha*x[ix] + y[iy]
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// idst += incDst
|
||||
// }
|
||||
func AxpyIncTo(dst []complex128, incDst, idst uintptr, alpha complex128, x, y []complex128, n, incX, incY, ix, iy uintptr) {
|
||||
for i := 0; i < int(n); i++ {
|
||||
dst[idst] = alpha*x[ix] + y[iy]
|
||||
@@ -60,9 +64,10 @@ func AxpyIncTo(dst []complex128, incDst, idst uintptr, alpha complex128, x, y []
|
||||
}
|
||||
|
||||
// DscalUnitary is
|
||||
// for i, v := range x {
|
||||
// x[i] = complex(real(v)*alpha, imag(v)*alpha)
|
||||
// }
|
||||
//
|
||||
// for i, v := range x {
|
||||
// x[i] = complex(real(v)*alpha, imag(v)*alpha)
|
||||
// }
|
||||
func DscalUnitary(alpha float64, x []complex128) {
|
||||
for i, v := range x {
|
||||
x[i] = complex(real(v)*alpha, imag(v)*alpha)
|
||||
@@ -70,11 +75,12 @@ func DscalUnitary(alpha float64, x []complex128) {
|
||||
}
|
||||
|
||||
// DscalInc is
|
||||
// var ix uintptr
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// x[ix] = complex(real(x[ix])*alpha, imag(x[ix])*alpha)
|
||||
// ix += inc
|
||||
// }
|
||||
//
|
||||
// var ix uintptr
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// x[ix] = complex(real(x[ix])*alpha, imag(x[ix])*alpha)
|
||||
// ix += inc
|
||||
// }
|
||||
func DscalInc(alpha float64, x []complex128, n, inc uintptr) {
|
||||
var ix uintptr
|
||||
for i := 0; i < int(n); i++ {
|
||||
@@ -84,11 +90,12 @@ func DscalInc(alpha float64, x []complex128, n, inc uintptr) {
|
||||
}
|
||||
|
||||
// ScalInc is
|
||||
// var ix uintptr
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// x[ix] *= alpha
|
||||
// ix += incX
|
||||
// }
|
||||
//
|
||||
// var ix uintptr
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// x[ix] *= alpha
|
||||
// ix += incX
|
||||
// }
|
||||
func ScalInc(alpha complex128, x []complex128, n, inc uintptr) {
|
||||
var ix uintptr
|
||||
for i := 0; i < int(n); i++ {
|
||||
@@ -98,9 +105,10 @@ func ScalInc(alpha complex128, x []complex128, n, inc uintptr) {
|
||||
}
|
||||
|
||||
// ScalUnitary is
|
||||
// for i := range x {
|
||||
// x[i] *= alpha
|
||||
// }
|
||||
//
|
||||
// for i := range x {
|
||||
// x[i] *= alpha
|
||||
// }
|
||||
func ScalUnitary(alpha complex128, x []complex128) {
|
||||
for i := range x {
|
||||
x[i] *= alpha
|
||||
@@ -108,10 +116,11 @@ func ScalUnitary(alpha complex128, x []complex128) {
|
||||
}
|
||||
|
||||
// DotcUnitary is
|
||||
// for i, v := range x {
|
||||
// sum += y[i] * cmplx.Conj(v)
|
||||
// }
|
||||
// return sum
|
||||
//
|
||||
// for i, v := range x {
|
||||
// sum += y[i] * cmplx.Conj(v)
|
||||
// }
|
||||
// return sum
|
||||
func DotcUnitary(x, y []complex128) (sum complex128) {
|
||||
for i, v := range x {
|
||||
sum += y[i] * cmplx.Conj(v)
|
||||
@@ -120,12 +129,13 @@ func DotcUnitary(x, y []complex128) (sum complex128) {
|
||||
}
|
||||
|
||||
// DotcInc is
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// sum += y[iy] * cmplx.Conj(x[ix])
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
// return sum
|
||||
//
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// sum += y[iy] * cmplx.Conj(x[ix])
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
// return sum
|
||||
func DotcInc(x, y []complex128, n, incX, incY, ix, iy uintptr) (sum complex128) {
|
||||
for i := 0; i < int(n); i++ {
|
||||
sum += y[iy] * cmplx.Conj(x[ix])
|
||||
@@ -136,10 +146,11 @@ func DotcInc(x, y []complex128, n, incX, incY, ix, iy uintptr) (sum complex128)
|
||||
}
|
||||
|
||||
// DotuUnitary is
|
||||
// for i, v := range x {
|
||||
// sum += y[i] * v
|
||||
// }
|
||||
// return sum
|
||||
//
|
||||
// for i, v := range x {
|
||||
// sum += y[i] * v
|
||||
// }
|
||||
// return sum
|
||||
func DotuUnitary(x, y []complex128) (sum complex128) {
|
||||
for i, v := range x {
|
||||
sum += y[i] * v
|
||||
@@ -148,12 +159,13 @@ func DotuUnitary(x, y []complex128) (sum complex128) {
|
||||
}
|
||||
|
||||
// DotuInc is
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// sum += y[iy] * x[ix]
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
// return sum
|
||||
//
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// sum += y[iy] * x[ix]
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
// return sum
|
||||
func DotuInc(x, y []complex128, n, incX, incY, ix, iy uintptr) (sum complex128) {
|
||||
for i := 0; i < int(n); i++ {
|
||||
sum += y[iy] * x[ix]
|
||||
|
@@ -5,9 +5,10 @@
|
||||
package c64
|
||||
|
||||
// ScalUnitary is
|
||||
// for i := range x {
|
||||
// x[i] *= alpha
|
||||
// }
|
||||
//
|
||||
// for i := range x {
|
||||
// x[i] *= alpha
|
||||
// }
|
||||
func ScalUnitary(alpha complex64, x []complex64) {
|
||||
for i := range x {
|
||||
x[i] *= alpha
|
||||
@@ -15,9 +16,10 @@ func ScalUnitary(alpha complex64, x []complex64) {
|
||||
}
|
||||
|
||||
// ScalUnitaryTo is
|
||||
// for i, v := range x {
|
||||
// dst[i] = alpha * v
|
||||
// }
|
||||
//
|
||||
// for i, v := range x {
|
||||
// dst[i] = alpha * v
|
||||
// }
|
||||
func ScalUnitaryTo(dst []complex64, alpha complex64, x []complex64) {
|
||||
for i, v := range x {
|
||||
dst[i] = alpha * v
|
||||
@@ -25,11 +27,12 @@ func ScalUnitaryTo(dst []complex64, alpha complex64, x []complex64) {
|
||||
}
|
||||
|
||||
// ScalInc is
|
||||
// var ix uintptr
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// x[ix] *= alpha
|
||||
// ix += incX
|
||||
// }
|
||||
//
|
||||
// var ix uintptr
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// x[ix] *= alpha
|
||||
// ix += incX
|
||||
// }
|
||||
func ScalInc(alpha complex64, x []complex64, n, incX uintptr) {
|
||||
var ix uintptr
|
||||
for i := 0; i < int(n); i++ {
|
||||
@@ -39,12 +42,13 @@ func ScalInc(alpha complex64, x []complex64, 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
|
||||
// }
|
||||
//
|
||||
// var idst, ix uintptr
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// dst[idst] = alpha * x[ix]
|
||||
// ix += incX
|
||||
// idst += incDst
|
||||
// }
|
||||
func ScalIncTo(dst []complex64, incDst uintptr, alpha complex64, x []complex64, n, incX uintptr) {
|
||||
var idst, ix uintptr
|
||||
for i := 0; i < int(n); i++ {
|
||||
@@ -55,9 +59,10 @@ func ScalIncTo(dst []complex64, incDst uintptr, alpha complex64, x []complex64,
|
||||
}
|
||||
|
||||
// SscalUnitary is
|
||||
// for i, v := range x {
|
||||
// x[i] = complex(real(v)*alpha, imag(v)*alpha)
|
||||
// }
|
||||
//
|
||||
// for i, v := range x {
|
||||
// x[i] = complex(real(v)*alpha, imag(v)*alpha)
|
||||
// }
|
||||
func SscalUnitary(alpha float32, x []complex64) {
|
||||
for i, v := range x {
|
||||
x[i] = complex(real(v)*alpha, imag(v)*alpha)
|
||||
@@ -65,11 +70,12 @@ func SscalUnitary(alpha float32, x []complex64) {
|
||||
}
|
||||
|
||||
// SscalInc is
|
||||
// var ix uintptr
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// x[ix] = complex(real(x[ix])*alpha, imag(x[ix])*alpha)
|
||||
// ix += inc
|
||||
// }
|
||||
//
|
||||
// var ix uintptr
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// x[ix] = complex(real(x[ix])*alpha, imag(x[ix])*alpha)
|
||||
// ix += inc
|
||||
// }
|
||||
func SscalInc(alpha float32, x []complex64, n, inc uintptr) {
|
||||
var ix uintptr
|
||||
for i := 0; i < int(n); i++ {
|
||||
|
@@ -10,9 +10,10 @@ import (
|
||||
)
|
||||
|
||||
// Add is
|
||||
// for i, v := range s {
|
||||
// dst[i] += v
|
||||
// }
|
||||
//
|
||||
// for i, v := range s {
|
||||
// dst[i] += v
|
||||
// }
|
||||
func Add(dst, s []complex64) {
|
||||
for i, v := range s {
|
||||
dst[i] += v
|
||||
@@ -20,9 +21,10 @@ func Add(dst, s []complex64) {
|
||||
}
|
||||
|
||||
// AddConst is
|
||||
// for i := range x {
|
||||
// x[i] += alpha
|
||||
// }
|
||||
//
|
||||
// for i := range x {
|
||||
// x[i] += alpha
|
||||
// }
|
||||
func AddConst(alpha complex64, x []complex64) {
|
||||
for i := range x {
|
||||
x[i] += alpha
|
||||
@@ -30,14 +32,15 @@ func AddConst(alpha complex64, x []complex64) {
|
||||
}
|
||||
|
||||
// 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
|
||||
//
|
||||
// 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(dst, s []complex64) []complex64 {
|
||||
if len(s) == 0 {
|
||||
return dst
|
||||
@@ -50,14 +53,15 @@ func CumSum(dst, s []complex64) []complex64 {
|
||||
}
|
||||
|
||||
// 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
|
||||
//
|
||||
// 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 CumProd(dst, s []complex64) []complex64 {
|
||||
if len(s) == 0 {
|
||||
return dst
|
||||
@@ -70,9 +74,10 @@ func CumProd(dst, s []complex64) []complex64 {
|
||||
}
|
||||
|
||||
// Div is
|
||||
// for i, v := range s {
|
||||
// dst[i] /= v
|
||||
// }
|
||||
//
|
||||
// for i, v := range s {
|
||||
// dst[i] /= v
|
||||
// }
|
||||
func Div(dst, s []complex64) {
|
||||
for i, v := range s {
|
||||
dst[i] /= v
|
||||
@@ -80,10 +85,11 @@ func Div(dst, s []complex64) {
|
||||
}
|
||||
|
||||
// DivTo is
|
||||
// for i, v := range s {
|
||||
// dst[i] = v / t[i]
|
||||
// }
|
||||
// return dst
|
||||
//
|
||||
// for i, v := range s {
|
||||
// dst[i] = v / t[i]
|
||||
// }
|
||||
// return dst
|
||||
func DivTo(dst, s, t []complex64) []complex64 {
|
||||
for i, v := range s {
|
||||
dst[i] = v / t[i]
|
||||
@@ -92,10 +98,11 @@ func DivTo(dst, s, t []complex64) []complex64 {
|
||||
}
|
||||
|
||||
// DotUnitary is
|
||||
// for i, v := range x {
|
||||
// sum += conj(v) * y[i]
|
||||
// }
|
||||
// return sum
|
||||
//
|
||||
// for i, v := range x {
|
||||
// sum += conj(v) * y[i]
|
||||
// }
|
||||
// return sum
|
||||
func DotUnitary(x, y []complex64) (sum complex64) {
|
||||
for i, v := range x {
|
||||
sum += cmplx64.Conj(v) * y[i]
|
||||
@@ -159,10 +166,11 @@ func L2NormUnitary(x []complex64) (norm float32) {
|
||||
}
|
||||
|
||||
// Sum is
|
||||
// var sum complex64
|
||||
// for i := range x {
|
||||
// sum += x[i]
|
||||
// }
|
||||
//
|
||||
// var sum complex64
|
||||
// for i := range x {
|
||||
// sum += x[i]
|
||||
// }
|
||||
func Sum(x []complex64) complex64 {
|
||||
var sum complex64
|
||||
for _, v := range x {
|
||||
|
@@ -8,62 +8,70 @@
|
||||
package c64
|
||||
|
||||
// AxpyUnitary is
|
||||
// for i, v := range x {
|
||||
// y[i] += alpha * v
|
||||
// }
|
||||
//
|
||||
// for i, v := range x {
|
||||
// y[i] += alpha * v
|
||||
// }
|
||||
func AxpyUnitary(alpha complex64, x, y []complex64)
|
||||
|
||||
// AxpyUnitaryTo is
|
||||
// for i, v := range x {
|
||||
// dst[i] = alpha*v + y[i]
|
||||
// }
|
||||
//
|
||||
// for i, v := range x {
|
||||
// dst[i] = alpha*v + y[i]
|
||||
// }
|
||||
func AxpyUnitaryTo(dst []complex64, alpha complex64, x, y []complex64)
|
||||
|
||||
// AxpyInc is
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// y[iy] += alpha * x[ix]
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
//
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// y[iy] += alpha * x[ix]
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
func AxpyInc(alpha complex64, x, y []complex64, 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
|
||||
// }
|
||||
//
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// dst[idst] = alpha*x[ix] + y[iy]
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// idst += incDst
|
||||
// }
|
||||
func AxpyIncTo(dst []complex64, incDst, idst uintptr, alpha complex64, x, y []complex64, n, incX, incY, ix, iy uintptr)
|
||||
|
||||
// DotcUnitary is
|
||||
// for i, v := range x {
|
||||
// sum += y[i] * conj(v)
|
||||
// }
|
||||
// return sum
|
||||
//
|
||||
// for i, v := range x {
|
||||
// sum += y[i] * conj(v)
|
||||
// }
|
||||
// return sum
|
||||
func DotcUnitary(x, y []complex64) (sum complex64)
|
||||
|
||||
// DotcInc is
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// sum += y[iy] * conj(x[ix])
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
// return sum
|
||||
//
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// sum += y[iy] * conj(x[ix])
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
// return sum
|
||||
func DotcInc(x, y []complex64, n, incX, incY, ix, iy uintptr) (sum complex64)
|
||||
|
||||
// DotuUnitary is
|
||||
// for i, v := range x {
|
||||
// sum += y[i] * v
|
||||
// }
|
||||
// return sum
|
||||
//
|
||||
// for i, v := range x {
|
||||
// sum += y[i] * v
|
||||
// }
|
||||
// return sum
|
||||
func DotuUnitary(x, y []complex64) (sum complex64)
|
||||
|
||||
// DotuInc is
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// sum += y[iy] * x[ix]
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
// return sum
|
||||
//
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// sum += y[iy] * x[ix]
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
// return sum
|
||||
func DotuInc(x, y []complex64, n, incX, incY, ix, iy uintptr) (sum complex64)
|
||||
|
@@ -8,9 +8,10 @@
|
||||
package c64
|
||||
|
||||
// AxpyUnitary is
|
||||
// for i, v := range x {
|
||||
// y[i] += alpha * v
|
||||
// }
|
||||
//
|
||||
// for i, v := range x {
|
||||
// y[i] += alpha * v
|
||||
// }
|
||||
func AxpyUnitary(alpha complex64, x, y []complex64) {
|
||||
for i, v := range x {
|
||||
y[i] += alpha * v
|
||||
@@ -18,9 +19,10 @@ func AxpyUnitary(alpha complex64, x, y []complex64) {
|
||||
}
|
||||
|
||||
// AxpyUnitaryTo is
|
||||
// for i, v := range x {
|
||||
// dst[i] = alpha*v + y[i]
|
||||
// }
|
||||
//
|
||||
// for i, v := range x {
|
||||
// dst[i] = alpha*v + y[i]
|
||||
// }
|
||||
func AxpyUnitaryTo(dst []complex64, alpha complex64, x, y []complex64) {
|
||||
for i, v := range x {
|
||||
dst[i] = alpha*v + y[i]
|
||||
@@ -28,11 +30,12 @@ func AxpyUnitaryTo(dst []complex64, alpha complex64, x, y []complex64) {
|
||||
}
|
||||
|
||||
// AxpyInc is
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// y[iy] += alpha * x[ix]
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
//
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// y[iy] += alpha * x[ix]
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
func AxpyInc(alpha complex64, x, y []complex64, n, incX, incY, ix, iy uintptr) {
|
||||
for i := 0; i < int(n); i++ {
|
||||
y[iy] += alpha * x[ix]
|
||||
@@ -42,12 +45,13 @@ func AxpyInc(alpha complex64, x, y []complex64, 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
|
||||
// }
|
||||
//
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// dst[idst] = alpha*x[ix] + y[iy]
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// idst += incDst
|
||||
// }
|
||||
func AxpyIncTo(dst []complex64, incDst, idst uintptr, alpha complex64, x, y []complex64, n, incX, incY, ix, iy uintptr) {
|
||||
for i := 0; i < int(n); i++ {
|
||||
dst[idst] = alpha*x[ix] + y[iy]
|
||||
@@ -58,10 +62,11 @@ func AxpyIncTo(dst []complex64, incDst, idst uintptr, alpha complex64, x, y []co
|
||||
}
|
||||
|
||||
// DotcUnitary is
|
||||
// for i, v := range x {
|
||||
// sum += y[i] * conj(v)
|
||||
// }
|
||||
// return sum
|
||||
//
|
||||
// for i, v := range x {
|
||||
// sum += y[i] * conj(v)
|
||||
// }
|
||||
// return sum
|
||||
func DotcUnitary(x, y []complex64) (sum complex64) {
|
||||
for i, v := range x {
|
||||
sum += y[i] * conj(v)
|
||||
@@ -70,12 +75,13 @@ func DotcUnitary(x, y []complex64) (sum complex64) {
|
||||
}
|
||||
|
||||
// DotcInc is
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// sum += y[iy] * conj(x[ix])
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
// return sum
|
||||
//
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// sum += y[iy] * conj(x[ix])
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
// return sum
|
||||
func DotcInc(x, y []complex64, n, incX, incY, ix, iy uintptr) (sum complex64) {
|
||||
for i := 0; i < int(n); i++ {
|
||||
sum += y[iy] * conj(x[ix])
|
||||
@@ -86,10 +92,11 @@ func DotcInc(x, y []complex64, n, incX, incY, ix, iy uintptr) (sum complex64) {
|
||||
}
|
||||
|
||||
// DotuUnitary is
|
||||
// for i, v := range x {
|
||||
// sum += y[i] * v
|
||||
// }
|
||||
// return sum
|
||||
//
|
||||
// for i, v := range x {
|
||||
// sum += y[i] * v
|
||||
// }
|
||||
// return sum
|
||||
func DotuUnitary(x, y []complex64) (sum complex64) {
|
||||
for i, v := range x {
|
||||
sum += y[i] * v
|
||||
@@ -98,12 +105,13 @@ func DotuUnitary(x, y []complex64) (sum complex64) {
|
||||
}
|
||||
|
||||
// DotuInc is
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// sum += y[iy] * x[ix]
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
// return sum
|
||||
//
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// sum += y[iy] * x[ix]
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
// return sum
|
||||
func DotuInc(x, y []complex64, n, incX, incY, ix, iy uintptr) (sum complex64) {
|
||||
for i := 0; i < int(n); i++ {
|
||||
sum += y[iy] * x[ix]
|
||||
|
@@ -8,7 +8,9 @@
|
||||
package f32
|
||||
|
||||
// Ger performs the rank-one operation
|
||||
// A += alpha * x * yᵀ
|
||||
//
|
||||
// A += alpha * x * yᵀ
|
||||
//
|
||||
// where A is an m×n dense matrix, x and y are vectors, and alpha is a scalar.
|
||||
func Ger(m, n uintptr, alpha float32,
|
||||
x []float32, incX uintptr,
|
||||
|
@@ -8,7 +8,9 @@
|
||||
package f32
|
||||
|
||||
// Ger performs the rank-one operation
|
||||
// A += alpha * x * yᵀ
|
||||
//
|
||||
// A += alpha * x * yᵀ
|
||||
//
|
||||
// where A is an m×n dense matrix, x and y are vectors, and alpha is a scalar.
|
||||
func Ger(m, n uintptr, alpha float32, x []float32, incX uintptr, y []float32, incY uintptr, a []float32, lda uintptr) {
|
||||
|
||||
|
@@ -5,7 +5,9 @@
|
||||
package f32
|
||||
|
||||
// GemvN computes
|
||||
// y = alpha * A * x + beta * y
|
||||
//
|
||||
// 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 GemvN(m, n uintptr, alpha float32, a []float32, lda uintptr, x []float32, incX uintptr, beta float32, y []float32, incY uintptr) {
|
||||
var kx, ky, i uintptr
|
||||
@@ -43,7 +45,9 @@ func GemvN(m, n uintptr, alpha float32, a []float32, lda uintptr, x []float32, i
|
||||
}
|
||||
|
||||
// GemvT computes
|
||||
// y = alpha * Aᵀ * x + beta * y
|
||||
//
|
||||
// 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(m, n uintptr, alpha float32, a []float32, lda uintptr, x []float32, incX uintptr, beta float32, y []float32, incY uintptr) {
|
||||
var kx, ky, i uintptr
|
||||
|
@@ -5,9 +5,10 @@
|
||||
package f32
|
||||
|
||||
// ScalUnitary is
|
||||
// for i := range x {
|
||||
// x[i] *= alpha
|
||||
// }
|
||||
//
|
||||
// for i := range x {
|
||||
// x[i] *= alpha
|
||||
// }
|
||||
func ScalUnitary(alpha float32, x []float32) {
|
||||
for i := range x {
|
||||
x[i] *= alpha
|
||||
@@ -15,9 +16,10 @@ func ScalUnitary(alpha float32, x []float32) {
|
||||
}
|
||||
|
||||
// ScalUnitaryTo is
|
||||
// for i, v := range x {
|
||||
// dst[i] = alpha * v
|
||||
// }
|
||||
//
|
||||
// for i, v := range x {
|
||||
// dst[i] = alpha * v
|
||||
// }
|
||||
func ScalUnitaryTo(dst []float32, alpha float32, x []float32) {
|
||||
for i, v := range x {
|
||||
dst[i] = alpha * v
|
||||
@@ -25,11 +27,12 @@ func ScalUnitaryTo(dst []float32, alpha float32, x []float32) {
|
||||
}
|
||||
|
||||
// ScalInc is
|
||||
// var ix uintptr
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// x[ix] *= alpha
|
||||
// ix += incX
|
||||
// }
|
||||
//
|
||||
// var ix uintptr
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// x[ix] *= alpha
|
||||
// ix += incX
|
||||
// }
|
||||
func ScalInc(alpha float32, x []float32, n, incX uintptr) {
|
||||
var ix uintptr
|
||||
for i := 0; i < int(n); i++ {
|
||||
@@ -39,12 +42,13 @@ func ScalInc(alpha float32, x []float32, 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
|
||||
// }
|
||||
//
|
||||
// var idst, ix uintptr
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// dst[idst] = alpha * x[ix]
|
||||
// ix += incX
|
||||
// idst += incDst
|
||||
// }
|
||||
func ScalIncTo(dst []float32, incDst uintptr, alpha float32, x []float32, n, incX uintptr) {
|
||||
var idst, ix uintptr
|
||||
for i := 0; i < int(n); i++ {
|
||||
|
@@ -8,70 +8,79 @@
|
||||
package f32
|
||||
|
||||
// AxpyUnitary is
|
||||
// for i, v := range x {
|
||||
// y[i] += alpha * v
|
||||
// }
|
||||
//
|
||||
// for i, v := range x {
|
||||
// y[i] += alpha * v
|
||||
// }
|
||||
func AxpyUnitary(alpha float32, x, y []float32)
|
||||
|
||||
// AxpyUnitaryTo is
|
||||
// for i, v := range x {
|
||||
// dst[i] = alpha*v + y[i]
|
||||
// }
|
||||
//
|
||||
// for i, v := range x {
|
||||
// dst[i] = alpha*v + y[i]
|
||||
// }
|
||||
func AxpyUnitaryTo(dst []float32, alpha float32, x, y []float32)
|
||||
|
||||
// AxpyInc is
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// y[iy] += alpha * x[ix]
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
//
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// y[iy] += alpha * x[ix]
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
func AxpyInc(alpha float32, x, y []float32, 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
|
||||
// }
|
||||
//
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// dst[idst] = alpha*x[ix] + y[iy]
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// idst += incDst
|
||||
// }
|
||||
func AxpyIncTo(dst []float32, incDst, idst uintptr, alpha float32, x, y []float32, n, incX, incY, ix, iy uintptr)
|
||||
|
||||
// DdotUnitary is
|
||||
// for i, v := range x {
|
||||
// sum += float64(y[i]) * float64(v)
|
||||
// }
|
||||
// return
|
||||
//
|
||||
// for i, v := range x {
|
||||
// sum += float64(y[i]) * float64(v)
|
||||
// }
|
||||
// return
|
||||
func DdotUnitary(x, y []float32) (sum float64)
|
||||
|
||||
// DdotInc is
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// sum += float64(y[iy]) * float64(x[ix])
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
// return
|
||||
//
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// sum += float64(y[iy]) * float64(x[ix])
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
// return
|
||||
func DdotInc(x, y []float32, n, incX, incY, ix, iy uintptr) (sum float64)
|
||||
|
||||
// DotUnitary is
|
||||
// for i, v := range x {
|
||||
// sum += y[i] * v
|
||||
// }
|
||||
// return sum
|
||||
//
|
||||
// for i, v := range x {
|
||||
// sum += y[i] * v
|
||||
// }
|
||||
// return sum
|
||||
func DotUnitary(x, y []float32) (sum float32)
|
||||
|
||||
// DotInc is
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// sum += y[iy] * x[ix]
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
// return sum
|
||||
//
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// sum += y[iy] * x[ix]
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
// return sum
|
||||
func DotInc(x, y []float32, n, incX, incY, ix, iy uintptr) (sum float32)
|
||||
|
||||
// Sum is
|
||||
// var sum float32
|
||||
// for _, v := range x {
|
||||
// sum += v
|
||||
// }
|
||||
// return sum
|
||||
//
|
||||
// var sum float32
|
||||
// for _, v := range x {
|
||||
// sum += v
|
||||
// }
|
||||
// return sum
|
||||
func Sum(x []float32) float32
|
||||
|
@@ -8,9 +8,10 @@
|
||||
package f32
|
||||
|
||||
// AxpyUnitary is
|
||||
// for i, v := range x {
|
||||
// y[i] += alpha * v
|
||||
// }
|
||||
//
|
||||
// for i, v := range x {
|
||||
// y[i] += alpha * v
|
||||
// }
|
||||
func AxpyUnitary(alpha float32, x, y []float32) {
|
||||
for i, v := range x {
|
||||
y[i] += alpha * v
|
||||
@@ -18,9 +19,10 @@ func AxpyUnitary(alpha float32, x, y []float32) {
|
||||
}
|
||||
|
||||
// AxpyUnitaryTo is
|
||||
// for i, v := range x {
|
||||
// dst[i] = alpha*v + y[i]
|
||||
// }
|
||||
//
|
||||
// for i, v := range x {
|
||||
// dst[i] = alpha*v + y[i]
|
||||
// }
|
||||
func AxpyUnitaryTo(dst []float32, alpha float32, x, y []float32) {
|
||||
for i, v := range x {
|
||||
dst[i] = alpha*v + y[i]
|
||||
@@ -28,11 +30,12 @@ func AxpyUnitaryTo(dst []float32, alpha float32, x, y []float32) {
|
||||
}
|
||||
|
||||
// AxpyInc is
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// y[iy] += alpha * x[ix]
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
//
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// y[iy] += alpha * x[ix]
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
func AxpyInc(alpha float32, x, y []float32, n, incX, incY, ix, iy uintptr) {
|
||||
for i := 0; i < int(n); i++ {
|
||||
y[iy] += alpha * x[ix]
|
||||
@@ -42,12 +45,13 @@ func AxpyInc(alpha float32, x, y []float32, 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
|
||||
// }
|
||||
//
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// dst[idst] = alpha*x[ix] + y[iy]
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// idst += incDst
|
||||
// }
|
||||
func AxpyIncTo(dst []float32, incDst, idst uintptr, alpha float32, x, y []float32, n, incX, incY, ix, iy uintptr) {
|
||||
for i := 0; i < int(n); i++ {
|
||||
dst[idst] = alpha*x[ix] + y[iy]
|
||||
@@ -58,10 +62,11 @@ func AxpyIncTo(dst []float32, incDst, idst uintptr, alpha float32, x, y []float3
|
||||
}
|
||||
|
||||
// DotUnitary is
|
||||
// for i, v := range x {
|
||||
// sum += y[i] * v
|
||||
// }
|
||||
// return sum
|
||||
//
|
||||
// for i, v := range x {
|
||||
// sum += y[i] * v
|
||||
// }
|
||||
// return sum
|
||||
func DotUnitary(x, y []float32) (sum float32) {
|
||||
for i, v := range x {
|
||||
sum += y[i] * v
|
||||
@@ -70,12 +75,13 @@ func DotUnitary(x, y []float32) (sum float32) {
|
||||
}
|
||||
|
||||
// DotInc is
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// sum += y[iy] * x[ix]
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
// return sum
|
||||
//
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// sum += y[iy] * x[ix]
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
// return sum
|
||||
func DotInc(x, y []float32, n, incX, incY, ix, iy uintptr) (sum float32) {
|
||||
for i := 0; i < int(n); i++ {
|
||||
sum += y[iy] * x[ix]
|
||||
@@ -86,10 +92,11 @@ func DotInc(x, y []float32, n, incX, incY, ix, iy uintptr) (sum float32) {
|
||||
}
|
||||
|
||||
// DdotUnitary is
|
||||
// for i, v := range x {
|
||||
// sum += float64(y[i]) * float64(v)
|
||||
// }
|
||||
// return
|
||||
//
|
||||
// for i, v := range x {
|
||||
// sum += float64(y[i]) * float64(v)
|
||||
// }
|
||||
// return
|
||||
func DdotUnitary(x, y []float32) (sum float64) {
|
||||
for i, v := range x {
|
||||
sum += float64(y[i]) * float64(v)
|
||||
@@ -98,12 +105,13 @@ func DdotUnitary(x, y []float32) (sum float64) {
|
||||
}
|
||||
|
||||
// DdotInc is
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// sum += float64(y[iy]) * float64(x[ix])
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
// return
|
||||
//
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// sum += float64(y[iy]) * float64(x[ix])
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
// return
|
||||
func DdotInc(x, y []float32, n, incX, incY, ix, iy uintptr) (sum float64) {
|
||||
for i := 0; i < int(n); i++ {
|
||||
sum += float64(y[iy]) * float64(x[ix])
|
||||
@@ -114,11 +122,12 @@ func DdotInc(x, y []float32, n, incX, incY, ix, iy uintptr) (sum float64) {
|
||||
}
|
||||
|
||||
// Sum is
|
||||
// var sum float32
|
||||
// for _, v := range x {
|
||||
// sum += v
|
||||
// }
|
||||
// return sum
|
||||
//
|
||||
// var sum float32
|
||||
// for _, v := range x {
|
||||
// sum += v
|
||||
// }
|
||||
// return sum
|
||||
func Sum(x []float32) float32 {
|
||||
var sum float32
|
||||
for _, v := range x {
|
||||
|
@@ -8,9 +8,10 @@
|
||||
package f64
|
||||
|
||||
// AxpyUnitary is
|
||||
// for i, v := range x {
|
||||
// y[i] += alpha * v
|
||||
// }
|
||||
//
|
||||
// for i, v := range x {
|
||||
// y[i] += alpha * v
|
||||
// }
|
||||
func AxpyUnitary(alpha float64, x, y []float64) {
|
||||
for i, v := range x {
|
||||
y[i] += alpha * v
|
||||
@@ -18,9 +19,10 @@ func AxpyUnitary(alpha float64, x, y []float64) {
|
||||
}
|
||||
|
||||
// AxpyUnitaryTo is
|
||||
// for i, v := range x {
|
||||
// dst[i] = alpha*v + y[i]
|
||||
// }
|
||||
//
|
||||
// for i, v := range x {
|
||||
// dst[i] = alpha*v + y[i]
|
||||
// }
|
||||
func AxpyUnitaryTo(dst []float64, alpha float64, x, y []float64) {
|
||||
for i, v := range x {
|
||||
dst[i] = alpha*v + y[i]
|
||||
@@ -28,11 +30,12 @@ func AxpyUnitaryTo(dst []float64, alpha float64, x, y []float64) {
|
||||
}
|
||||
|
||||
// AxpyInc is
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// y[iy] += alpha * x[ix]
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
//
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// y[iy] += alpha * x[ix]
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
func AxpyInc(alpha float64, x, y []float64, n, incX, incY, ix, iy uintptr) {
|
||||
for i := 0; i < int(n); i++ {
|
||||
y[iy] += alpha * x[ix]
|
||||
@@ -42,12 +45,13 @@ func AxpyInc(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
|
||||
// }
|
||||
//
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// dst[idst] = alpha*x[ix] + y[iy]
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// idst += incDst
|
||||
// }
|
||||
func AxpyIncTo(dst []float64, incDst, idst uintptr, alpha float64, x, y []float64, n, incX, incY, ix, iy uintptr) {
|
||||
for i := 0; i < int(n); i++ {
|
||||
dst[idst] = alpha*x[ix] + y[iy]
|
||||
|
@@ -8,10 +8,11 @@
|
||||
package f64
|
||||
|
||||
// DotUnitary is
|
||||
// for i, v := range x {
|
||||
// sum += y[i] * v
|
||||
// }
|
||||
// return sum
|
||||
//
|
||||
// for i, v := range x {
|
||||
// sum += y[i] * v
|
||||
// }
|
||||
// return sum
|
||||
func DotUnitary(x, y []float64) (sum float64) {
|
||||
for i, v := range x {
|
||||
sum += y[i] * v
|
||||
@@ -20,12 +21,13 @@ func DotUnitary(x, y []float64) (sum float64) {
|
||||
}
|
||||
|
||||
// DotInc is
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// sum += y[iy] * x[ix]
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
// return sum
|
||||
//
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// sum += y[iy] * x[ix]
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
// return sum
|
||||
func DotInc(x, y []float64, n, incX, incY, ix, iy uintptr) (sum float64) {
|
||||
for i := 0; i < int(n); i++ {
|
||||
sum += y[iy] * x[ix]
|
||||
|
@@ -8,16 +8,22 @@
|
||||
package f64
|
||||
|
||||
// Ger performs the rank-one operation
|
||||
// A += alpha * x * yᵀ
|
||||
//
|
||||
// A += alpha * x * yᵀ
|
||||
//
|
||||
// where A is an m×n dense matrix, x and y are vectors, and alpha is a scalar.
|
||||
func Ger(m, n uintptr, alpha float64, x []float64, incX uintptr, y []float64, incY uintptr, a []float64, lda uintptr)
|
||||
|
||||
// GemvN computes
|
||||
// y = alpha * A * x + beta * y
|
||||
//
|
||||
// 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 GemvN(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
|
||||
//
|
||||
// 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(m, n uintptr, alpha float64, a []float64, lda uintptr, x []float64, incX uintptr, beta float64, y []float64, incY uintptr)
|
||||
|
@@ -8,7 +8,9 @@
|
||||
package f64
|
||||
|
||||
// Ger performs the rank-one operation
|
||||
// A += alpha * x * yᵀ
|
||||
//
|
||||
// A += alpha * x * yᵀ
|
||||
//
|
||||
// where A is an m×n dense matrix, x and y are vectors, and alpha is a scalar.
|
||||
func Ger(m, n uintptr, alpha float64, x []float64, incX uintptr, y []float64, incY uintptr, a []float64, lda uintptr) {
|
||||
if incX == 1 && incY == 1 {
|
||||
@@ -36,7 +38,9 @@ func Ger(m, n uintptr, alpha float64, x []float64, incX uintptr, y []float64, in
|
||||
}
|
||||
|
||||
// GemvN computes
|
||||
// y = alpha * A * x + beta * y
|
||||
//
|
||||
// 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 GemvN(m, n uintptr, alpha float64, a []float64, lda uintptr, x []float64, incX uintptr, beta float64, y []float64, incY uintptr) {
|
||||
var kx, ky, i uintptr
|
||||
@@ -74,7 +78,9 @@ func GemvN(m, n uintptr, alpha float64, a []float64, lda uintptr, x []float64, i
|
||||
}
|
||||
|
||||
// GemvT computes
|
||||
// y = alpha * Aᵀ * x + beta * y
|
||||
//
|
||||
// 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(m, n uintptr, alpha float64, a []float64, lda uintptr, x []float64, incX uintptr, beta float64, y []float64, incY uintptr) {
|
||||
var kx, ky, i uintptr
|
||||
|
@@ -8,9 +8,10 @@
|
||||
package f64
|
||||
|
||||
// ScalUnitary is
|
||||
// for i := range x {
|
||||
// x[i] *= alpha
|
||||
// }
|
||||
//
|
||||
// for i := range x {
|
||||
// x[i] *= alpha
|
||||
// }
|
||||
func ScalUnitary(alpha float64, x []float64) {
|
||||
for i := range x {
|
||||
x[i] *= alpha
|
||||
@@ -18,9 +19,10 @@ func ScalUnitary(alpha float64, x []float64) {
|
||||
}
|
||||
|
||||
// ScalUnitaryTo is
|
||||
// for i, v := range x {
|
||||
// dst[i] = alpha * v
|
||||
// }
|
||||
//
|
||||
// for i, v := range x {
|
||||
// dst[i] = alpha * v
|
||||
// }
|
||||
func ScalUnitaryTo(dst []float64, alpha float64, x []float64) {
|
||||
for i, v := range x {
|
||||
dst[i] = alpha * v
|
||||
@@ -28,11 +30,12 @@ func ScalUnitaryTo(dst []float64, alpha float64, x []float64) {
|
||||
}
|
||||
|
||||
// ScalInc is
|
||||
// var ix uintptr
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// x[ix] *= alpha
|
||||
// ix += incX
|
||||
// }
|
||||
//
|
||||
// var ix uintptr
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// x[ix] *= alpha
|
||||
// ix += incX
|
||||
// }
|
||||
func ScalInc(alpha float64, x []float64, n, incX uintptr) {
|
||||
var ix uintptr
|
||||
for i := 0; i < int(n); i++ {
|
||||
@@ -42,12 +45,13 @@ func ScalInc(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
|
||||
// }
|
||||
//
|
||||
// var idst, ix uintptr
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// dst[idst] = alpha * x[ix]
|
||||
// ix += incX
|
||||
// idst += incDst
|
||||
// }
|
||||
func ScalIncTo(dst []float64, incDst uintptr, alpha float64, x []float64, n, incX uintptr) {
|
||||
var idst, ix uintptr
|
||||
for i := 0; i < int(n); i++ {
|
||||
|
@@ -8,246 +8,270 @@
|
||||
package f64
|
||||
|
||||
// L1Norm is
|
||||
// for _, v := range x {
|
||||
// sum += math.Abs(v)
|
||||
// }
|
||||
// return sum
|
||||
//
|
||||
// for _, v := range x {
|
||||
// sum += math.Abs(v)
|
||||
// }
|
||||
// return sum
|
||||
func L1Norm(x []float64) (sum float64)
|
||||
|
||||
// L1NormInc is
|
||||
// for i := 0; i < n*incX; i += incX {
|
||||
// sum += math.Abs(x[i])
|
||||
// }
|
||||
// return sum
|
||||
//
|
||||
// for i := 0; i < n*incX; i += incX {
|
||||
// sum += math.Abs(x[i])
|
||||
// }
|
||||
// return sum
|
||||
func L1NormInc(x []float64, n, incX int) (sum float64)
|
||||
|
||||
// AddConst is
|
||||
// for i := range x {
|
||||
// x[i] += alpha
|
||||
// }
|
||||
//
|
||||
// for i := range x {
|
||||
// x[i] += alpha
|
||||
// }
|
||||
func AddConst(alpha float64, x []float64)
|
||||
|
||||
// Add is
|
||||
// for i, v := range s {
|
||||
// dst[i] += v
|
||||
// }
|
||||
//
|
||||
// for i, v := range s {
|
||||
// dst[i] += v
|
||||
// }
|
||||
func Add(dst, s []float64)
|
||||
|
||||
// AxpyUnitary is
|
||||
// for i, v := range x {
|
||||
// y[i] += alpha * v
|
||||
// }
|
||||
//
|
||||
// for i, v := range x {
|
||||
// y[i] += alpha * v
|
||||
// }
|
||||
func AxpyUnitary(alpha float64, x, y []float64)
|
||||
|
||||
// AxpyUnitaryTo is
|
||||
// for i, v := range x {
|
||||
// dst[i] = alpha*v + y[i]
|
||||
// }
|
||||
//
|
||||
// for i, v := range x {
|
||||
// dst[i] = alpha*v + y[i]
|
||||
// }
|
||||
func AxpyUnitaryTo(dst []float64, alpha float64, x, y []float64)
|
||||
|
||||
// AxpyInc is
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// y[iy] += alpha * x[ix]
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
//
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// y[iy] += alpha * x[ix]
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
func AxpyInc(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
|
||||
// }
|
||||
//
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// dst[idst] = alpha*x[ix] + y[iy]
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// idst += incDst
|
||||
// }
|
||||
func AxpyIncTo(dst []float64, incDst, idst uintptr, alpha float64, x, y []float64, n, incX, incY, ix, iy uintptr)
|
||||
|
||||
// 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
|
||||
//
|
||||
// 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(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
|
||||
//
|
||||
// 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 CumProd(dst, s []float64) []float64
|
||||
|
||||
// Div is
|
||||
// for i, v := range s {
|
||||
// dst[i] /= v
|
||||
// }
|
||||
//
|
||||
// for i, v := range s {
|
||||
// dst[i] /= v
|
||||
// }
|
||||
func Div(dst, s []float64)
|
||||
|
||||
// DivTo is
|
||||
// for i, v := range s {
|
||||
// dst[i] = v / t[i]
|
||||
// }
|
||||
// return dst
|
||||
//
|
||||
// for i, v := range s {
|
||||
// dst[i] = v / t[i]
|
||||
// }
|
||||
// return dst
|
||||
func DivTo(dst, x, y []float64) []float64
|
||||
|
||||
// DotUnitary is
|
||||
// for i, v := range x {
|
||||
// sum += y[i] * v
|
||||
// }
|
||||
// return sum
|
||||
//
|
||||
// for i, v := range x {
|
||||
// sum += y[i] * v
|
||||
// }
|
||||
// return sum
|
||||
func DotUnitary(x, y []float64) (sum float64)
|
||||
|
||||
// DotInc is
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// sum += y[iy] * x[ix]
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
// return sum
|
||||
//
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// sum += y[iy] * x[ix]
|
||||
// ix += incX
|
||||
// iy += incY
|
||||
// }
|
||||
// return sum
|
||||
func DotInc(x, y []float64, n, incX, incY, ix, iy uintptr) (sum float64)
|
||||
|
||||
// L1Dist is
|
||||
// var norm float64
|
||||
// for i, v := range s {
|
||||
// norm += math.Abs(t[i] - v)
|
||||
// }
|
||||
// return norm
|
||||
//
|
||||
// var norm float64
|
||||
// for i, v := range s {
|
||||
// norm += math.Abs(t[i] - v)
|
||||
// }
|
||||
// return norm
|
||||
func L1Dist(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
|
||||
//
|
||||
// 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 LinfDist(s, t []float64) float64
|
||||
|
||||
// ScalUnitary is
|
||||
// for i := range x {
|
||||
// x[i] *= alpha
|
||||
// }
|
||||
//
|
||||
// for i := range x {
|
||||
// x[i] *= alpha
|
||||
// }
|
||||
func ScalUnitary(alpha float64, x []float64)
|
||||
|
||||
// ScalUnitaryTo is
|
||||
// for i, v := range x {
|
||||
// dst[i] = alpha * v
|
||||
// }
|
||||
//
|
||||
// for i, v := range x {
|
||||
// dst[i] = alpha * v
|
||||
// }
|
||||
func ScalUnitaryTo(dst []float64, alpha float64, x []float64)
|
||||
|
||||
// ScalInc is
|
||||
// var ix uintptr
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// x[ix] *= alpha
|
||||
// ix += incX
|
||||
// }
|
||||
//
|
||||
// var ix uintptr
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// x[ix] *= alpha
|
||||
// ix += incX
|
||||
// }
|
||||
func ScalInc(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
|
||||
// }
|
||||
//
|
||||
// var idst, ix uintptr
|
||||
// for i := 0; i < int(n); i++ {
|
||||
// dst[idst] = alpha * x[ix]
|
||||
// ix += incX
|
||||
// idst += incDst
|
||||
// }
|
||||
func ScalIncTo(dst []float64, incDst uintptr, alpha float64, x []float64, n, incX uintptr)
|
||||
|
||||
// Sum is
|
||||
// var sum float64
|
||||
// for i := range x {
|
||||
// sum += x[i]
|
||||
// }
|
||||
//
|
||||
// var sum float64
|
||||
// for i := range x {
|
||||
// sum += x[i]
|
||||
// }
|
||||
func Sum(x []float64) float64
|
||||
|
||||
// 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)
|
||||
//
|
||||
// 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 L2NormUnitary(x []float64) (norm float64)
|
||||
|
||||
// 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)
|
||||
//
|
||||
// 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 L2NormInc(x []float64, n, incX uintptr) (norm float64)
|
||||
|
||||
// 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)
|
||||
//
|
||||
// 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 L2DistanceUnitary(x, y []float64) (norm float64)
|
||||
|
@@ -10,10 +10,11 @@ package f64
|
||||
import "math"
|
||||
|
||||
// L1Norm is
|
||||
// for _, v := range x {
|
||||
// sum += math.Abs(v)
|
||||
// }
|
||||
// return sum
|
||||
//
|
||||
// for _, v := range x {
|
||||
// sum += math.Abs(v)
|
||||
// }
|
||||
// return sum
|
||||
func L1Norm(x []float64) (sum float64) {
|
||||
for _, v := range x {
|
||||
sum += math.Abs(v)
|
||||
@@ -22,10 +23,11 @@ func L1Norm(x []float64) (sum float64) {
|
||||
}
|
||||
|
||||
// L1NormInc is
|
||||
// for i := 0; i < n*incX; i += incX {
|
||||
// sum += math.Abs(x[i])
|
||||
// }
|
||||
// return sum
|
||||
//
|
||||
// for i := 0; i < n*incX; i += incX {
|
||||
// sum += math.Abs(x[i])
|
||||
// }
|
||||
// return sum
|
||||
func L1NormInc(x []float64, n, incX int) (sum float64) {
|
||||
for i := 0; i < n*incX; i += incX {
|
||||
sum += math.Abs(x[i])
|
||||
@@ -34,9 +36,10 @@ func L1NormInc(x []float64, n, incX int) (sum float64) {
|
||||
}
|
||||
|
||||
// Add is
|
||||
// for i, v := range s {
|
||||
// dst[i] += v
|
||||
// }
|
||||
//
|
||||
// for i, v := range s {
|
||||
// dst[i] += v
|
||||
// }
|
||||
func Add(dst, s []float64) {
|
||||
for i, v := range s {
|
||||
dst[i] += v
|
||||
@@ -44,9 +47,10 @@ func Add(dst, s []float64) {
|
||||
}
|
||||
|
||||
// AddConst is
|
||||
// for i := range x {
|
||||
// x[i] += alpha
|
||||
// }
|
||||
//
|
||||
// for i := range x {
|
||||
// x[i] += alpha
|
||||
// }
|
||||
func AddConst(alpha float64, x []float64) {
|
||||
for i := range x {
|
||||
x[i] += alpha
|
||||
@@ -54,14 +58,15 @@ func AddConst(alpha float64, x []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
|
||||
//
|
||||
// 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(dst, s []float64) []float64 {
|
||||
if len(s) == 0 {
|
||||
return dst
|
||||
@@ -74,14 +79,15 @@ func CumSum(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
|
||||
//
|
||||
// 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 CumProd(dst, s []float64) []float64 {
|
||||
if len(s) == 0 {
|
||||
return dst
|
||||
@@ -94,9 +100,10 @@ func CumProd(dst, s []float64) []float64 {
|
||||
}
|
||||
|
||||
// Div is
|
||||
// for i, v := range s {
|
||||
// dst[i] /= v
|
||||
// }
|
||||
//
|
||||
// for i, v := range s {
|
||||
// dst[i] /= v
|
||||
// }
|
||||
func Div(dst, s []float64) {
|
||||
for i, v := range s {
|
||||
dst[i] /= v
|
||||
@@ -104,10 +111,11 @@ func Div(dst, s []float64) {
|
||||
}
|
||||
|
||||
// DivTo is
|
||||
// for i, v := range s {
|
||||
// dst[i] = v / t[i]
|
||||
// }
|
||||
// return dst
|
||||
//
|
||||
// for i, v := range s {
|
||||
// dst[i] = v / t[i]
|
||||
// }
|
||||
// return dst
|
||||
func DivTo(dst, s, t []float64) []float64 {
|
||||
for i, v := range s {
|
||||
dst[i] = v / t[i]
|
||||
@@ -116,11 +124,12 @@ func DivTo(dst, s, t []float64) []float64 {
|
||||
}
|
||||
|
||||
// L1Dist is
|
||||
// var norm float64
|
||||
// for i, v := range s {
|
||||
// norm += math.Abs(t[i] - v)
|
||||
// }
|
||||
// return norm
|
||||
//
|
||||
// var norm float64
|
||||
// for i, v := range s {
|
||||
// norm += math.Abs(t[i] - v)
|
||||
// }
|
||||
// return norm
|
||||
func L1Dist(s, t []float64) float64 {
|
||||
var norm float64
|
||||
for i, v := range s {
|
||||
@@ -130,18 +139,19 @@ func L1Dist(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
|
||||
//
|
||||
// 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 LinfDist(s, t []float64) float64 {
|
||||
var norm float64
|
||||
if len(s) == 0 {
|
||||
@@ -158,10 +168,11 @@ func LinfDist(s, t []float64) float64 {
|
||||
}
|
||||
|
||||
// Sum is
|
||||
// var sum float64
|
||||
// for i := range x {
|
||||
// sum += x[i]
|
||||
// }
|
||||
//
|
||||
// var sum float64
|
||||
// for i := range x {
|
||||
// sum += x[i]
|
||||
// }
|
||||
func Sum(x []float64) float64 {
|
||||
var sum float64
|
||||
for _, v := range x {
|
||||
|
@@ -17,6 +17,7 @@ import (
|
||||
// The higher-precision values in vc26 were used to derive the
|
||||
// input arguments vc (see also comment below). For reference
|
||||
// only (do not delete).
|
||||
//
|
||||
//lint:ignore U1000 See comment above.
|
||||
var vc26 = []complex64{
|
||||
(4.97901192488367350108546816 + 7.73887247457810456552351752i),
|
||||
|
@@ -22,7 +22,7 @@ func IsNaN(x complex64) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// NaN returns a complex ``not-a-number'' value.
|
||||
// NaN returns a complex “not-a-number” value.
|
||||
func NaN() complex64 {
|
||||
nan := math.NaN()
|
||||
return complex(nan, nan)
|
||||
|
@@ -24,6 +24,7 @@ const (
|
||||
// Abs returns the absolute value of x.
|
||||
//
|
||||
// Special cases are:
|
||||
//
|
||||
// Abs(±Inf) = +Inf
|
||||
// Abs(NaN) = NaN
|
||||
func Abs(x float32) float32 {
|
||||
@@ -47,6 +48,7 @@ func Copysign(x, y float32) float32 {
|
||||
// unnecessary overflow and underflow.
|
||||
//
|
||||
// Special cases are:
|
||||
//
|
||||
// Hypot(±Inf, q) = +Inf
|
||||
// Hypot(p, ±Inf) = +Inf
|
||||
// Hypot(NaN, q) = NaN
|
||||
@@ -98,7 +100,7 @@ func IsInf(f float32, sign int) bool {
|
||||
return sign >= 0 && f > math.MaxFloat32 || sign <= 0 && f < -math.MaxFloat32
|
||||
}
|
||||
|
||||
// IsNaN reports whether f is an IEEE 754 ``not-a-number'' value.
|
||||
// IsNaN reports whether f is an IEEE 754 “not-a-number” value.
|
||||
func IsNaN(f float32) (is bool) {
|
||||
// IEEE 754 says that only NaNs satisfy f != f.
|
||||
// To avoid the floating-point hardware, could use:
|
||||
@@ -110,6 +112,7 @@ func IsNaN(f float32) (is bool) {
|
||||
// Max returns the larger of x or y.
|
||||
//
|
||||
// Special cases are:
|
||||
//
|
||||
// Max(x, +Inf) = Max(+Inf, x) = +Inf
|
||||
// Max(x, NaN) = Max(NaN, x) = NaN
|
||||
// Max(+0, ±0) = Max(±0, +0) = +0
|
||||
@@ -136,6 +139,7 @@ func Max(x, y float32) float32 {
|
||||
// Min returns the smaller of x or y.
|
||||
//
|
||||
// Special cases are:
|
||||
//
|
||||
// Min(x, -Inf) = Min(-Inf, x) = -Inf
|
||||
// Min(x, NaN) = Min(NaN, x) = NaN
|
||||
// Min(-0, ±0) = Min(±0, -0) = -0
|
||||
@@ -158,5 +162,5 @@ func Min(x, y float32) float32 {
|
||||
return y
|
||||
}
|
||||
|
||||
// NaN returns an IEEE 754 ``not-a-number'' value.
|
||||
// NaN returns an IEEE 754 “not-a-number” value.
|
||||
func NaN() float32 { return math.Float32frombits(unan) }
|
||||
|
@@ -178,64 +178,66 @@ func TestSqrt(t *testing.T) {
|
||||
//
|
||||
// __ieee754_sqrt(x)
|
||||
// Return correctly rounded sqrt.
|
||||
// -----------------------------------------
|
||||
// | Use the hardware sqrt if you have one |
|
||||
// -----------------------------------------
|
||||
//
|
||||
// -----------------------------------------
|
||||
// | Use the hardware sqrt if you have one |
|
||||
// -----------------------------------------
|
||||
//
|
||||
// Method:
|
||||
// Bit by bit method using integer arithmetic. (Slow, but portable)
|
||||
// 1. Normalization
|
||||
// Scale x to y in [1,4) with even powers of 2:
|
||||
// find an integer k such that 1 <= (y=x*2**(2k)) < 4, then
|
||||
// sqrt(x) = 2**k * sqrt(y)
|
||||
// 2. Bit by bit computation
|
||||
// Let q = sqrt(y) truncated to i bit after binary point (q = 1),
|
||||
// i 0
|
||||
// i+1 2
|
||||
// s = 2*q , and y = 2 * ( y - q ). (1)
|
||||
// i i i i
|
||||
//
|
||||
// To compute q from q , one checks whether
|
||||
// i+1 i
|
||||
// Bit by bit method using integer arithmetic. (Slow, but portable)
|
||||
// 1. Normalization
|
||||
// Scale x to y in [1,4) with even powers of 2:
|
||||
// find an integer k such that 1 <= (y=x*2**(2k)) < 4, then
|
||||
// sqrt(x) = 2**k * sqrt(y)
|
||||
// 2. Bit by bit computation
|
||||
// Let q = sqrt(y) truncated to i bit after binary point (q = 1),
|
||||
// i 0
|
||||
// i+1 2
|
||||
// s = 2*q , and y = 2 * ( y - q ). (1)
|
||||
// i i i i
|
||||
//
|
||||
// -(i+1) 2
|
||||
// (q + 2 ) <= y. (2)
|
||||
// i
|
||||
// -(i+1)
|
||||
// If (2) is false, then q = q ; otherwise q = q + 2 .
|
||||
// i+1 i i+1 i
|
||||
// To compute q from q , one checks whether
|
||||
// i+1 i
|
||||
//
|
||||
// With some algebraic manipulation, it is not difficult to see
|
||||
// that (2) is equivalent to
|
||||
// -(i+1)
|
||||
// s + 2 <= y (3)
|
||||
// i i
|
||||
// -(i+1) 2
|
||||
// (q + 2 ) <= y. (2)
|
||||
// i
|
||||
// -(i+1)
|
||||
// If (2) is false, then q = q ; otherwise q = q + 2 .
|
||||
// i+1 i i+1 i
|
||||
//
|
||||
// The advantage of (3) is that s and y can be computed by
|
||||
// i i
|
||||
// the following recurrence formula:
|
||||
// if (3) is false
|
||||
// With some algebraic manipulation, it is not difficult to see
|
||||
// that (2) is equivalent to
|
||||
// -(i+1)
|
||||
// s + 2 <= y (3)
|
||||
// i i
|
||||
//
|
||||
// s = s , y = y ; (4)
|
||||
// i+1 i i+1 i
|
||||
// The advantage of (3) is that s and y can be computed by
|
||||
// i i
|
||||
// the following recurrence formula:
|
||||
// if (3) is false
|
||||
//
|
||||
// otherwise,
|
||||
// -i -(i+1)
|
||||
// s = s + 2 , y = y - s - 2 (5)
|
||||
// i+1 i i+1 i i
|
||||
// s = s , y = y ; (4)
|
||||
// i+1 i i+1 i
|
||||
//
|
||||
// One may easily use induction to prove (4) and (5).
|
||||
// Note. Since the left hand side of (3) contain only i+2 bits,
|
||||
// it does not necessary to do a full (53-bit) comparison
|
||||
// in (3).
|
||||
// 3. Final rounding
|
||||
// After generating the 53 bits result, we compute one more bit.
|
||||
// Together with the remainder, we can decide whether the
|
||||
// result is exact, bigger than 1/2ulp, or less than 1/2ulp
|
||||
// (it will never equal to 1/2ulp).
|
||||
// The rounding mode can be detected by checking whether
|
||||
// huge + tiny is equal to huge, and whether huge - tiny is
|
||||
// equal to huge for some floating point number "huge" and "tiny".
|
||||
// otherwise,
|
||||
// -i -(i+1)
|
||||
// s = s + 2 , y = y - s - 2 (5)
|
||||
// i+1 i i+1 i i
|
||||
//
|
||||
// One may easily use induction to prove (4) and (5).
|
||||
// Note. Since the left hand side of (3) contain only i+2 bits,
|
||||
// it does not necessary to do a full (53-bit) comparison
|
||||
// in (3).
|
||||
// 3. Final rounding
|
||||
// After generating the 53 bits result, we compute one more bit.
|
||||
// Together with the remainder, we can decide whether the
|
||||
// result is exact, bigger than 1/2ulp, or less than 1/2ulp
|
||||
// (it will never equal to 1/2ulp).
|
||||
// The rounding mode can be detected by checking whether
|
||||
// huge + tiny is equal to huge, and whether huge - tiny is
|
||||
// equal to huge for some floating point number "huge" and "tiny".
|
||||
func sqrt(x float32) float32 {
|
||||
// special cases
|
||||
switch {
|
||||
|
@@ -14,6 +14,7 @@ import (
|
||||
// Sqrt returns the square root of x.
|
||||
//
|
||||
// Special cases are:
|
||||
//
|
||||
// Sqrt(+Inf) = +Inf
|
||||
// Sqrt(±0) = ±0
|
||||
// Sqrt(x < 0) = NaN
|
||||
|
@@ -14,6 +14,7 @@ package math32
|
||||
// Sqrt returns the square root of x.
|
||||
//
|
||||
// Special cases are:
|
||||
//
|
||||
// Sqrt(+Inf) = +Inf
|
||||
// Sqrt(±0) = ±0
|
||||
// Sqrt(x < 0) = NaN
|
||||
|
@@ -14,6 +14,7 @@ package math32
|
||||
// Sqrt returns the square root of x.
|
||||
//
|
||||
// Special cases are:
|
||||
//
|
||||
// Sqrt(+Inf) = +Inf
|
||||
// Sqrt(±0) = ±0
|
||||
// Sqrt(x < 0) = NaN
|
||||
|
@@ -15,7 +15,9 @@ import (
|
||||
// Dbdsqr performs a singular value decomposition of a real n×n bidiagonal matrix.
|
||||
//
|
||||
// The SVD of the bidiagonal matrix B is
|
||||
// B = Q * S * Pᵀ
|
||||
//
|
||||
// B = Q * S * Pᵀ
|
||||
//
|
||||
// where S is a diagonal matrix of singular values, Q is an orthogonal matrix of
|
||||
// left singular vectors, and P is an orthogonal matrix of right singular vectors.
|
||||
//
|
||||
@@ -25,7 +27,8 @@ import (
|
||||
//
|
||||
// Frequently Dbdsqr is used in conjunction with Dgebrd which reduces a general
|
||||
// matrix A into bidiagonal form. In this case, the SVD of A is
|
||||
// A = (U * Q) * S * (Pᵀ * VT)
|
||||
//
|
||||
// A = (U * Q) * S * (Pᵀ * VT)
|
||||
//
|
||||
// This routine may also compute Qᵀ * C.
|
||||
//
|
||||
|
@@ -10,8 +10,10 @@ import (
|
||||
)
|
||||
|
||||
// Dgebak updates an n×m matrix V as
|
||||
// V = P D V if side == lapack.EVRight,
|
||||
// V = P D^{-1} V if side == lapack.EVLeft,
|
||||
//
|
||||
// V = P D V if side == lapack.EVRight,
|
||||
// V = P D^{-1} V if side == lapack.EVLeft,
|
||||
//
|
||||
// where P and D are n×n permutation and scaling matrices, respectively,
|
||||
// implicitly represented by job, scale, ilo and ihi as returned by Dgebal.
|
||||
//
|
||||
|
@@ -16,9 +16,11 @@ import (
|
||||
//
|
||||
// Permuting consists of applying a permutation matrix P such that the matrix
|
||||
// that results from Pᵀ*A*P takes the upper block triangular form
|
||||
// [ T1 X Y ]
|
||||
// Pᵀ A P = [ 0 B Z ],
|
||||
// [ 0 0 T2 ]
|
||||
//
|
||||
// [ T1 X Y ]
|
||||
// Pᵀ A P = [ 0 B Z ],
|
||||
// [ 0 0 T2 ]
|
||||
//
|
||||
// where T1 and T2 are upper triangular matrices and B contains at least one
|
||||
// nonzero off-diagonal element in each row and column. The indices ilo and ihi
|
||||
// mark the starting and ending columns of the submatrix B. The eigenvalues of A
|
||||
@@ -28,9 +30,11 @@ import (
|
||||
// Scaling consists of applying a diagonal similarity transformation D such that
|
||||
// D^{-1}*B*D has the 1-norm of each row and its corresponding column nearly
|
||||
// equal. The output matrix is
|
||||
// [ T1 X*D Y ]
|
||||
// [ 0 inv(D)*B*D inv(D)*Z ].
|
||||
// [ 0 0 T2 ]
|
||||
//
|
||||
// [ T1 X*D Y ]
|
||||
// [ 0 inv(D)*B*D inv(D)*Z ].
|
||||
// [ 0 0 T2 ]
|
||||
//
|
||||
// Scaling may reduce the 1-norm of the matrix, and improve the accuracy of
|
||||
// the computed eigenvalues and/or eigenvectors.
|
||||
//
|
||||
@@ -41,16 +45,21 @@ import (
|
||||
// If job is lapack.PermuteScale, both permuting and scaling will be done.
|
||||
//
|
||||
// On return, if job is lapack.Permute or lapack.PermuteScale, it will hold that
|
||||
// A[i,j] == 0, for i > j and j ∈ {0, ..., ilo-1, ihi+1, ..., n-1}.
|
||||
//
|
||||
// A[i,j] == 0, for i > j and j ∈ {0, ..., ilo-1, ihi+1, ..., n-1}.
|
||||
//
|
||||
// If job is lapack.BalanceNone or lapack.Scale, or if n == 0, it will hold that
|
||||
// ilo == 0 and ihi == n-1.
|
||||
//
|
||||
// ilo == 0 and ihi == n-1.
|
||||
//
|
||||
// On return, scale will contain information about the permutations and scaling
|
||||
// factors applied to A. If π(j) denotes the index of the column interchanged
|
||||
// with column j, and D[j,j] denotes the scaling factor applied to column j,
|
||||
// then
|
||||
// scale[j] == π(j), for j ∈ {0, ..., ilo-1, ihi+1, ..., n-1},
|
||||
// == D[j,j], for j ∈ {ilo, ..., ihi}.
|
||||
//
|
||||
// scale[j] == π(j), for j ∈ {0, ..., ilo-1, ihi+1, ..., n-1},
|
||||
// == D[j,j], for j ∈ {ilo, ..., ihi}.
|
||||
//
|
||||
// scale must have length equal to n, otherwise Dgebal will panic.
|
||||
//
|
||||
// Dgebal is an internal routine. It is exported for testing purposes.
|
||||
|
@@ -8,7 +8,9 @@ import "gonum.org/v1/gonum/blas"
|
||||
|
||||
// Dgebd2 reduces an m×n matrix A to upper or lower bidiagonal form by an orthogonal
|
||||
// transformation.
|
||||
// Qᵀ * A * P = B
|
||||
//
|
||||
// Qᵀ * A * P = B
|
||||
//
|
||||
// if m >= n, B is upper diagonal, otherwise B is lower bidiagonal.
|
||||
// d is the diagonal, len = min(m,n)
|
||||
// e is the off-diagonal len = min(m,n)-1
|
||||
|
@@ -11,7 +11,9 @@ import (
|
||||
|
||||
// Dgebrd reduces a general m×n matrix A to upper or lower bidiagonal form B by
|
||||
// an orthogonal transformation:
|
||||
// Qᵀ * A * P = B.
|
||||
//
|
||||
// Qᵀ * A * P = B.
|
||||
//
|
||||
// The diagonal elements of B are stored in d and the off-diagonal elements are stored
|
||||
// in e. These are additionally stored along the diagonal of A and the off-diagonal
|
||||
// of A. If m >= n B is an upper-bidiagonal matrix, and if m < n B is a
|
||||
@@ -19,27 +21,33 @@ import (
|
||||
//
|
||||
// The remaining elements of A store the data needed to construct Q and P.
|
||||
// The matrices Q and P are products of elementary reflectors
|
||||
// if m >= n, Q = H_0 * H_1 * ... * H_{n-1},
|
||||
// P = G_0 * G_1 * ... * G_{n-2},
|
||||
// if m < n, Q = H_0 * H_1 * ... * H_{m-2},
|
||||
// P = G_0 * G_1 * ... * G_{m-1},
|
||||
//
|
||||
// if m >= n, Q = H_0 * H_1 * ... * H_{n-1},
|
||||
// P = G_0 * G_1 * ... * G_{n-2},
|
||||
// if m < n, Q = H_0 * H_1 * ... * H_{m-2},
|
||||
// P = G_0 * G_1 * ... * G_{m-1},
|
||||
//
|
||||
// where
|
||||
// H_i = I - tauQ[i] * v_i * v_iᵀ,
|
||||
// G_i = I - tauP[i] * u_i * u_iᵀ.
|
||||
//
|
||||
// H_i = I - tauQ[i] * v_i * v_iᵀ,
|
||||
// G_i = I - tauP[i] * u_i * u_iᵀ.
|
||||
//
|
||||
// As an example, on exit the entries of A when m = 6, and n = 5
|
||||
// [ d e u1 u1 u1]
|
||||
// [v1 d e u2 u2]
|
||||
// [v1 v2 d e u3]
|
||||
// [v1 v2 v3 d e]
|
||||
// [v1 v2 v3 v4 d]
|
||||
// [v1 v2 v3 v4 v5]
|
||||
//
|
||||
// [ d e u1 u1 u1]
|
||||
// [v1 d e u2 u2]
|
||||
// [v1 v2 d e u3]
|
||||
// [v1 v2 v3 d e]
|
||||
// [v1 v2 v3 v4 d]
|
||||
// [v1 v2 v3 v4 v5]
|
||||
//
|
||||
// and when m = 5, n = 6
|
||||
// [ d u1 u1 u1 u1 u1]
|
||||
// [ e d u2 u2 u2 u2]
|
||||
// [v1 e d u3 u3 u3]
|
||||
// [v1 v2 e d u4 u4]
|
||||
// [v1 v2 v3 e d u5]
|
||||
//
|
||||
// [ d u1 u1 u1 u1 u1]
|
||||
// [ e d u2 u2 u2 u2]
|
||||
// [v1 e d u3 u3 u3]
|
||||
// [v1 v2 e d u4 u4]
|
||||
// [v1 v2 v3 e d u5]
|
||||
//
|
||||
// d, tauQ, and tauP must all have length at least min(m,n), and e must have
|
||||
// length min(m,n) - 1, unless lwork is -1 when there is no check except for
|
||||
|
@@ -17,22 +17,30 @@ import (
|
||||
//
|
||||
// The right eigenvector v_j of A corresponding to an eigenvalue λ_j
|
||||
// is defined by
|
||||
// A v_j = λ_j v_j,
|
||||
//
|
||||
// A v_j = λ_j v_j,
|
||||
//
|
||||
// and the left eigenvector u_j corresponding to an eigenvalue λ_j is defined by
|
||||
// u_jᴴ A = λ_j u_jᴴ,
|
||||
//
|
||||
// u_jᴴ A = λ_j u_jᴴ,
|
||||
//
|
||||
// where u_jᴴ is the conjugate transpose of u_j.
|
||||
//
|
||||
// On return, A will be overwritten and the left and right eigenvectors will be
|
||||
// stored, respectively, in the columns of the n×n matrices VL and VR in the
|
||||
// same order as their eigenvalues. If the j-th eigenvalue is real, then
|
||||
// u_j = VL[:,j],
|
||||
// v_j = VR[:,j],
|
||||
//
|
||||
// u_j = VL[:,j],
|
||||
// v_j = VR[:,j],
|
||||
//
|
||||
// and if it is not real, then j and j+1 form a complex conjugate pair and the
|
||||
// eigenvectors can be recovered as
|
||||
// u_j = VL[:,j] + i*VL[:,j+1],
|
||||
// u_{j+1} = VL[:,j] - i*VL[:,j+1],
|
||||
// v_j = VR[:,j] + i*VR[:,j+1],
|
||||
// v_{j+1} = VR[:,j] - i*VR[:,j+1],
|
||||
//
|
||||
// u_j = VL[:,j] + i*VL[:,j+1],
|
||||
// u_{j+1} = VL[:,j] - i*VL[:,j+1],
|
||||
// v_j = VR[:,j] + i*VR[:,j+1],
|
||||
// v_{j+1} = VR[:,j] - i*VR[:,j+1],
|
||||
//
|
||||
// where i is the imaginary unit. The computed eigenvectors are normalized to
|
||||
// have Euclidean norm equal to 1 and largest component real.
|
||||
//
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user