-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgorf.go
More file actions
72 lines (61 loc) · 1.54 KB
/
gorf.go
File metadata and controls
72 lines (61 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package gorf
import (
"math/cmplx"
"github.com/whipstein/golinalg/golapack/gltest"
"github.com/whipstein/golinalg/mat"
)
type RFParam int
const (
S RFParam = iota
A
H
Y
Z
T
)
type Encoding int
const (
RI Encoding = iota
MA
DB
)
var cmf = mat.CMatrixFactory()
var cvf = mat.CVectorFactory()
var mf = mat.MatrixFactory()
var vf = mat.VectorFactory()
// var opts = mat.NewMatOptsCol()
var opts = mat.NewMatOpts()
// zslect returns .TRUE. if the eigenvalue Z is to be selected,
// otherwise it returns .FALSE.
// It is used by ZCHK41 to test if ZGEES successfully sorts eigenvalues,
// and by ZCHK43 to test if ZGEESX successfully sorts eigenvalues.
//
// The common block /SSLCT/ controls how eigenvalues are selected.
// If SELOPT = 0, then ZSLECT return .TRUE. when real(Z) is less than
// zero, and .FALSE. otherwise.
// If SELOPT is at least 1, ZSLECT returns SELVAL(SELOPT) and adds 1
// to SELOPT, cycling back to 1 at SELMAX.
func zslect(z complex128) (zslectReturn bool) {
var rmin, x, zero float64
var i int
zero = 0.0
selopt := &gltest.Common.Sslct.Selopt
seldim := &gltest.Common.Sslct.Seldim
selval := &gltest.Common.Sslct.Selval
selwi := gltest.Common.Sslct.Selwi
selwr := gltest.Common.Sslct.Selwr
if (*selopt) == 0 {
zslectReturn = (real(z) < zero)
} else {
rmin = cmplx.Abs(z - complex(selwr.Get(0), selwi.Get(0)))
zslectReturn = (*selval)[0]
for i = 2; i <= (*seldim); i++ {
x = cmplx.Abs(z - complex(selwr.Get(i-1), selwi.Get(i-1)))
if x <= rmin {
rmin = x
zslectReturn = (*selval)[i-1]
}
}
}
return
}