blas/gonum: add Zsyrk with test

This commit is contained in:
Vladimir Chalupecky
2019-01-06 21:49:07 +01:00
committed by Vladimír Chalupecký
parent 73c94a2aff
commit 20d2a2bc77
6 changed files with 335 additions and 16 deletions

View File

@@ -652,3 +652,55 @@ func zmm(tA, tB blas.Transpose, m, n, k int, alpha complex128, a []complex128, l
}
return r
}
// transString returns a string representation of blas.Transpose.
func transString(t blas.Transpose) string {
switch t {
case blas.NoTrans:
return "NoTrans"
case blas.Trans:
return "Trans"
case blas.ConjTrans:
return "ConjTrans"
}
return "unknown trans"
}
// uploString returns a string representation of blas.Uplo.
func uploString(uplo blas.Uplo) string {
switch uplo {
case blas.Lower:
return "Lower"
case blas.Upper:
return "Upper"
}
return "unknown uplo"
}
// zSameLowerTri returns whether n×n matrices A and B are same under the diagonal.
func zSameLowerTri(n int, a []complex128, lda int, b []complex128, ldb int) bool {
for i := 1; i < n; i++ {
for j := 0; j < i; j++ {
aij := a[i*lda+j]
bij := b[i*ldb+j]
if !sameComplex128(aij, bij) {
return false
}
}
}
return true
}
// zSameUpperTri returns whether n×n matrices A and B are same above the diagonal.
func zSameUpperTri(n int, a []complex128, lda int, b []complex128, ldb int) bool {
for i := 0; i < n-1; i++ {
for j := i + 1; j < n; j++ {
aij := a[i*lda+j]
bij := b[i*ldb+j]
if !sameComplex128(aij, bij) {
return false
}
}
}
return true
}