forked from bemasher/fftw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconstants.go
92 lines (81 loc) · 2.04 KB
/
constants.go
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package fftw
// #include "fftw3.h"
import "C"
import (
"strings"
)
// Planning flags provided by FFTW.
type PlanFlag uint
const (
Measure PlanFlag = C.FFTW_MEASURE
DestroyInput PlanFlag = C.FFTW_DESTROY_INPUT
Unaligned PlanFlag = C.FFTW_UNALIGNED
ConserveMemory PlanFlag = C.FFTW_CONSERVE_MEMORY
Exhaustive PlanFlag = C.FFTW_EXHAUSTIVE
PreserveInput PlanFlag = C.FFTW_PRESERVE_INPUT
Patient PlanFlag = C.FFTW_PATIENT
Estimate PlanFlag = C.FFTW_ESTIMATE
WisdomOnly PlanFlag = C.FFTW_WISDOM_ONLY
)
func (p PlanFlag) String() (s string) {
var flags []string
switch {
case p&Measure != 0:
flags = append(flags, "Measure")
case p&DestroyInput != 0:
flags = append(flags, "DestroyInput")
case p&Unaligned != 0:
flags = append(flags, "Unaligned")
case p&ConserveMemory != 0:
flags = append(flags, "ConserveMemory")
case p&Exhaustive != 0:
flags = append(flags, "Exhaustive")
case p&PreserveInput != 0:
flags = append(flags, "PreserveInput")
case p&Patient != 0:
flags = append(flags, "Patient")
case p&Estimate != 0:
flags = append(flags, "Estimate")
case p&WisdomOnly != 0:
flags = append(flags, "WisdomOnly")
}
if len(flags) == 0 {
return "NA"
}
return strings.Join(flags, "|")
}
// Specifies direction of transform, only used for full-complex DFT.
type Direction int
const (
Forward Direction = C.FFTW_FORWARD
Backward Direction = C.FFTW_BACKWARD
)
func (d Direction) String() string {
switch d {
case Forward:
return "Forward"
case Backward:
return "Backward"
default:
return "Unknown"
}
}
// Specifies locality of data for transform.
type Locality int
const (
InPlace Locality = iota // Allocate a single array and perform transform in-place.
OutOfPlace // Allocates two separate arrays.
PreAlloc // Arrays are provided to the planner pre-allocated.
)
func (l Locality) String() string {
switch l {
case InPlace:
return "InPlace"
case OutOfPlace:
return "OutOfPlace"
case PreAlloc:
return "PreAlloc"
default:
return "Unknown"
}
}