1 // Copyright ©2015 The Gonum Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
10 "gonum.org/v1/gonum/lapack"
13 // Dlascl multiplies an m×n matrix by the scalar cto/cfrom.
15 // cfrom must not be zero, and cto and cfrom must not be NaN, otherwise Dlascl
18 // Dlascl is an internal routine. It is exported for testing purposes.
19 func (impl Implementation) Dlascl(kind lapack.MatrixType, kl, ku int, cfrom, cto float64, m, n int, a []float64, lda int) {
20 checkMatrix(m, n, a, lda)
24 if math.IsNaN(cfrom) || math.IsNaN(cto) {
34 cfrom1 := cfromc * smlnum
46 // ctoc is either 0 or inf.
50 } else if math.Abs(cfrom1) > math.Abs(ctoc) && ctoc != 0 {
54 } else if math.Abs(ctol) > math.Abs(cfromc) {
65 panic("lapack: not implemented")
67 for i := 0; i < m; i++ {
68 for j := 0; j < n; j++ {
69 a[i*lda+j] = a[i*lda+j] * mul
73 for i := 0; i < m; i++ {
74 for j := i; j < n; j++ {
75 a[i*lda+j] = a[i*lda+j] * mul
79 for i := 0; i < m; i++ {
80 for j := 0; j <= min(i, n-1); j++ {
81 a[i*lda+j] = a[i*lda+j] * mul