fftw3 0.2 → 0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -1,4 +1,4 @@
1
- =module NumRu::FFTW3
1
+ =module FFTW3
2
2
 
3
3
  Fast Fourier Transforms by using ((<FFTW|URL:http://www.fftw.org>)) Ver.3.
4
4
 
@@ -25,60 +25,35 @@ NO WARRANTY
25
25
 
26
26
  ==Installation
27
27
 
28
- * Install ((<FFTW|URL:http://www.fftw.org>)) Ver.3.
29
-
30
- * NOTE:
31
- To activate the single-float transform, you have to install FFTW3 with
32
- the single-float compilation, in addition to the default double-float
33
- version. This can be done by configuring FFTW3 with
34
- the --enable-float option, and install it again. The single-float
35
- version will coexist with the double-float version.
36
- If you do not install the single-float version, FFT is always done
37
- with the double precision, which is not bad if you are not time- and
38
- memory-conscious.
39
-
40
- * Install ((<NArray|URL:http://www.ruby-lang.org/en/raa-list.rhtml?name=NArray>)).
41
-
42
- * Then, install this library as follows (replace "version" with
43
- the actual version number):
44
-
45
- % tar xvzf fftw3-version.tar.gz
46
- % cd fftw3-version
47
- % ruby extconf.rb
48
- % make
49
- % make site-install
50
- Or
51
- % make install
52
- (If you are using Ruby 1.8, make install is the same make site-install.)
28
+ Install fftw3 (in OSX with MacPorts: sudo port install fftw3)
29
+ sudo gem install fftw3
53
30
 
54
31
  ==How to use
55
32
 
56
33
  See the following peice of code. (Install this library and copy and
57
34
  paste the following to the interactive shell irb).
58
35
 
59
- require "narray"
60
- require "numru/fftw3"
61
- include NumRu
36
+ require "fftw3"
62
37
 
63
38
  na = NArray.float(8,6) # float -> will be corced to complex
64
39
  na[1,1]=1
65
40
 
66
41
  # <example 1>
67
- fc = FFTW3.fft(na, -1)/na.length # forward 2D FFT and normalization
68
- nc = FFTW3.fft(fc, 1) # backward 2D FFT (complex) -->
42
+ fc = FFTW3.fft(na)/na.length # forward 2D FFT and normalization
43
+ nc = FFTW3.ifft(fc) # backward 2D FFT (complex) -->
69
44
  nb = nc.real # should be equal to na except round errors
70
45
 
71
46
  # <example 2>
72
- fc = FFTW3.fft(na, -1, 0) / na.shape[0] # forward FFT with the first dim
47
+ fc = FFTW3.fft(na, 0) / na.shape[0] # forward FFT with the first dim
73
48
 
74
49
  # <example 3>
75
- fc = FFTW3.fft(na, -1, 1) / na.shape[1] # forward FFT with the second dim
50
+ fc = FFTW3.fft(na, 1) / na.shape[1] # forward FFT with the second dim
76
51
 
77
52
  ==API Reference
78
53
 
79
54
  ===Module methods
80
55
 
81
- ---fft(narray, dir [,dim,dim,...])
56
+ ---fft(narray, [dim,dim,...])
82
57
 
83
58
  Complex FFT.
84
59
 
@@ -91,7 +66,6 @@ paste the following to the interactive shell irb).
91
66
  version of FFTW3 is installed (before installing this module),
92
67
  this method does a single-precision transform.
93
68
  Otherwise, a double-precision transform is used.
94
- * dir (-1 or 1) : forward transform if -1; backward transform if 1.
95
69
  * optional 3rd, 4th,... arguments (Integer) : Specifies dimensions
96
70
  to apply FFT. For example, if 0, the first dimension is
97
71
  transformed (1D FFT); If -1, the last dimension is used (1D FFT);
@@ -112,5 +86,7 @@ paste the following to the interactive shell irb).
112
86
  the result of FFTW.fft(narray, -1) (FFT for all dimensions)
113
87
  can be normalized by narray.length.
114
88
 
115
-
89
+ ---ifft(narray, [dim,dim,...])
90
+
91
+ Complex inverse FFT
116
92
 
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'echoe'
2
2
 
3
- Echoe.new("fftw3", "0.2") do |p|
3
+ Echoe.new("fftw3", "0.3") do |p|
4
4
  p.author = "T. Horinouchi, Evan Weaver"
5
5
  p.project = "fauna"
6
6
  p.dependencies = ["narray"]
@@ -278,5 +278,5 @@ void
278
278
  Init_fftw3()
279
279
  {
280
280
  mFFTW3 = rb_define_module("FFTW3");
281
- rb_define_module_function(mFFTW3, "fft", na_fftw3, -1);
281
+ rb_define_module_function(mFFTW3, "fft_raw", na_fftw3, -1);
282
282
  }
@@ -2,12 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{fftw3}
5
- s.version = "0.2"
5
+ s.version = "0.3"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["T. Horinouchi, Evan Weaver"]
9
- s.cert_chain = ["/Users/eweaver/p/configuration/gem_certificates/evan_weaver-original-public_cert.pem"]
10
- s.date = %q{2009-10-15}
9
+ s.date = %q{2009-10-21}
11
10
  s.description = %q{Gem version of T. Horinouchi's ruby-fftw3.}
12
11
  s.email = %q{}
13
12
  s.extensions = ["ext/extconf.rb"]
@@ -17,8 +16,7 @@ Gem::Specification.new do |s|
17
16
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Fftw3", "--main", "README"]
18
17
  s.require_paths = ["lib", "ext"]
19
18
  s.rubyforge_project = %q{fauna}
20
- s.rubygems_version = %q{1.3.4}
21
- s.signing_key = %q{/Users/eweaver/p/configuration/gem_certificates/evan_weaver-original-private_key.pem}
19
+ s.rubygems_version = %q{1.3.5}
22
20
  s.summary = %q{Gem version of T. Horinouchi's ruby-fftw3.}
23
21
  s.test_files = ["test/test_fftw3.rb"]
24
22
 
@@ -4,4 +4,13 @@ require 'narray'
4
4
  require 'fftw3/fftw3'
5
5
 
6
6
  module FFTW3
7
+ def self.fft(*args)
8
+ args.insert(1, -1)
9
+ fft_raw(*args)
10
+ end
11
+
12
+ def self.ifft(*args)
13
+ args.insert(1, 1)
14
+ fft_raw(*args)
15
+ end
7
16
  end
@@ -5,33 +5,33 @@ print "\n**TEST** all dimensions\n\n"
5
5
  na = NArray.float(8,4).fill(1) # will be corced to complex
6
6
  na[1,1]=5
7
7
  p na
8
- fc = FFTW3.fft(na, -1)/na.length
8
+ fc = FFTW3.fft(na)/na.length
9
9
  p fc
10
10
  p fc.real
11
11
 
12
- p FFTW3.fft(fc, 1).real
12
+ p FFTW3.ifft(fc).real
13
13
 
14
14
  print "\n**TEST** single float (treated as single if lib fftw3f exits)\n"
15
15
  print " --- see http://www.fftw.org/fftw3_doc/Precision.html for more info\n\n"
16
16
  na = NArray.sfloat(8,4).indgen!
17
- fc = FFTW3.fft(na, -1)/na.length
17
+ fc = FFTW3.fft(na)/na.length
18
18
  p fc
19
- p FFTW3.fft(fc, 1).real
19
+ p FFTW3.ifft(fc).real
20
20
 
21
21
  print "\n**TEST** dimension selection\n\n"
22
22
 
23
- fc = FFTW3.fft(na, -1, 0)/na.shape[0]
23
+ fc = FFTW3.fft(na, 0)/na.shape[0]
24
24
  p fc
25
- p FFTW3.fft(fc, 1, 0).real
26
- fc = FFTW3.fft(na, -1, 1)/na.shape[1]
25
+ p FFTW3.ifft(fc, 0).real
26
+ fc = FFTW3.fft(na, 1)/na.shape[1]
27
27
  p fc
28
- p FFTW3.fft(fc, 1, 1).real
28
+ p FFTW3.ifft(fc, 1).real
29
29
 
30
30
  na = NArray.float(4,3,8,3)
31
31
  na[1,1,1,0]= 1
32
- p( fc=FFTW3.fft(na, -1, 0,2) / (na.shape[0]*na.shape[2]) )
33
- p( fc=FFTW3.fft(na, -1, 1) / na.shape[1] )
34
- p( fc=FFTW3.fft(na, -1, 0,1,2) / (na.shape[0]*na.shape[1]*na.shape[2]) )
35
- p FFTW3.fft(fc, 1, 0,1,2).real
32
+ p( fc=FFTW3.fft(na, 0, 2) / (na.shape[0]*na.shape[2]) )
33
+ p( fc=FFTW3.fft(na, 1) / na.shape[1] )
34
+ p( fc=FFTW3.fft(na, 0,1,2) / (na.shape[0]*na.shape[1]*na.shape[2]) )
35
+ p FFTW3.ifft(fc, 0,1,2).real
36
36
 
37
37
 
metadata CHANGED
@@ -1,36 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fftw3
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.2"
4
+ version: "0.3"
5
5
  platform: ruby
6
6
  authors:
7
7
  - T. Horinouchi, Evan Weaver
8
8
  autorequire:
9
9
  bindir: bin
10
- cert_chain:
11
- - |
12
- -----BEGIN CERTIFICATE-----
13
- MIIDLjCCAhagAwI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AXr
29
- x5rKePfXINf8XTJczkl9OBEYdE9aNdJsJpXD0asLgGVwBICS5Bjohp6mizJcDC1+
30
- yZ0=
31
- -----END CERTIFICATE-----
10
+ cert_chain: []
32
11
 
33
- date: 2009-10-15 00:00:00 -07:00
12
+ date: 2009-10-21 00:00:00 -07:00
34
13
  default_executable:
35
14
  dependencies:
36
15
  - !ruby/object:Gem::Dependency
@@ -95,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
74
  requirements: []
96
75
 
97
76
  rubyforge_project: fauna
98
- rubygems_version: 1.3.4
77
+ rubygems_version: 1.3.5
99
78
  signing_key:
100
79
  specification_version: 3
101
80
  summary: Gem version of T. Horinouchi's ruby-fftw3.
data.tar.gz.sig DELETED
Binary file
metadata.gz.sig DELETED
@@ -1 +0,0 @@
1
- �����k �IM e~���]1�HAcM@�.���74��F��<�֝�O� X��]��a+)EM�/V����C-�m�9�\6��n��=3�'j�����[׬����F��o�P�_�ߊ�2�‰{ ���Ps�赊��=%:$�p������r�S��ze�.(�k� �Jt~�Ѝ�����U&&��C�c�lw²X%Jd�>+&����AB9(�/�CAEcO�Rg��{4?SR�����U�x�A