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.
7 // Ilaenv returns algorithm tuning parameters for the algorithm given by the
8 // input string. ispec specifies the parameter to return:
9 // 1: The optimal block size for a blocked algorithm.
10 // 2: The minimum block size for a blocked algorithm.
11 // 3: The block size of unprocessed data at which a blocked algorithm should
12 // crossover to an unblocked version.
13 // 4: The number of shifts.
14 // 5: The minimum column dimension for blocking to be used.
15 // 6: The crossover point for SVD (to use QR factorization or not).
16 // 7: The number of processors.
17 // 8: The crossover point for multi-shift in QR and QZ methods for non-symmetric eigenvalue problems.
18 // 9: Maximum size of the subproblems in divide-and-conquer algorithms.
19 // 10: ieee NaN arithmetic can be trusted not to trap.
20 // 11: infinity arithmetic can be trusted not to trap.
21 // 12...16: parameters for Dhseqr and related functions. See Iparmq for more
24 // Ilaenv is an internal routine. It is exported for testing purposes.
25 func (impl Implementation) Ilaenv(ispec int, s string, opts string, n1, n2, n3, n4 int) int {
26 // TODO(btracey): Replace this with a constant lookup? A list of constants?
27 sname := s[0] == 'S' || s[0] == 'D'
28 cname := s[0] == 'C' || s[0] == 'Z'
30 panic("lapack: bad name")
38 panic("lapack: bad ispec")
42 panic("lapack: bad function name")
46 panic("lapack: bad function name")
52 case "QRF", "RQF", "LQF", "QLF":
76 panic("lapack: bad function name")
86 panic("lapack: bad function name")
100 panic("lapack: bad function name")
111 panic("lapack: bad function name")
115 panic("lapack: bad function name")
116 case "QR", "RQ", "LQ", "QL", "HR", "TR", "BR":
122 panic("lapack: bad function name")
123 case "QR", "RQ", "LQ", "QL", "HR", "TR", "BR":
130 panic("lapack: bad function name")
134 panic("lapack: bad function name")
135 case "QR", "RQ", "LQ", "QL", "HR", "TR", "BR":
141 panic("lapack: bad function name")
142 case "QR", "RQ", "LQ", "QL", "HR", "TR", "BR":
149 panic("lapack: bad function name")
165 panic("lapack: bad function name")
181 panic("lapack: bad function name")
196 panic("lapack: bad function name")
204 if sname && c3 == "EBZ" {
207 panic("lapack: bad function name")
212 panic("lapack: bad function name")
216 panic("lapack: bad function name")
217 case "QRF", "RQF", "LQF", "QLF":
241 panic("lapack: bad function name")
251 panic("lapack: bad function name")
257 panic("lapack: bad function name")
260 panic("lapack: bad function name")
264 panic("lapack: bad function name")
268 panic("lapack: bad function name")
269 case "QR", "RQ", "LQ", "QL", "HR", "TR", "BR":
275 panic("lapack: bad function name")
276 case "QR", "RQ", "LQ", "QL", "HR", "TR", "BR":
283 panic("lapack: bad function name")
287 panic("lapack: bad function name")
288 case "QR", "RQ", "LQ", "QL", "HR", "TR", "BR":
294 panic("lapack: bad function name")
295 case "QR", "RQ", "LQ", "QL", "HR", "TR", "BR":
303 panic("lapack: bad function name")
307 panic("lapack: bad function name")
308 case "QRF", "RQF", "LQF", "QLF":
325 if sname && c3 == "TRD" {
328 panic("lapack: bad function name")
333 panic("lapack: bad function name")
337 panic("lapack: bad function name")
341 panic("lapack: bad function name")
342 case "QR", "RQ", "LQ", "QL", "HR", "TR", "BR":
349 panic("lapack: bad function name")
353 panic("lapack: bad function name")
354 case "QR", "RQ", "LQ", "QL", "HR", "TR", "BR":
366 // Used by xGELSS and xGESVD
367 return int(float64(min(n1, n2)) * 1.6)
375 // used by xGELSD and xGESDD
378 // Go guarantees ieee
381 // Go guarantees ieee
383 case 12, 13, 14, 15, 16:
384 // Dhseqr and related functions for eigenvalue problems.
385 return impl.Iparmq(ispec, s, opts, n1, n2, n3, n4)