lapack/{gonum,testlapack}: apply semgrep-go suggestions (#1743)

This commit is contained in:
Patricio Whittingslow
2021-11-16 12:51:06 -03:00
committed by GitHub
parent 27ed1a9eeb
commit 030e69b6a7
2 changed files with 5 additions and 9 deletions

View File

@@ -174,12 +174,12 @@ func (impl Implementation) Dtrexc(compq lapack.UpdateSchurComp, n int, t []float
here := ifst here := ifst
for here > ilst { for here > ilst {
// Swap block with next one above. // Swap block with next one above.
nbnext := 1
if here >= 2 && t[(here-1)*ldt+here-2] != 0 {
nbnext = 2
}
if nbf == 1 || nbf == 2 { if nbf == 1 || nbf == 2 {
// Current block either 1×1 or 2×2. // Current block either 1×1 or 2×2.
nbnext := 1
if here-2 >= 0 && t[(here-1)*ldt+here-2] != 0 {
nbnext = 2
}
ok = impl.Dlaexc(wantq, n, t, ldt, q, ldq, here-nbnext, nbnext, nbf, work) ok = impl.Dlaexc(wantq, n, t, ldt, q, ldq, here-nbnext, nbnext, nbf, work)
if !ok { if !ok {
return ifst, here, false return ifst, here, false
@@ -194,10 +194,6 @@ func (impl Implementation) Dtrexc(compq lapack.UpdateSchurComp, n int, t []float
// Current block consists of two 1×1 blocks each of // Current block consists of two 1×1 blocks each of
// which must be swapped individually. // which must be swapped individually.
nbnext := 1
if here-2 >= 0 && t[(here-1)*ldt+here-2] != 0 {
nbnext = 2
}
ok = impl.Dlaexc(wantq, n, t, ldt, q, ldq, here-nbnext, nbnext, 1, work) ok = impl.Dlaexc(wantq, n, t, ldt, q, ldq, here-nbnext, nbnext, 1, work)
if !ok { if !ok {
return ifst, here, false return ifst, here, false

View File

@@ -175,7 +175,7 @@ func dtrexcTest(t *testing.T, impl Dtrexcer, rnd *rand.Rand, n, ifst, ilst, extr
if modMin <= j && j < modMax { if modMin <= j && j < modMax {
continue continue
} }
if q.Data[i*q.Stride+j]-qCopy.Data[i*qCopy.Stride+j] != 0 { if q.Data[i*q.Stride+j] != qCopy.Data[i*qCopy.Stride+j] {
t.Errorf("%v: unexpected modification of Q[%v,%v]", name, i, j) t.Errorf("%v: unexpected modification of Q[%v,%v]", name, i, j)
} }
} }