mirror of
https://github.com/gonum/gonum.git
synced 2025-10-15 03:30:39 +08:00
native: reduce indentation in Dlatrs
This commit is contained in:
@@ -55,7 +55,8 @@ func (impl Implementation) Dlatrs(uplo blas.Uplo, trans blas.Transpose, diag bla
|
||||
bi := blas64.Implementation()
|
||||
if !normin {
|
||||
if upper {
|
||||
for j := 0; j < n; j++ {
|
||||
cnorm[0] = 0
|
||||
for j := 1; j < n; j++ {
|
||||
cnorm[j] = bi.Dasum(j, a[j:], lda)
|
||||
}
|
||||
} else {
|
||||
@@ -95,14 +96,14 @@ func (impl Implementation) Dlatrs(uplo blas.Uplo, trans blas.Transpose, diag bla
|
||||
// Compute the growth in A * x = b.
|
||||
if tscal != 1 {
|
||||
grow = 0
|
||||
goto Finish
|
||||
goto Solve
|
||||
}
|
||||
if nonUnit {
|
||||
grow = 1 / math.Max(xbnd, smlnum)
|
||||
xbnd = grow
|
||||
for j := jfirst; j != jlast; j += jinc {
|
||||
if grow <= smlnum {
|
||||
goto Finish
|
||||
goto Solve
|
||||
}
|
||||
tjj := math.Abs(a[j*lda+j])
|
||||
xbnd = math.Min(xbnd, math.Min(1, tjj)*grow)
|
||||
@@ -117,7 +118,7 @@ func (impl Implementation) Dlatrs(uplo blas.Uplo, trans blas.Transpose, diag bla
|
||||
grow = math.Min(1, 1/math.Max(xbnd, smlnum))
|
||||
for j := jfirst; j != jlast; j += jinc {
|
||||
if grow <= smlnum {
|
||||
goto Finish
|
||||
goto Solve
|
||||
}
|
||||
grow *= 1 / (1 + cnorm[j])
|
||||
}
|
||||
@@ -134,14 +135,14 @@ func (impl Implementation) Dlatrs(uplo blas.Uplo, trans blas.Transpose, diag bla
|
||||
}
|
||||
if tscal != 1 {
|
||||
grow = 0
|
||||
goto Finish
|
||||
goto Solve
|
||||
}
|
||||
if nonUnit {
|
||||
grow = 1 / (math.Max(xbnd, smlnum))
|
||||
xbnd = grow
|
||||
for j := jfirst; j != jlast; j += jinc {
|
||||
if grow <= smlnum {
|
||||
goto Finish
|
||||
goto Solve
|
||||
}
|
||||
xj := 1 + cnorm[j]
|
||||
grow = math.Min(grow, xbnd/xj)
|
||||
@@ -155,7 +156,7 @@ func (impl Implementation) Dlatrs(uplo blas.Uplo, trans blas.Transpose, diag bla
|
||||
grow = math.Min(1, 1/math.Max(xbnd, smlnum))
|
||||
for j := jfirst; j != jlast; j += jinc {
|
||||
if grow <= smlnum {
|
||||
goto Finish
|
||||
goto Solve
|
||||
}
|
||||
xj := 1 + cnorm[j]
|
||||
grow /= xj
|
||||
@@ -163,11 +164,18 @@ func (impl Implementation) Dlatrs(uplo blas.Uplo, trans blas.Transpose, diag bla
|
||||
}
|
||||
}
|
||||
|
||||
Finish:
|
||||
Solve:
|
||||
if grow*tscal > smlnum {
|
||||
// Use the Level 2 BLAS solve if the reciprocal of the bound on
|
||||
// elements of X is not too small.
|
||||
bi.Dtrsv(uplo, trans, diag, n, a, lda, x, 1)
|
||||
// TODO(btracey): check if this else is everything
|
||||
} else {
|
||||
if tscal != 1 {
|
||||
bi.Dscal(n, 1/tscal, cnorm, 1)
|
||||
}
|
||||
return scale
|
||||
}
|
||||
|
||||
// Use a Level 1 BLAS solve, scaling intermediate results.
|
||||
if xmax > bignum {
|
||||
scale = bignum / xmax
|
||||
bi.Dscal(n, scale, x, 1)
|
||||
@@ -333,7 +341,6 @@ Finish:
|
||||
}
|
||||
}
|
||||
scale /= tscal
|
||||
}
|
||||
if tscal != 1 {
|
||||
bi.Dscal(n, 1/tscal, cnorm, 1)
|
||||
}
|
||||
|
Reference in New Issue
Block a user