blas/{cblas64,cblas128}: add length field to Vector
MODIFY
blas/cblas128/cblas128_test.go
blas/cblas128/cblas128_test.go
@@ -57,16 +57,16 @@ type c128 struct{}
var _ blas.Complex128 = c128{}
func (c128) Zdotu(n int, x []complex128, incX int, y []complex128, incY int) complex128 {
- return Dotu(n, Vector{Inc: incX, Data: x}, Vector{Inc: incY, Data: y})
+ return Dotu(Vector{N: n, Inc: incX, Data: x}, Vector{N: n, Inc: incY, Data: y})
}
func (c128) Zdotc(n int, x []complex128, incX int, y []complex128, incY int) complex128 {
- return Dotc(n, Vector{Inc: incX, Data: x}, Vector{Inc: incY, Data: y})
+ return Dotc(Vector{N: n, Inc: incX, Data: x}, Vector{N: n, Inc: incY, Data: y})
}
func (c128) Dznrm2(n int, x []complex128, incX int) float64 {
if incX < 0 {
return 0
}
- return Nrm2(n, Vector{Inc: incX, Data: x})
+ return Nrm2(Vector{N: n, Inc: incX, Data: x})
}
func (c128) Dnrm2(n int, x []float64, incX int) float64 {
return blas64.Nrm2(blas64.Vector{N: n, Inc: incX, Data: x})
@@ -75,132 +75,144 @@ func (c128) Dzasum(n int, x []complex128, incX int) float64 {
if incX < 0 {
return 0
}
- return Asum(n, Vector{Inc: incX, Data: x})
+ return Asum(Vector{N: n, Inc: incX, Data: x})
}
func (c128) Izamax(n int, x []complex128, incX int) int {
if incX < 0 {
return -1
}
- return Iamax(n, Vector{Inc: incX, Data: x})
+ return Iamax(Vector{N: n, Inc: incX, Data: x})
}
func (c128) Zswap(n int, x []complex128, incX int, y []complex128, incY int) {
- Swap(n, Vector{Inc: incX, Data: x}, Vector{Inc: incY, Data: y})
+ Swap(Vector{N: n, Inc: incX, Data: x}, Vector{N: n, Inc: incY, Data: y})
}
func (c128) Zcopy(n int, x []complex128, incX int, y []complex128, incY int) {
- Copy(n, Vector{Inc: incX, Data: x}, Vector{Inc: incY, Data: y})
+ Copy(Vector{N: n, Inc: incX, Data: x}, Vector{N: n, Inc: incY, Data: y})
}
func (c128) Zaxpy(n int, alpha complex128, x []complex128, incX int, y []complex128, incY int) {
- Axpy(n, alpha, Vector{Inc: incX, Data: x}, Vector{Inc: incY, Data: y})
+ Axpy(alpha, Vector{N: n, Inc: incX, Data: x}, Vector{N: n, Inc: incY, Data: y})
}
func (c128) Zscal(n int, alpha complex128, x []complex128, incX int) {
if incX < 0 {
return
}
- Scal(n, alpha, Vector{Inc: incX, Data: x})
+ Scal(alpha, Vector{N: n, Inc: incX, Data: x})
}
func (c128) Zdscal(n int, alpha float64, x []complex128, incX int) {
if incX < 0 {
return
}
- Dscal(n, alpha, Vector{Inc: incX, Data: x})
+ Dscal(alpha, Vector{N: n, Inc: incX, Data: x})
}
func (c128) Zgemv(tA blas.Transpose, m, n int, alpha complex128, a []complex128, lda int, x []complex128, incX int, beta complex128, y []complex128, incY int) {
+ lenX := m
+ lenY := n
+ if tA == blas.NoTrans {
+ lenX = n
+ lenY = m
+ }
Gemv(tA, alpha,
General{Rows: m, Cols: n, Data: a, Stride: lda},
- Vector{Inc: incX, Data: x},
+ Vector{N: lenX, Inc: incX, Data: x},
beta,
- Vector{Inc: incY, Data: y})
+ Vector{N: lenY, Inc: incY, Data: y})
}
func (c128) Zgbmv(tA blas.Transpose, m, n, kL, kU int, alpha complex128, a []complex128, lda int, x []complex128, incX int, beta complex128, y []complex128, incY int) {
+ lenX := m
+ lenY := n
+ if tA == blas.NoTrans {
+ lenX = n
+ lenY = m
+ }
Gbmv(tA, alpha,
Band{Rows: m, Cols: n, KL: kL, KU: kU, Data: a, Stride: lda},
- Vector{Inc: incX, Data: x},
+ Vector{N: lenX, Inc: incX, Data: x},
beta,
- Vector{Inc: incY, Data: y})
+ Vector{N: lenY, Inc: incY, Data: y})
}
func (c128) Ztrmv(ul blas.Uplo, tA blas.Transpose, d blas.Diag, n int, a []complex128, lda int, x []complex128, incX int) {
Trmv(tA,
Triangular{Uplo: ul, Diag: d, N: n, Data: a, Stride: lda},
- Vector{Inc: incX, Data: x})
+ Vector{N: n, Inc: incX, Data: x})
}
func (c128) Ztbmv(ul blas.Uplo, tA blas.Transpose, d blas.Diag, n, k int, a []complex128, lda int, x []complex128, incX int) {
Tbmv(tA,
TriangularBand{Uplo: ul, Diag: d, N: n, K: k, Data: a, Stride: lda},
- Vector{Inc: incX, Data: x})
+ Vector{N: n, Inc: incX, Data: x})
}
func (c128) Ztpmv(ul blas.Uplo, tA blas.Transpose, d blas.Diag, n int, ap []complex128, x []complex128, incX int) {
Tpmv(tA,
TriangularPacked{Uplo: ul, Diag: d, N: n, Data: ap},
- Vector{Inc: incX, Data: x})
+ Vector{N: n, Inc: incX, Data: x})
}
func (c128) Ztrsv(ul blas.Uplo, tA blas.Transpose, d blas.Diag, n int, a []complex128, lda int, x []complex128, incX int) {
Trsv(tA,
Triangular{Uplo: ul, Diag: d, N: n, Data: a, Stride: lda},
- Vector{Inc: incX, Data: x})
+ Vector{N: n, Inc: incX, Data: x})
}
func (c128) Ztbsv(ul blas.Uplo, tA blas.Transpose, d blas.Diag, n, k int, a []complex128, lda int, x []complex128, incX int) {
Tbsv(tA,
TriangularBand{Uplo: ul, Diag: d, N: n, K: k, Data: a, Stride: lda},
- Vector{Inc: incX, Data: x})
+ Vector{N: n, Inc: incX, Data: x})
}
func (c128) Ztpsv(ul blas.Uplo, tA blas.Transpose, d blas.Diag, n int, ap []complex128, x []complex128, incX int) {
Tpsv(tA,
TriangularPacked{Uplo: ul, Diag: d, N: n, Data: ap},
- Vector{Inc: incX, Data: x})
+ Vector{N: n, Inc: incX, Data: x})
}
func (c128) Zhemv(ul blas.Uplo, n int, alpha complex128, a []complex128, lda int, x []complex128, incX int, beta complex128, y []complex128, incY int) {
Hemv(alpha,
Hermitian{Uplo: ul, N: n, Data: a, Stride: lda},
- Vector{Inc: incX, Data: x},
+ Vector{N: n, Inc: incX, Data: x},
beta,
- Vector{Inc: incY, Data: y})
+ Vector{N: n, Inc: incY, Data: y})
}
func (c128) Zhbmv(ul blas.Uplo, n, k int, alpha complex128, a []complex128, lda int, x []complex128, incX int, beta complex128, y []complex128, incY int) {
Hbmv(alpha,
HermitianBand{Uplo: ul, N: n, K: k, Data: a, Stride: lda},
- Vector{Inc: incX, Data: x},
+ Vector{N: n, Inc: incX, Data: x},
beta,
- Vector{Inc: incY, Data: y})
+ Vector{N: n, Inc: incY, Data: y})
}
func (c128) Zhpmv(ul blas.Uplo, n int, alpha complex128, ap []complex128, x []complex128, incX int, beta complex128, y []complex128, incY int) {
Hpmv(alpha,
HermitianPacked{Uplo: ul, N: n, Data: ap},
- Vector{Inc: incX, Data: x},
+ Vector{N: n, Inc: incX, Data: x},
beta,
- Vector{Inc: incY, Data: y})
+ Vector{N: n, Inc: incY, Data: y})
}
func (c128) Zgeru(m, n int, alpha complex128, x []complex128, incX int, y []complex128, incY int, a []complex128, lda int) {
Geru(alpha,
- Vector{Inc: incX, Data: x},
- Vector{Inc: incY, Data: y},
+ Vector{N: n, Inc: incX, Data: x},
+ Vector{N: n, Inc: incY, Data: y},
General{Rows: m, Cols: n, Data: a, Stride: lda})
}
func (c128) Zgerc(m, n int, alpha complex128, x []complex128, incX int, y []complex128, incY int, a []complex128, lda int) {
Gerc(alpha,
- Vector{Inc: incX, Data: x},
- Vector{Inc: incY, Data: y},
+ Vector{N: n, Inc: incX, Data: x},
+ Vector{N: n, Inc: incY, Data: y},
General{Rows: m, Cols: n, Data: a, Stride: lda})
}
func (c128) Zher(ul blas.Uplo, n int, alpha float64, x []complex128, incX int, a []complex128, lda int) {
Her(alpha,
- Vector{Inc: incX, Data: x},
+ Vector{N: n, Inc: incX, Data: x},
Hermitian{Uplo: ul, N: n, Data: a, Stride: lda})
}
func (c128) Zhpr(ul blas.Uplo, n int, alpha float64, x []complex128, incX int, ap []complex128) {
Hpr(alpha,
- Vector{Inc: incX, Data: x},
+ Vector{N: n, Inc: incX, Data: x},
HermitianPacked{Uplo: ul, N: n, Data: ap})
}
func (c128) Zher2(ul blas.Uplo, n int, alpha complex128, x []complex128, incX int, y []complex128, incY int, a []complex128, lda int) {
Her2(alpha,
- Vector{Inc: incX, Data: x},
- Vector{Inc: incY, Data: y},
+ Vector{N: n, Inc: incX, Data: x},
+ Vector{N: n, Inc: incY, Data: y},
Hermitian{Uplo: ul, N: n, Data: a, Stride: lda})
}
func (c128) Zhpr2(ul blas.Uplo, n int, alpha complex128, x []complex128, incX int, y []complex128, incY int, a []complex128) {
Hpr2(alpha,
- Vector{Inc: incX, Data: x},
- Vector{Inc: incY, Data: y},
+ Vector{N: n, Inc: incX, Data: x},
+ Vector{N: n, Inc: incY, Data: y},
HermitianPacked{Uplo: ul, N: n, Data: a})
}
func (c128) 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) {

blas/{cblas64,cblas128}: add length field to Vector