blas,lapack: clean up docs and comments

Apply (with manual curation after the fact):
* s/^T/U+1d40/g
* s/^H/U+1d34/g
* s/, {2,3}if / $1/g

Some additional manual editing of odd formatting.
This commit is contained in:
Dan Kortschak
2019-09-03 13:46:38 +09:30
parent 2065cbd6b4
commit 17ea55aedb
164 changed files with 949 additions and 949 deletions

View File

@@ -76,7 +76,7 @@ func DbdsqrTest(t *testing.T, impl Dbdsqrer) {
// First test the decomposition of the bidiagonal matrix. Set
// pt and u equal to I with the correct size. At the result
// of Dbdsqr, p and u will contain the data of P^T and Q, which
// of Dbdsqr, p and u will contain the data of P and Q, which
// will be used in the next step to test the multiplication
// with Q and VT.
@@ -133,7 +133,7 @@ func DbdsqrTest(t *testing.T, impl Dbdsqrer) {
t.Errorf("D is not sorted. %s", errStr)
}
// The above computed the real P and Q. Now input data for V^T,
// The above computed the real P and Q. Now input data for V,
// U, and C to check that the multiplications happen properly.
dAns := make([]float64, len(d))
copy(dAns, d)

View File

@@ -151,7 +151,7 @@ func testDgebal(t *testing.T, impl Dgebaler, job lapack.BalanceJob, a blas64.Gen
blas64.Swap(blas64.Vector{N: n, Data: p.Data[j:], Inc: p.Stride},
blas64.Vector{N: n, Data: p.Data[int(scale[j]):], Inc: p.Stride})
}
// Compute P^T*A*P and store into want.
// Compute P*A*P and store into want.
ap := zeros(n, n, n)
blas64.Gemm(blas.NoTrans, blas.NoTrans, 1, want, p, 0, ap)
blas64.Gemm(blas.Trans, blas.NoTrans, 1, p, ap, 0, want)

View File

@@ -53,7 +53,7 @@ func Dgebd2Test(t *testing.T, impl Dgebd2er) {
// transformation.
impl.Dgebd2(m, n, a, lda, d, e, tauQ, tauP, work)
// Check that it holds Q^T * A * P = B where B is represented by
// Check that it holds Q * A * P = B where B is represented by
// d and e.
checkBidiagonal(t, m, n, nb, a, lda, d, e, tauP, tauQ, aCopy)
}

View File

@@ -521,7 +521,7 @@ func DgeevTest(t *testing.T, impl Dgeever) {
}
}
// Compute A = Q T Q^T where Q is an
// Compute A = Q T Q where Q is an
// orthogonal matrix.
q := randomOrthogonal(n, rnd)
tq := zeros(n, n, n)

View File

@@ -163,7 +163,7 @@ func testDgehd2(t *testing.T, impl Dgehd2er, n, extra int, rnd *rand.Rand) {
}
}
// Construct Q^T * AOrig * Q and check that it is
// Construct Q * AOrig * Q and check that it is
// equal to A from Dgehd2.
aq := blas64.General{
Rows: n,
@@ -184,13 +184,13 @@ func testDgehd2(t *testing.T, impl Dgehd2er, n, extra int, rnd *rand.Rand) {
qaqij := qaq.Data[i*qaq.Stride+j]
if j < i-1 {
if math.Abs(qaqij) > 1e-14 {
t.Errorf("%v: Q^T*A*Q is not upper Hessenberg, [%v,%v]=%v", prefix, i, j, qaqij)
t.Errorf("%v: Q*A*Q is not upper Hessenberg, [%v,%v]=%v", prefix, i, j, qaqij)
}
continue
}
diff := qaqij - a.Data[i*a.Stride+j]
if math.Abs(diff) > 1e-14 {
t.Errorf("%v: Q^T*AOrig*Q and A are not equal, diff at [%v,%v]=%v", prefix, i, j, diff)
t.Errorf("%v: Q*AOrig*Q and A are not equal, diff at [%v,%v]=%v", prefix, i, j, diff)
}
}
}

View File

@@ -168,7 +168,7 @@ func testDgehrd(t *testing.T, impl Dgehrder, n, ilo, ihi, extra int, optwork boo
t.Errorf("%v: Q is not orthogonal\nQ=%v", prefix, q)
}
// Construct Q^T * AOrig * Q and check that it is upper Hessenberg.
// Construct Q * AOrig * Q and check that it is upper Hessenberg.
aq := blas64.General{
Rows: n,
Cols: n,
@@ -188,7 +188,7 @@ func testDgehrd(t *testing.T, impl Dgehrder, n, ilo, ihi, extra int, optwork boo
qaqij := qaq.Data[i*qaq.Stride+j]
diff := qaqij - a.Data[i*a.Stride+j]
if math.Abs(diff) > 1e-13 {
t.Errorf("%v: Q^T*AOrig*Q and A are not equal, diff at [%v,%v]=%v", prefix, i, j, diff)
t.Errorf("%v: Q*AOrig*Q and A are not equal, diff at [%v,%v]=%v", prefix, i, j, diff)
}
}
}
@@ -197,13 +197,13 @@ func testDgehrd(t *testing.T, impl Dgehrder, n, ilo, ihi, extra int, optwork boo
qaqij := qaq.Data[i*qaq.Stride+j]
if j < i-1 {
if math.Abs(qaqij) > 1e-13 {
t.Errorf("%v: Q^T*AOrig*Q is not upper Hessenberg, [%v,%v]=%v", prefix, i, j, qaqij)
t.Errorf("%v: Q*AOrig*Q is not upper Hessenberg, [%v,%v]=%v", prefix, i, j, qaqij)
}
continue
}
diff := qaqij - a.Data[i*a.Stride+j]
if math.Abs(diff) > 1e-13 {
t.Errorf("%v: Q^T*AOrig*Q and A are not equal, diff at [%v,%v]=%v", prefix, i, j, diff)
t.Errorf("%v: Q*AOrig*Q and A are not equal, diff at [%v,%v]=%v", prefix, i, j, diff)
}
}
}

View File

@@ -122,7 +122,7 @@ func DgelsTest(t *testing.T, impl Dgelser) {
Data: make([]float64, szAta*szAta),
}
// Compute A^T * A if notrans and A * A^T otherwise.
// Compute A * A if notrans and A * A otherwise.
if trans == blas.NoTrans {
blas64.Gemm(blas.Trans, blas.NoTrans, 1, aMat, aMat, 0, aTA)
} else {
@@ -169,7 +169,7 @@ func DgelsTest(t *testing.T, impl Dgelser) {
}
}
// Compute A^T B if Trans or A * B otherwise
// Compute A B if Trans or A * B otherwise
if trans == blas.NoTrans {
blas64.Gemm(blas.Trans, blas.NoTrans, 1, aMat, B, 0, ans2)
} else {

View File

@@ -37,9 +37,9 @@ func DgesvdTest(t *testing.T, impl Dgesvder, tol float64) {
// - the zero matrix if mtype == 1,
// - the identity matrix if mtype == 2,
// - a random matrix with a given condition number and singular values if mtype == 3, 4, or 5.
// It first computes the full SVD A = U*Sigma*V^T and checks that
// - U has orthonormal columns, and V^T has orthonormal rows,
// - U*Sigma*V^T multiply back to A,
// It first computes the full SVD A = U*Sigma*V and checks that
// - U has orthonormal columns, and V has orthonormal rows,
// - U*Sigma*V multiply back to A,
// - the singular values are non-negative and sorted in decreasing order.
// Then all combinations of partial SVD results are computed and checked whether
// they match the full SVD result.

View File

@@ -143,7 +143,7 @@ func Dggsvd3Test(t *testing.T, impl Dggsvd3er) {
zeroR, d1, d2 := constructGSVDresults(n, p, m, k, l, a, b, alpha, beta)
// Check U^T*A*Q = D1*[ 0 R ].
// Check U*A*Q = D1*[ 0 R ].
uTmp := nanGeneral(m, n, n)
blas64.Gemm(blas.Trans, blas.NoTrans, 1, u, aCopy, 0, uTmp)
uAns := nanGeneral(m, n, n)
@@ -153,11 +153,11 @@ func Dggsvd3Test(t *testing.T, impl Dggsvd3er) {
blas64.Gemm(blas.NoTrans, blas.NoTrans, 1, d1, zeroR, 0, d10r)
if !equalApproxGeneral(uAns, d10r, 1e-14) {
t.Errorf("test %d: U^T*A*Q != D1*[ 0 R ]\nU^T*A*Q:\n%+v\nD1*[ 0 R ]:\n%+v",
t.Errorf("test %d: U*A*Q != D1*[ 0 R ]\nU*A*Q:\n%+v\nD1*[ 0 R ]:\n%+v",
cas, uAns, d10r)
}
// Check V^T*B*Q = D2*[ 0 R ].
// Check V*B*Q = D2*[ 0 R ].
vTmp := nanGeneral(p, n, n)
blas64.Gemm(blas.Trans, blas.NoTrans, 1, v, bCopy, 0, vTmp)
vAns := nanGeneral(p, n, n)
@@ -167,7 +167,7 @@ func Dggsvd3Test(t *testing.T, impl Dggsvd3er) {
blas64.Gemm(blas.NoTrans, blas.NoTrans, 1, d2, zeroR, 0, d20r)
if !equalApproxGeneral(vAns, d20r, 1e-13) {
t.Errorf("test %d: V^T*B*Q != D2*[ 0 R ]\nV^T*B*Q:\n%+v\nD2*[ 0 R ]:\n%+v",
t.Errorf("test %d: V*B*Q != D2*[ 0 R ]\nV*B*Q:\n%+v\nD2*[ 0 R ]:\n%+v",
cas, vAns, d20r)
}
}

View File

@@ -122,25 +122,25 @@ func Dggsvp3Test(t *testing.T, impl Dggsvp3er) {
zeroA, zeroB := constructGSVPresults(n, p, m, k, l, a, b)
// Check U^T*A*Q = [ 0 RA ].
// Check U*A*Q = [ 0 RA ].
uTmp := nanGeneral(m, n, n)
blas64.Gemm(blas.Trans, blas.NoTrans, 1, u, aCopy, 0, uTmp)
uAns := nanGeneral(m, n, n)
blas64.Gemm(blas.NoTrans, blas.NoTrans, 1, uTmp, q, 0, uAns)
if !equalApproxGeneral(uAns, zeroA, 1e-14) {
t.Errorf("test %d: U^T*A*Q != [ 0 RA ]\nU^T*A*Q:\n%+v\n[ 0 RA ]:\n%+v",
t.Errorf("test %d: U*A*Q != [ 0 RA ]\nU*A*Q:\n%+v\n[ 0 RA ]:\n%+v",
cas, uAns, zeroA)
}
// Check V^T*B*Q = [ 0 RB ].
// Check V*B*Q = [ 0 RB ].
vTmp := nanGeneral(p, n, n)
blas64.Gemm(blas.Trans, blas.NoTrans, 1, v, bCopy, 0, vTmp)
vAns := nanGeneral(p, n, n)
blas64.Gemm(blas.NoTrans, blas.NoTrans, 1, vTmp, q, 0, vAns)
if !equalApproxGeneral(vAns, zeroB, 1e-14) {
t.Errorf("test %d: V^T*B*Q != [ 0 RB ]\nV^T*B*Q:\n%+v\n[ 0 RB ]:\n%+v",
t.Errorf("test %d: V*B*Q != [ 0 RB ]\nV*B*Q:\n%+v\n[ 0 RB ]:\n%+v",
cas, vAns, zeroB)
}
}

View File

@@ -188,7 +188,7 @@ func testDhseqr(t *testing.T, impl Dhseqrer, i int, test dhseqrTest, job lapack.
ztz := zeros(n, n, n)
blas64.Gemm(blas.NoTrans, blas.NoTrans, 1, z, tz, 0, ztz)
if !equalApproxGeneral(ztz, hCopy, evTol) {
t.Errorf("%v: H != Z T Z^T", prefix)
t.Errorf("%v: H != Z T Z", prefix)
}
}

View File

@@ -212,7 +212,7 @@ func testDlaexc(t *testing.T, impl Dlaexcer, wantq bool, n, j1, n1, n2, extra in
}
}
}
// Check that Q^T TOrig Q == T.
// Check that Q TOrig Q == T.
tq := eye(n, n)
blas64.Gemm(blas.NoTrans, blas.NoTrans, 1, tmatCopy, q, 0, tq)
qtq := eye(n, n)

View File

@@ -89,10 +89,10 @@ func Dlags2Test(t *testing.T, impl Dlags2er) {
}
tmp := blas64.General{Rows: 2, Cols: 2, Stride: 2, Data: make([]float64, 4)}
// Transform A as U^T*A*Q.
// Transform A as U*A*Q.
blas64.Gemm(blas.Trans, blas.NoTrans, 1, u, a, 0, tmp)
blas64.Gemm(blas.NoTrans, blas.NoTrans, 1, tmp, q, 0, a)
// Transform B as V^T*A*Q.
// Transform B as V*A*Q.
blas64.Gemm(blas.Trans, blas.NoTrans, 1, v, b, 0, tmp)
blas64.Gemm(blas.NoTrans, blas.NoTrans, 1, tmp, q, 0, b)
@@ -107,10 +107,10 @@ func Dlags2Test(t *testing.T, impl Dlags2er) {
}
// Check that they are indeed zero.
if !floats.EqualWithinAbsOrRel(gotA, 0, 1e-14, 1e-14) {
t.Errorf("unexpected non-zero value for zero triangle of U^T*A*Q: %v", gotA)
t.Errorf("unexpected non-zero value for zero triangle of U*A*Q: %v", gotA)
}
if !floats.EqualWithinAbsOrRel(gotB, 0, 1e-14, 1e-14) {
t.Errorf("unexpected non-zero value for zero triangle of V^T*B*Q: %v", gotB)
t.Errorf("unexpected non-zero value for zero triangle of V*B*Q: %v", gotB)
}
}
}

View File

@@ -436,7 +436,7 @@ func testDlahqr(t *testing.T, impl Dlahqrer, test dlahqrTest) {
uhu := eye(n, n)
blas64.Gemm(blas.Trans, blas.NoTrans, 1, z, hu, 0, uhu)
if !equalApproxGeneral(uhu, h, 10*tol) {
t.Errorf("%v: Z^T*(initial H)*Z and (final H) are not equal", prefix)
t.Errorf("%v: Z*(initial H)*Z and (final H) are not equal", prefix)
}
}
}

View File

@@ -159,7 +159,7 @@ func Dlahr2Test(t *testing.T, impl Dlahr2er) {
if !isOrthogonal(q) {
t.Errorf("%v: Q is not orthogonal", prefix)
}
// Construct Q as the product Q = I - V*T*V^T.
// Construct Q as the product Q = I - V*T*V.
qwant := blas64.General{
Rows: n - k + 1,
Cols: n - k + 1,
@@ -171,7 +171,7 @@ func Dlahr2Test(t *testing.T, impl Dlahr2er) {
}
blas64.Gemm(blas.NoTrans, blas.Trans, -1, vt, v, 1, qwant)
if !isOrthogonal(qwant) {
t.Errorf("%v: Q = I - V*T*V^T is not orthogonal", prefix)
t.Errorf("%v: Q = I - V*T*V is not orthogonal", prefix)
}
// Compare Q and QWant. Note that since Q is

View File

@@ -97,17 +97,17 @@ func testDlaln2(t *testing.T, impl Dlaln2er, trans bool, na, nw, extra int, rnd
// Compute a complex matrix
// M := ca * A - w * D
// or
// M := ca * A^T - w * D.
// M := ca * A - w * D.
m := make([]complex128, na*na)
if trans {
// M = ca * A^T
// M = ca * A
for i := 0; i < na; i++ {
for j := 0; j < na; j++ {
m[i*na+j] = complex(ca*a.Data[j*a.Stride+i], 0)
}
}
} else {
// M = ca * A^T
// M = ca * A
for i := 0; i < na; i++ {
for j := 0; j < na; j++ {
m[i*na+j] = complex(ca*a.Data[i*a.Stride+j], 0)

View File

@@ -444,7 +444,7 @@ func testDlaqr04(t *testing.T, impl Dlaqr04er, test dlaqr04Test, optwork bool, r
zhz := eye(n, n)
blas64.Gemm(blas.Trans, blas.NoTrans, 1, z, hz, 0, zhz)
if !equalApproxGeneral(zhz, h, 10*tol) {
t.Errorf("%v: Z^T*(initial H)*Z and (final H) are not equal", prefix)
t.Errorf("%v: Z*(initial H)*Z and (final H) are not equal", prefix)
}
}
}

View File

@@ -359,11 +359,11 @@ func testDlaqr23(t *testing.T, impl Dlaqr23er, test dlaqr23Test, opt bool, recur
// Compute H_in*Z.
blas64.Gemm(blas.NoTrans, blas.NoTrans, 1, test.h, z, 0, hu)
uhu := eye(n, n)
// Compute Z^T*H_in*Z.
// Compute Z*H_in*Z.
blas64.Gemm(blas.Trans, blas.NoTrans, 1, z, hu, 0, uhu)
// Compare Z^T*H_in*Z and H_out.
// Compare Z*H_in*Z and H_out.
if !equalApproxGeneral(uhu, h, 10*tol) {
t.Errorf("%v: Z^T*(initial H)*Z and (final H) are not equal", prefix)
t.Errorf("%v: Z*(initial H)*Z and (final H) are not equal", prefix)
}
}
}

View File

@@ -189,7 +189,7 @@ func testDlaqr5(t *testing.T, impl Dlaqr5er, n, extra, kacc22 int, rnd *rand.Ran
if !isOrthogonal(z) {
t.Errorf("%v: Z is not orthogonal", prefix)
}
// Construct Z^T * HOrig * Z and check that it is equal to H from Dlaqr5.
// Construct Z * HOrig * Z and check that it is equal to H from Dlaqr5.
hz := blas64.General{
Rows: n,
Cols: n,
@@ -208,7 +208,7 @@ func testDlaqr5(t *testing.T, impl Dlaqr5er, n, extra, kacc22 int, rnd *rand.Ran
for j := 0; j < n; j++ {
diff := zhz.Data[i*zhz.Stride+j] - h.Data[i*h.Stride+j]
if math.Abs(diff) > 1e-13 {
t.Errorf("%v: Z^T*HOrig*Z and H are not equal, diff at [%v,%v]=%v", prefix, i, j, diff)
t.Errorf("%v: Z*HOrig*Z and H are not equal, diff at [%v,%v]=%v", prefix, i, j, diff)
}
}
}

View File

@@ -108,7 +108,7 @@ func DlarfgTest(t *testing.T, impl Dlarfger) {
blas64.Gemm(blas.Trans, blas.NoTrans, 1, hmat, hmat, 0, eye)
dist := distFromIdentity(n, eye.Data, n)
if dist > tol {
t.Errorf("H^T * H is not close to I, dist=%v", dist)
t.Errorf("H * H is not close to I, dist=%v", dist)
}
xVec := blas64.Vector{

View File

@@ -115,14 +115,14 @@ func DlarftTest(t *testing.T, impl Dlarfter) {
}
var comp blas64.General
if store == lapack.ColumnWise {
// H = I - V * T * V^T
// H = I - V * T * V
tmp := blas64.General{
Rows: T.Rows,
Cols: vMatT.Cols,
Stride: vMatT.Cols,
Data: make([]float64, T.Rows*vMatT.Cols),
}
// T * V^T
// T * V
blas64.Gemm(blas.NoTrans, blas.NoTrans, 1, T, vMatT, 0, tmp)
comp = blas64.General{
Rows: vMat.Rows,
@@ -130,10 +130,10 @@ func DlarftTest(t *testing.T, impl Dlarfter) {
Stride: tmp.Cols,
Data: make([]float64, vMat.Rows*tmp.Cols),
}
// V * (T * V^T)
// V * (T * V)
blas64.Gemm(blas.NoTrans, blas.NoTrans, 1, vMat, tmp, 0, comp)
} else {
// H = I - V^T * T * V
// H = I - V * T * V
tmp := blas64.General{
Rows: T.Rows,
Cols: vMat.Cols,
@@ -148,10 +148,10 @@ func DlarftTest(t *testing.T, impl Dlarfter) {
Stride: tmp.Cols,
Data: make([]float64, vMatT.Rows*tmp.Cols),
}
// V^T * (T * V)
// V * (T * V)
blas64.Gemm(blas.NoTrans, blas.NoTrans, 1, vMatT, tmp, 0, comp)
}
// I - V^T * T * V
// I - V * T * V
for i := 0; i < comp.Rows; i++ {
for j := 0; j < comp.Cols; j++ {
comp.Data[i*m+j] *= -1

View File

@@ -48,7 +48,7 @@ func testDlarfx(t *testing.T, impl Dlarfxer, side blas.Side, m, n, extra int, rn
ldc := n + extra
c := randomGeneral(m, n, ldc, rnd)
// Compute the matrix H explicitly as H := I - tau * v * v^T.
// Compute the matrix H explicitly as H := I - tau * v * v.
var h blas64.General
if side == blas.Left {
h = eye(m, m+extra)

View File

@@ -56,7 +56,7 @@ func Dlasq1Test(t *testing.T, impl Dlasq1er) {
// Check that they are singular values. The
// singular values are the square roots of the
// eigenvalues of X^T * X
// eigenvalues of X * X
mmCopy := make([]float64, len(mm))
copy(mmCopy, mm)
ipiv := make([]int, n)

View File

@@ -105,7 +105,7 @@ func dlatbsTest(t *testing.T, impl Dlatbser, rnd *rand.Rand, kind int, uplo blas
}
// dlatbsResidual returns the residual for the solution to a scaled triangular
// system of equations A*x = s*b or A^T*x = s*b when A is an n×n triangular
// system of equations A*x = s*b or A*x = s*b when A is an n×n triangular
// band matrix with kd super- or sub-diagonals. The residual is computed as
// norm( op(A)*x - scale*b ) / ( norm(op(A)) * norm(x) ).
//

View File

@@ -100,7 +100,7 @@ func DlatrdTest(t *testing.T, impl Dlatrder) {
}
v.Data[i-1] = 1
// Compute H = I - tau[i-1] * v * v^T.
// Compute H = I - tau[i-1] * v * v.
h := blas64.General{
Rows: n, Cols: n, Stride: n, Data: make([]float64, n*n),
}
@@ -132,7 +132,7 @@ func DlatrdTest(t *testing.T, impl Dlatrder) {
v.Data[j] = a[j*lda+i]
}
// Compute H = I - tau[i] * v * v^T.
// Compute H = I - tau[i] * v * v.
h := blas64.General{
Rows: n, Cols: n, Stride: n, Data: make([]float64, n*n),
}
@@ -164,7 +164,7 @@ func DlatrdTest(t *testing.T, impl Dlatrder) {
// dlatrdCheckDecomposition checks that the first nb rows have been successfully
// reduced.
func dlatrdCheckDecomposition(t *testing.T, uplo blas.Uplo, n, nb int, e, a []float64, lda int, aGen, q blas64.General) bool {
// Compute ans = Q^T * A * Q.
// Compute ans = Q * A * Q.
// ans should be a tridiagonal matrix in the first or last nb rows and
// columns, depending on uplo.
tmp := blas64.General{
@@ -183,7 +183,7 @@ func dlatrdCheckDecomposition(t *testing.T, uplo blas.Uplo, n, nb int, e, a []fl
blas64.Gemm(blas.NoTrans, blas.NoTrans, 1, tmp, q, 0, ans)
// Compare the output of Dlatrd (stored in a and e) with the explicit
// reduction to tridiagonal matrix Q^T * A * Q (stored in ans).
// reduction to tridiagonal matrix Q * A * Q (stored in ans).
if uplo == blas.Upper {
for i := n - nb; i < n; i++ {
for j := 0; j < n; j++ {

View File

@@ -51,7 +51,7 @@ func dlauuTest(t *testing.T, dlauu func(blas.Uplo, int, []float64, int), uplo bl
aCopy := make([]float64, len(a))
copy(aCopy, a)
// Compute U*U^T or L^T*L using Dlauu?.
// Compute U*U or L*L using Dlauu?.
dlauu(uplo, n, a, lda)
if n == 0 {
@@ -85,7 +85,7 @@ func dlauuTest(t *testing.T, dlauu func(blas.Uplo, int, []float64, int), uplo bl
}
}
// Compute U*U^T or L^T*L using Dgemm with U and L
// Compute U*U or L*L using Dgemm with U and L
// represented as dense triangular matrices.
ldwant := n
want := make([]float64, n*ldwant)
@@ -93,14 +93,14 @@ func dlauuTest(t *testing.T, dlauu func(blas.Uplo, int, []float64, int), uplo bl
// Use aCopy as a dense representation of the upper triangular U.
u := aCopy
ldu := lda
// Compute U * U^T and store the result into want.
// Compute U * U and store the result into want.
bi.Dgemm(blas.NoTrans, blas.Trans, n, n, n,
1, u, ldu, u, ldu, 0, want, ldwant)
} else {
// Use aCopy as a dense representation of the lower triangular L.
l := aCopy
ldl := lda
// Compute L^T * L and store the result into want.
// Compute L * L and store the result into want.
bi.Dgemm(blas.Trans, blas.NoTrans, n, n, n,
1, l, ldl, l, ldl, 0, want, ldwant)
}

View File

@@ -138,7 +138,7 @@ func DorgbrTest(t *testing.T, impl Dorgbrer) {
}
nCols = n
ansTmp := constructQPBidiagonal(lapack.ApplyP, ma, na, min(k, n), aCopy, lda, tau)
// Dorgbr actually computes P^T
// Dorgbr actually computes P
ans = transposeGeneral(ansTmp)
}
for i := 0; i < nRows; i++ {

View File

@@ -144,7 +144,7 @@ func DorgtrTest(t *testing.T, impl Dorgtrer) {
}
}
// Compute Q^T * A * Q and store the result in ans.
// Compute Q * A * Q and store the result in ans.
tmp := blas64.General{Rows: n, Cols: n, Stride: n, Data: make([]float64, n*n)}
blas64.Gemm(blas.NoTrans, blas.NoTrans, 1, aMat, q, 0, tmp)
ans := blas64.General{Rows: n, Cols: n, Stride: n, Data: make([]float64, n*n)}

View File

@@ -49,7 +49,7 @@ func dpbtf2Test(t *testing.T, impl Dpbtf2er, rnd *rand.Rand, uplo blas.Uplo, n,
t.Fatalf("%v: bad test matrix, Dpbtf2 failed", name)
}
// Reconstruct an symmetric band matrix from the U^T*U or L*L^T factorization, overwriting abFac.
// Reconstruct an symmetric band matrix from the U*U or L*L factorization, overwriting abFac.
dsbmm(uplo, n, kd, abFac, ldab)
// Compute and check the max-norm distance between the reconstructed and original matrix A.

View File

@@ -54,7 +54,7 @@ func dpbtrfTest(t *testing.T, impl Dpbtrfer, uplo blas.Uplo, n, kd int, ldab int
t.Fatalf("%v: bad test matrix, Dpbtrf failed", name)
}
// Reconstruct an symmetric band matrix from the U^T*U or L*L^T factorization, overwriting abFac.
// Reconstruct an symmetric band matrix from the U*U or L*L factorization, overwriting abFac.
dsbmm(uplo, n, kd, abFac, ldab)
// Compute and check the max-norm distance between the reconstructed and original matrix A.
@@ -65,15 +65,15 @@ func dpbtrfTest(t *testing.T, impl Dpbtrfer, uplo blas.Uplo, n, kd int, ldab int
}
// dsbmm computes a symmetric band matrix A
// A = U^T*U if uplo == blas.Upper,
// A = L*L^T if uplo == blas.Lower,
// A = U*U if uplo == blas.Upper,
// A = L*L if uplo == blas.Lower,
// where U and L is an upper, respectively lower, triangular band matrix
// stored on entry in ab. The result is stored in-place into ab.
func dsbmm(uplo blas.Uplo, n, kd int, ab []float64, ldab int) {
bi := blas64.Implementation()
switch uplo {
case blas.Upper:
// Compute the product U^T * U.
// Compute the product U * U.
for k := n - 1; k >= 0; k-- {
klen := min(kd, n-k-1) // Number of stored off-diagonal elements in the row
// Add a multiple of row k of the factor U to each of rows k+1 through n.
@@ -84,7 +84,7 @@ func dsbmm(uplo blas.Uplo, n, kd int, ab []float64, ldab int) {
bi.Dscal(klen+1, ab[k*ldab], ab[k*ldab:], 1)
}
case blas.Lower:
// Compute the product L * L^T.
// Compute the product L * L.
for k := n - 1; k >= 0; k-- {
kc := max(0, kd-k) // Index of the first valid element in the row
klen := kd - kc // Number of stored off-diagonal elements in the row

View File

@@ -74,7 +74,7 @@ func dpbtrsTest(t *testing.T, impl Dpbtrser, rnd *rand.Rand, uplo blas.Uplo, n,
}
}
// Solve U^T * U * X = B or L * L^T * X = B.
// Solve U * U * X = B or L * L * X = B.
impl.Dpbtrs(uplo, n, kd, nrhs, abFac, ldab, b, ldb)
xGot := b

View File

@@ -55,7 +55,7 @@ func DpotrfTest(t *testing.T, impl Dpotrfer) {
Dlatm1(d, 4, 10000, false, 1, rnd)
// Construct a positive definite matrix A as
// A = U * D * U^T
// A = U * D * U
// where U is a random orthogonal matrix.
lda := test.lda
if lda == 0 {
@@ -93,10 +93,10 @@ func DpotrfTest(t *testing.T, impl Dpotrfer) {
ans := make([]float64, len(a))
switch uplo {
case blas.Upper:
// Multiply U^T * U.
// Multiply U * U.
bi.Dsyrk(uplo, blas.Trans, n, n, 1, a, lda, 0, ans, lda)
case blas.Lower:
// Multiply L * L^T.
// Multiply L * L.
bi.Dsyrk(uplo, blas.NoTrans, n, n, 1, a, lda, 0, ans, lda)
}

View File

@@ -43,7 +43,7 @@ func DpotriTest(t *testing.T, impl Dpotrier) {
Dlatm1(d, 3, 10000, false, 2, rnd)
// Construct a positive definite matrix A as
// A = U * D * U^T
// A = U * D * U
// where U is a random orthogonal matrix.
a := make([]float64, n*lda)
Dlagsy(n, 0, d, a, lda, rnd, make([]float64, 2*n))

View File

@@ -122,7 +122,7 @@ func Dsytd2Test(t *testing.T, impl Dsytd2er) {
t.Errorf("Q not orthogonal")
}
// Compute Q^T * A * Q.
// Compute Q * A * Q.
aMat := blas64.General{
Rows: n,
Cols: n,

View File

@@ -145,7 +145,7 @@ func DsytrdTest(t *testing.T, impl Dsytrder) {
}
}
// Compute Q^T * A * Q.
// Compute Q * A * Q.
tmp := zeros(n, n, n)
blas64.Gemm(blas.Trans, blas.NoTrans, 1, q, aCopy, 0, tmp)
got := zeros(n, n, n)
@@ -153,7 +153,7 @@ func DsytrdTest(t *testing.T, impl Dsytrder) {
// Compare with T.
if !equalApproxGeneral(got, tMat, tol) {
t.Errorf("%v: Q^T*A*Q != T", prefix)
t.Errorf("%v: Q*A*Q != T", prefix)
}
}
}

View File

@@ -135,7 +135,7 @@ func DtgsjaTest(t *testing.T, impl Dtgsjaer) {
zeroR, d1, d2 := constructGSVDresults(n, p, m, k, l, a, b, alpha, beta)
// Check U^T*A*Q = D1*[ 0 R ].
// Check U*A*Q = D1*[ 0 R ].
uTmp := nanGeneral(m, n, n)
blas64.Gemm(blas.Trans, blas.NoTrans, 1, u, aCopy, 0, uTmp)
uAns := nanGeneral(m, n, n)
@@ -145,11 +145,11 @@ func DtgsjaTest(t *testing.T, impl Dtgsjaer) {
blas64.Gemm(blas.NoTrans, blas.NoTrans, 1, d1, zeroR, 0, d10r)
if !equalApproxGeneral(uAns, d10r, 1e-14) {
t.Errorf("test %d: U^T*A*Q != D1*[ 0 R ]\nU^T*A*Q:\n%+v\nD1*[ 0 R ]:\n%+v",
t.Errorf("test %d: U*A*Q != D1*[ 0 R ]\nU*A*Q:\n%+v\nD1*[ 0 R ]:\n%+v",
cas, uAns, d10r)
}
// Check V^T*B*Q = D2*[ 0 R ].
// Check V*B*Q = D2*[ 0 R ].
vTmp := nanGeneral(p, n, n)
blas64.Gemm(blas.Trans, blas.NoTrans, 1, v, bCopy, 0, vTmp)
vAns := nanGeneral(p, n, n)
@@ -159,7 +159,7 @@ func DtgsjaTest(t *testing.T, impl Dtgsjaer) {
blas64.Gemm(blas.NoTrans, blas.NoTrans, 1, d2, zeroR, 0, d20r)
if !equalApproxGeneral(vAns, d20r, 1e-14) {
t.Errorf("test %d: V^T*B*Q != D2*[ 0 R ]\nV^T*B*Q:\n%+v\nD2*[ 0 R ]:\n%+v",
t.Errorf("test %d: V*B*Q != D2*[ 0 R ]\nV*B*Q:\n%+v\nD2*[ 0 R ]:\n%+v",
cas, vAns, d20r)
}
}

View File

@@ -209,12 +209,12 @@ func testDtrexc(t *testing.T, impl Dtrexcer, compq lapack.UpdateSchurComp, tmat
}
}
}
// Check that Q^T TOrig Q == T.
// Check that Q TOrig Q == T.
tq := eye(n, n)
blas64.Gemm(blas.NoTrans, blas.NoTrans, 1, tmatCopy, q, 0, tq)
qtq := eye(n, n)
blas64.Gemm(blas.Trans, blas.NoTrans, 1, q, tq, 0, qtq)
if !equalApproxGeneral(qtq, tmat, tol) {
t.Errorf("%v: Q^T (initial T) Q and (final T) are not equal", prefix)
t.Errorf("%v: Q (initial T) Q and (final T) are not equal", prefix)
}
}

View File

@@ -510,7 +510,7 @@ func constructH(tau []float64, v blas64.General, store lapack.StoreV, direct lap
for i := 0; i < m; i++ {
hi.Data[i*m+i] = 1
}
// hi = I - tau * v * v^T
// hi = I - tau * v * v
blas64.Ger(-tau[i], vec, vec, hi)
hcopy := blas64.General{
@@ -613,7 +613,7 @@ func constructQK(kind string, m, n, k int, a []float64, lda int, tau []float64)
// decomposition) is input in aCopy.
//
// checkBidiagonal constructs the V and U matrices, and from them constructs Q
// and P. Using these constructions, it checks that Q^T * A * P and checks that
// and P. Using these constructions, it checks that Q * A * P and checks that
// the result is bidiagonal.
func checkBidiagonal(t *testing.T, m, n, nb int, a []float64, lda int, d, e, tauP, tauQ, aCopy []float64) {
// Check the answer.
@@ -621,7 +621,7 @@ func checkBidiagonal(t *testing.T, m, n, nb int, a []float64, lda int, d, e, tau
qMat := constructQPBidiagonal(lapack.ApplyQ, m, n, nb, a, lda, tauQ)
pMat := constructQPBidiagonal(lapack.ApplyP, m, n, nb, a, lda, tauP)
// Compute Q^T * A * P.
// Compute Q * A * P.
aMat := blas64.General{
Rows: m,
Cols: n,
@@ -1052,7 +1052,7 @@ func randSymBand(uplo blas.Uplo, n, kd, ldab int, rnd *rand.Rand) []float64 {
ab[i*ldab+kd] = float64(n) + rnd.Float64()
}
}
// Compute U^T*U or L*L^T. The resulting (symmetric) matrix A will be
// Compute U*U or L*L. The resulting (symmetric) matrix A will be
// positive definite and well-conditioned.
dsbmm(uplo, n, kd, ab, ldab)
return ab
@@ -1324,9 +1324,9 @@ func isRightEigenvectorOf(a blas64.General, xRe, xIm []float64, lambda complex12
//
// A left eigenvector corresponding to a complex eigenvalue λ is a complex
// non-zero vector y such that
// y^H A = λ y^H,
// y A = λ y,
// which is equivalent for real A to
// A^T y = conj(λ) y,
// A y = conj(λ) y,
func isLeftEigenvectorOf(a blas64.General, yRe, yIm []float64, lambda complex128, tol float64) bool {
if a.Rows != a.Cols {
panic("matrix not square")
@@ -1340,7 +1340,7 @@ func isLeftEigenvectorOf(a blas64.General, yRe, yIm []float64, lambda complex128
n := a.Rows
// Compute A^T real(y) and store the result into yReAns.
// Compute A real(y) and store the result into yReAns.
yReAns := make([]float64, n)
blas64.Gemv(blas.Trans, 1, a, blas64.Vector{Data: yRe, Inc: 1}, 0, blas64.Vector{Data: yReAns, Inc: 1})
@@ -1358,7 +1358,7 @@ func isLeftEigenvectorOf(a blas64.General, yRe, yIm []float64, lambda complex128
// Complex eigenvector, and real or complex eigenvalue.
// Compute A^T imag(y) and store the result into yImAns.
// Compute A imag(y) and store the result into yImAns.
yImAns := make([]float64, n)
blas64.Gemv(blas.Trans, 1, a, blas64.Vector{Data: yIm, Inc: 1}, 0, blas64.Vector{Data: yImAns, Inc: 1})

View File

@@ -124,7 +124,7 @@ func Dlatm1(dst []float64, mode int, cond float64, rsign bool, dist int, rnd *ra
// Dlagsy generates an n×n symmetric matrix A, by pre- and post- multiplying a
// real diagonal matrix D with a random orthogonal matrix:
// A = U * D * U^T.
// A = U * D * U.
//
// work must have length at least 2*n, otherwise Dlagsy will panic.
//
@@ -317,7 +317,7 @@ func dlarnv(dst []float64, dist int, rnd *rand.Rand) {
// trans specifies whether the matrix A or its transpose will be used.
//
// If imat is greater than 10, dlattr also generates the right hand side of the
// linear system A*x=b, or A^T*x=b. Valid values of imat are 7, and all between 11
// linear system A*x=b, or A*x=b. Valid values of imat are 7, and all between 11
// and 19, inclusive.
//
// b mush have length n, and work must have length 3*n, and dlattr will panic

View File

@@ -28,10 +28,10 @@ func TestDlagsy(t *testing.T) {
// Allocate an n×n symmetric matrix A and fill it with NaNs.
a := nanSlice(n * lda)
work := make([]float64, 2*n)
// Compute A = U * D * U^T where U is a random orthogonal matrix.
// Compute A = U * D * U where U is a random orthogonal matrix.
Dlagsy(n, 0, d, a, lda, rnd, work)
// A should be the identity matrix because
// A = U * D * U^T = U * I * U^T = U * U^T = I.
// A = U * D * U = U * I * U = U * U = I.
dist := distFromIdentity(n, a, lda)
if dist > tol {
t.Errorf("Case n=%v,lda=%v: |A-I|=%v is too large", n, lda, dist)

View File

@@ -126,9 +126,9 @@ func (c Circulant) Eigenvalues() []complex128 {
}
// Clement is a generally non-symmetric matrix given by
// A[i,j] = i+1, if j == i+1,
// = n-i, if j == i-1,
// = 0, otherwise.
// A[i,j] = i+1 if j == i+1,
// = n-i if j == i-1,
// = 0 otherwise.
// For example, for n=5,
// [ . 1 . . . ]
// [ 4 . 2 . . ]
@@ -162,8 +162,8 @@ func (c Clement) Eigenvalues() []complex128 {
}
// Creation is a singular non-symmetric matrix given by
// A[i,j] = i, if j == i-1,
// = 0, otherwise.
// A[i,j] = i if j == i-1,
// = 0 otherwise.
// For example, for n=5,
// [ . . . . . ]
// [ 1 . . . . ]
@@ -187,8 +187,8 @@ func (c Creation) Eigenvalues() []complex128 {
}
// Diagonal is a diagonal matrix given by
// A[i,j] = i+1, if i == j,
// = 0, otherwise.
// A[i,j] = i+1 if i == j,
// = 0 otherwise.
// For example, for n=5,
// [ 1 . . . . ]
// [ . 2 . . . ]
@@ -217,8 +217,8 @@ func (d Diagonal) Eigenvalues() []complex128 {
}
// Downshift is a non-singular upper Hessenberg matrix given by
// A[i,j] = 1, if (i-j+n)%n == 1,
// = 0, otherwise.
// A[i,j] = 1 if (i-j+n)%n == 1,
// = 0 otherwise.
// For example, for n=5,
// [ . . . . 1 ]
// [ 1 . . . . ]