numo-pocketfft 0.3.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 31e34116c844e6f39888119f8f9fb05bd9705ecbccb848195e3667f30e90234c
4
- data.tar.gz: 8d3b62d7b05a4902c21593a79e6d493f3cf68fb73bc5cff604af9b5c17fabb15
3
+ metadata.gz: 9869e7964f7c3ace43a835f43318400b01051a2087f5392445ba22371ca16ef5
4
+ data.tar.gz: 4b2703db3b805fd135514b651a4d1d09f85dc0cede5333ae0f82faee74a72873
5
5
  SHA512:
6
- metadata.gz: 0afe23f2b56c71684ec1d1e362155073c3be3eb1c1d01ac762a73a2a09915d6536b15c8cf80d876c6bad3d1afcf4f0d1466650556d2e59924c947073b3bd9a9c
7
- data.tar.gz: f2aa69f50bbfa8c8dc4da1c220899d5ba3aa1e27db4dbbe2826da04e35bf72cff29a50c4abd6f7e2fe61d4f7fec8a03877abbb54ba2b451ec1463cde191c7cfe
6
+ metadata.gz: dadb8c33ea4eab319eea76546116735be99558dee9c70777c76a77099e45b1689d7293903b875032782942f8e1ec427aa25a655a2a39e2fec2aabcd6ca9ae4f3
7
+ data.tar.gz: 8d8c2d1b153d84ca3dd03233d612ce28393f76b164ad42b968cbb705083eb0861fcfeb3ab56e09b2fab55ff137dd764745bbb91de0005fc42ce4a9a30b1dde3e
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ # 0.4.0
2
+ - Refactor native extension codes with C99 style.
3
+ - Change not ot use git submodule for pocketfft codes bundle.
4
+ - Introduce conventional commits.
5
+
1
6
  # 0.3.2
2
7
  - Update type declaration file.
3
8
  - Remove dependent gem's type declaration file from installation files.
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2019-2021 Atsushi Tatsuma
1
+ Copyright (c) 2019-2022 Atsushi Tatsuma
2
2
  All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without
data/README.md CHANGED
@@ -59,12 +59,6 @@ Numo::Pocketfft.ifft2(Numo::Pocketfft.fft2(c))
59
59
  # [0.794815+0.539948i, 0.201042+0.737815i]]
60
60
  ```
61
61
 
62
- ## Development
63
-
64
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
65
-
66
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
67
-
68
62
  ## Contributing
69
63
 
70
64
  Bug reports and pull requests are welcome on GitHub at https://github.com/yoshoku/numo-pocketfft. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
@@ -72,7 +66,3 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/yoshok
72
66
  ## License
73
67
 
74
68
  The gem is available as open source under the terms of the [BSD-3-Clause License](https://opensource.org/licenses/BSD-3-Clause).
75
-
76
- ## Code of Conduct
77
-
78
- Everyone interacting in the Numo::Pocketfft project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/yoshoku/numo-pocketfft/blob/main/CODE_OF_CONDUCT.md).
@@ -28,12 +28,7 @@ end
28
28
 
29
29
  $CFLAGS = "#{$CFLAGS} -std=c99"
30
30
 
31
- $srcs = Dir.glob("#{$srcdir}/*.c").map { |path| File.basename(path) }
32
- $srcs << 'pocketfft.c'
33
- Dir.glob("#{$srcdir}/*/") do |path|
34
- dir = File.basename(path)
35
- $INCFLAGS << " -I$(srcdir)/#{dir}"
36
- $VPATH << "$(srcdir)/#{dir}"
37
- end
31
+ $srcs = Dir.glob("#{$srcdir}/**/*.c").map { |path| File.basename(path) }
32
+ $VPATH << "$(srcdir)/src"
38
33
 
39
34
  create_makefile('numo/pocketfft/pocketfftext')
@@ -4,20 +4,6 @@ VALUE mNumo;
4
4
  VALUE mPocketfft;
5
5
 
6
6
  VALUE numo_pocketfft_fft(VALUE x_val, int is_forward) {
7
- narray_t* x_nary;
8
- double* x_pt;
9
- size_t length;
10
- int n_dims;
11
- int n_repeats;
12
- int i;
13
- int res;
14
- int fail;
15
- double fct;
16
- VALUE z_val;
17
- double* z_pt;
18
- narray_t* z_nary;
19
- cfft_plan plan = NULL;
20
-
21
7
  if (CLASS_OF(x_val) != numo_cDComplex) {
22
8
  x_val = rb_funcall(numo_cDComplex, rb_intern("cast"), 1, x_val);
23
9
  }
@@ -25,29 +11,30 @@ VALUE numo_pocketfft_fft(VALUE x_val, int is_forward) {
25
11
  x_val = nary_dup(x_val);
26
12
  }
27
13
 
14
+ narray_t* x_nary;
28
15
  GetNArray(x_val, x_nary);
29
- n_dims = NA_NDIM(x_nary);
30
- length = NA_SHAPE(x_nary)[n_dims - 1];
31
- x_pt = (double*)na_get_pointer_for_read(x_val);
16
+ int n_dims = NA_NDIM(x_nary);
17
+ size_t length = NA_SHAPE(x_nary)[n_dims - 1];
18
+ double* x_pt = (double*)na_get_pointer_for_read(x_val);
32
19
 
33
- plan = make_cfft_plan(length);
20
+ cfft_plan plan = make_cfft_plan(length);
34
21
  if (!plan) {
35
22
  rb_raise(rb_eNoMemError, "Failed to allocate memory for plan of pocketfft.");
36
23
  return Qnil;
37
24
  }
38
25
 
39
- z_val = nary_s_new_like(numo_cDComplex, x_val);
40
- z_pt = (double*)na_get_pointer_for_write(z_val);
26
+ VALUE z_val = nary_s_new_like(numo_cDComplex, x_val);
27
+ double* z_pt = (double*)na_get_pointer_for_write(z_val);
28
+ narray_t* z_nary;
41
29
  GetNArray(z_val, z_nary);
42
30
  memset(z_pt, 0, (NA_SIZE(z_nary) * 2) * sizeof(double));
43
31
 
44
- fail = 0;
45
- fct = is_forward == 1 ? 1.0 : 1.0 / length;
46
- n_repeats = (int)(NA_SIZE(x_nary)) / length;
47
- for (i = 0; i < n_repeats; i++) {
32
+ int fail = 0;
33
+ double fct = is_forward == 1 ? 1.0 : 1.0 / length;
34
+ int n_repeats = (int)(NA_SIZE(x_nary)) / length;
35
+ for (int i = 0; i < n_repeats; i++) {
48
36
  memcpy(z_pt, x_pt, 2 * length * sizeof(double));
49
- res = is_forward == 1 ? cfft_forward(plan, z_pt, fct) : cfft_backward(plan, z_pt, fct);
50
- if (res != 0) {
37
+ if ((is_forward == 1 ? cfft_forward(plan, z_pt, fct) : cfft_backward(plan, z_pt, fct)) != 0) {
51
38
  fail = 1;
52
39
  break;
53
40
  }
@@ -62,8 +49,8 @@ VALUE numo_pocketfft_fft(VALUE x_val, int is_forward) {
62
49
  RB_GC_GUARD(x_val);
63
50
 
64
51
  if (fail) {
65
- rb_raise(rb_eNoMemError, "Failed to allocate memory in function of pocketfft.");
66
52
  rb_funcall(z_val, rb_intern("free"), 0);
53
+ rb_raise(rb_eNoMemError, "Failed to allocate memory in function of pocketfft.");
67
54
  return Qnil;
68
55
  }
69
56
 
@@ -84,20 +71,6 @@ static VALUE numo_pocketfft_icfft(VALUE self, VALUE x_val) { return numo_pocketf
84
71
  * @!visibility private
85
72
  */
86
73
  static VALUE numo_pocketfft_rfft(VALUE self, VALUE x_val) {
87
- narray_t* x_nary;
88
- double* x_pt;
89
- int n_dims;
90
- size_t length;
91
- int n_repeats;
92
- int i;
93
- int fail;
94
- size_t* z_shape;
95
- VALUE z_val;
96
- narray_t* z_nary;
97
- double* z_pt;
98
- int z_step;
99
- rfft_plan plan = NULL;
100
-
101
74
  if (CLASS_OF(x_val) != numo_cDFloat) {
102
75
  x_val = rb_funcall(numo_cDFloat, rb_intern("cast"), 1, x_val);
103
76
  }
@@ -105,31 +78,32 @@ static VALUE numo_pocketfft_rfft(VALUE self, VALUE x_val) {
105
78
  x_val = nary_dup(x_val);
106
79
  }
107
80
 
81
+ narray_t* x_nary;
108
82
  GetNArray(x_val, x_nary);
109
- n_dims = NA_NDIM(x_nary);
110
- length = NA_SHAPE(x_nary)[n_dims - 1];
111
- x_pt = (double*)na_get_pointer_for_read(x_val);
83
+ int n_dims = NA_NDIM(x_nary);
84
+ size_t length = NA_SHAPE(x_nary)[n_dims - 1];
85
+ double* x_pt = (double*)na_get_pointer_for_read(x_val);
112
86
 
113
- plan = make_rfft_plan(length);
87
+ rfft_plan plan = make_rfft_plan(length);
114
88
  if (!plan) {
115
89
  rb_raise(rb_eNoMemError, "Failed to allocate memory for plan of pocketfft.");
116
90
  return Qnil;
117
91
  }
118
92
 
119
- z_shape = ALLOCA_N(size_t, n_dims);
120
- for (i = 0; i < n_dims - 1; i++) {
93
+ size_t* z_shape = ALLOCA_N(size_t, n_dims);
94
+ for (int i = 0; i < n_dims - 1; i++)
121
95
  z_shape[i] = NA_SHAPE(x_nary)[i];
122
- }
123
96
  z_shape[n_dims - 1] = length / 2 + 1;
124
- z_val = rb_narray_new(numo_cDComplex, n_dims, z_shape);
125
- z_pt = (double*)na_get_pointer_for_write(z_val);
97
+ VALUE z_val = rb_narray_new(numo_cDComplex, n_dims, z_shape);
98
+ double* z_pt = (double*)na_get_pointer_for_write(z_val);
99
+ narray_t* z_nary;
126
100
  GetNArray(z_val, z_nary);
127
101
  memset(z_pt, 0, (NA_SIZE(z_nary) * 2) * sizeof(double));
128
102
 
129
- fail = 0;
130
- z_step = (int)(NA_SHAPE(z_nary)[n_dims - 1]) * 2;
131
- n_repeats = (int)(NA_SIZE(x_nary)) / length;
132
- for (i = 0; i < n_repeats; i++) {
103
+ int fail = 0;
104
+ int z_step = (int)(NA_SHAPE(z_nary)[n_dims - 1]) * 2;
105
+ int n_repeats = (int)(NA_SIZE(x_nary)) / length;
106
+ for (int i = 0; i < n_repeats; i++) {
133
107
  z_pt[z_step - 1] = 0.0;
134
108
  memcpy(z_pt + 1, x_pt, length * sizeof(double));
135
109
  if (rfft_forward(plan, z_pt + 1, 1.0) != 0) {
@@ -149,8 +123,8 @@ static VALUE numo_pocketfft_rfft(VALUE self, VALUE x_val) {
149
123
  RB_GC_GUARD(x_val);
150
124
 
151
125
  if (fail) {
152
- rb_raise(rb_eNoMemError, "Failed to allocate memory in function of pocketfft.");
153
126
  rb_funcall(z_val, rb_intern("free"), 0);
127
+ rb_raise(rb_eNoMemError, "Failed to allocate memory in function of pocketfft.");
154
128
  return Qnil;
155
129
  }
156
130
 
@@ -161,20 +135,6 @@ static VALUE numo_pocketfft_rfft(VALUE self, VALUE x_val) {
161
135
  * @!visibility private
162
136
  */
163
137
  static VALUE numo_pocketfft_irfft(VALUE self, VALUE x_val) {
164
- narray_t* x_nary;
165
- double* x_pt;
166
- size_t length;
167
- int n_dims;
168
- int n_repeats;
169
- int i;
170
- int fail;
171
- double fct;
172
- size_t* z_shape;
173
- VALUE z_val;
174
- double* z_pt;
175
- narray_t* z_nary;
176
- rfft_plan plan = NULL;
177
-
178
138
  if (CLASS_OF(x_val) != numo_cDComplex) {
179
139
  x_val = rb_funcall(numo_cDComplex, rb_intern("cast"), 1, x_val);
180
140
  }
@@ -182,31 +142,33 @@ static VALUE numo_pocketfft_irfft(VALUE self, VALUE x_val) {
182
142
  x_val = nary_dup(x_val);
183
143
  }
184
144
 
145
+ narray_t* x_nary;
185
146
  GetNArray(x_val, x_nary);
186
- n_dims = NA_NDIM(x_nary);
187
- length = NA_SHAPE(x_nary)[n_dims - 1];
188
- x_pt = (double*)na_get_pointer_for_read(x_val);
147
+ int n_dims = NA_NDIM(x_nary);
148
+ size_t length = NA_SHAPE(x_nary)[n_dims - 1];
149
+ double* x_pt = (double*)na_get_pointer_for_read(x_val);
189
150
 
190
- plan = make_rfft_plan(length);
151
+ rfft_plan plan = make_rfft_plan(length);
191
152
  if (!plan) {
192
153
  rb_raise(rb_eNoMemError, "Failed to allocate memory for plan of pocketfft.");
193
154
  return Qnil;
194
155
  }
195
156
 
196
- z_shape = ALLOCA_N(size_t, n_dims);
197
- for (i = 0; i < n_dims - 1; i++) {
157
+ size_t* z_shape = ALLOCA_N(size_t, n_dims);
158
+ for (int i = 0; i < n_dims - 1; i++) {
198
159
  z_shape[i] = NA_SHAPE(x_nary)[i];
199
160
  }
200
161
  z_shape[n_dims - 1] = length;
201
- z_val = rb_narray_new(numo_cDFloat, n_dims, z_shape);
202
- z_pt = (double*)na_get_pointer_for_write(z_val);
162
+ VALUE z_val = rb_narray_new(numo_cDFloat, n_dims, z_shape);
163
+ double* z_pt = (double*)na_get_pointer_for_write(z_val);
164
+ narray_t* z_nary;
203
165
  GetNArray(z_val, z_nary);
204
166
  memset(z_pt, 0, NA_SIZE(z_nary) * sizeof(double));
205
167
 
206
- fail = 0;
207
- fct = 1.0 / length;
208
- n_repeats = (int)(NA_SIZE(z_nary)) / length;
209
- for (i = 0; i < n_repeats; i++) {
168
+ int fail = 0;
169
+ double fct = 1.0 / length;
170
+ int n_repeats = (int)(NA_SIZE(z_nary)) / length;
171
+ for (int i = 0; i < n_repeats; i++) {
210
172
  memcpy(z_pt + 1, x_pt + 2, (length - 1) * sizeof(double));
211
173
  z_pt[0] = x_pt[0];
212
174
  if (rfft_backward(plan, z_pt, fct) != 0) {
@@ -224,8 +186,8 @@ static VALUE numo_pocketfft_irfft(VALUE self, VALUE x_val) {
224
186
  RB_GC_GUARD(x_val);
225
187
 
226
188
  if (fail) {
227
- rb_raise(rb_eNoMemError, "Failed to allocate memory in function of pocketfft.");
228
189
  rb_funcall(z_val, rb_intern("free"), 0);
190
+ rb_raise(rb_eNoMemError, "Failed to allocate memory in function of pocketfft.");
229
191
  return Qnil;
230
192
  }
231
193
 
@@ -9,6 +9,6 @@
9
9
  #include <numo/narray.h>
10
10
  #include <numo/template.h>
11
11
 
12
- #include "pocketfft/pocketfft.h"
12
+ #include "src/pocketfft.h"
13
13
 
14
14
  #endif /* NUMO_POCKETFFT_H */
File without changes
File without changes
File without changes
@@ -5,6 +5,6 @@ module Numo
5
5
  # Numo::Pocketfft is the module that has functions for Fourier transform.
6
6
  module Pocketfft
7
7
  # The version of Numo::Pocketfft you are using.
8
- VERSION = '0.3.2'
8
+ VERSION = '0.4.0'
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: numo-pocketfft
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - yoshoku
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-10 00:00:00.000000000 Z
11
+ date: 2022-01-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: numo-narray
@@ -27,7 +27,7 @@ dependencies:
27
27
  description: 'Numo::Pocketfft provides functions for descrete Fourier Transform based
28
28
  on pocketfft.
29
29
 
30
- '
30
+ '
31
31
  email:
32
32
  - yoshoku@outlook.com
33
33
  executables: []
@@ -35,31 +35,17 @@ extensions:
35
35
  - ext/numo/pocketfft/extconf.rb
36
36
  extra_rdoc_files: []
37
37
  files:
38
- - ".clang-format"
39
- - ".coveralls.yml"
40
- - ".github/workflows/build.yml"
41
- - ".github/workflows/coverage.yml"
42
- - ".gitignore"
43
- - ".gitmodules"
44
- - ".rspec"
45
38
  - CHANGELOG.md
46
- - CODE_OF_CONDUCT.md
47
- - Gemfile
48
39
  - LICENSE.txt
49
40
  - README.md
50
- - Rakefile
51
- - Steepfile
52
41
  - ext/numo/pocketfft/extconf.rb
53
- - ext/numo/pocketfft/pocketfft/LICENSE.md
54
- - ext/numo/pocketfft/pocketfft/README.md
55
- - ext/numo/pocketfft/pocketfft/ffttest.c
56
- - ext/numo/pocketfft/pocketfft/pocketfft.c
57
- - ext/numo/pocketfft/pocketfft/pocketfft.h
58
42
  - ext/numo/pocketfft/pocketfftext.c
59
43
  - ext/numo/pocketfft/pocketfftext.h
44
+ - ext/numo/pocketfft/src/LICENSE.md
45
+ - ext/numo/pocketfft/src/pocketfft.c
46
+ - ext/numo/pocketfft/src/pocketfft.h
60
47
  - lib/numo/pocketfft.rb
61
48
  - lib/numo/pocketfft/version.rb
62
- - numo-pocketfft.gemspec
63
49
  - sig/numo/pocketfft.rbs
64
50
  homepage: https://github.com/yoshoku/numo-pocketfft
65
51
  licenses:
@@ -70,7 +56,7 @@ metadata:
70
56
  source_code_uri: https://github.com/yoshoku/numo-pocketfft
71
57
  documentation_uri: https://yoshoku.github.io/numo-pocketfft/doc/
72
58
  bug_tracker_uri: https://github.com/yoshoku/numo-pocketfft/issues
73
- post_install_message:
59
+ post_install_message:
74
60
  rdoc_options: []
75
61
  require_paths:
76
62
  - lib
@@ -85,8 +71,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
85
71
  - !ruby/object:Gem::Version
86
72
  version: '0'
87
73
  requirements: []
88
- rubygems_version: 3.2.21
89
- signing_key:
74
+ rubygems_version: 3.2.32
75
+ signing_key:
90
76
  specification_version: 4
91
77
  summary: Numo::Pocketfft provides functions for descrete Fourier Transform based on
92
78
  pocketfft.
data/.clang-format DELETED
@@ -1,149 +0,0 @@
1
- ---
2
- Language: Cpp
3
- # BasedOnStyle: LLVM
4
- AccessModifierOffset: -2
5
- AlignAfterOpenBracket: Align
6
- AlignConsecutiveMacros: false
7
- AlignConsecutiveAssignments: false
8
- AlignConsecutiveBitFields: false
9
- AlignConsecutiveDeclarations: false
10
- AlignEscapedNewlines: Right
11
- AlignOperands: Align
12
- AlignTrailingComments: true
13
- AllowAllArgumentsOnNextLine: true
14
- AllowAllConstructorInitializersOnNextLine: true
15
- AllowAllParametersOfDeclarationOnNextLine: true
16
- AllowShortEnumsOnASingleLine: true
17
- AllowShortBlocksOnASingleLine: Never
18
- AllowShortCaseLabelsOnASingleLine: false
19
- AllowShortFunctionsOnASingleLine: All
20
- AllowShortLambdasOnASingleLine: All
21
- AllowShortIfStatementsOnASingleLine: Never
22
- AllowShortLoopsOnASingleLine: false
23
- AlwaysBreakAfterDefinitionReturnType: None
24
- AlwaysBreakAfterReturnType: None
25
- AlwaysBreakBeforeMultilineStrings: false
26
- AlwaysBreakTemplateDeclarations: MultiLine
27
- BinPackArguments: true
28
- BinPackParameters: true
29
- BraceWrapping:
30
- AfterCaseLabel: false
31
- AfterClass: false
32
- AfterControlStatement: Never
33
- AfterEnum: false
34
- AfterFunction: false
35
- AfterNamespace: false
36
- AfterObjCDeclaration: false
37
- AfterStruct: false
38
- AfterUnion: false
39
- AfterExternBlock: false
40
- BeforeCatch: false
41
- BeforeElse: false
42
- BeforeLambdaBody: false
43
- BeforeWhile: false
44
- IndentBraces: false
45
- SplitEmptyFunction: true
46
- SplitEmptyRecord: true
47
- SplitEmptyNamespace: true
48
- BreakBeforeBinaryOperators: None
49
- BreakBeforeBraces: Attach
50
- BreakBeforeInheritanceComma: false
51
- BreakInheritanceList: BeforeColon
52
- BreakBeforeTernaryOperators: true
53
- BreakConstructorInitializersBeforeComma: false
54
- BreakConstructorInitializers: BeforeColon
55
- BreakAfterJavaFieldAnnotations: false
56
- BreakStringLiterals: true
57
- ColumnLimit: 128
58
- CommentPragmas: '^ IWYU pragma:'
59
- CompactNamespaces: false
60
- ConstructorInitializerAllOnOneLineOrOnePerLine: false
61
- ConstructorInitializerIndentWidth: 4
62
- ContinuationIndentWidth: 4
63
- Cpp11BracedListStyle: true
64
- DeriveLineEnding: true
65
- DerivePointerAlignment: false
66
- DisableFormat: false
67
- ExperimentalAutoDetectBinPacking: false
68
- FixNamespaceComments: true
69
- ForEachMacros:
70
- - foreach
71
- - Q_FOREACH
72
- - BOOST_FOREACH
73
- IncludeBlocks: Preserve
74
- IncludeCategories:
75
- - Regex: '^"(llvm|llvm-c|clang|clang-c)/'
76
- Priority: 2
77
- SortPriority: 0
78
- - Regex: '^(<|"(gtest|gmock|isl|json)/)'
79
- Priority: 3
80
- SortPriority: 0
81
- - Regex: '.*'
82
- Priority: 1
83
- SortPriority: 0
84
- IncludeIsMainRegex: '(Test)?$'
85
- IncludeIsMainSourceRegex: ''
86
- IndentCaseLabels: false
87
- IndentCaseBlocks: false
88
- IndentGotoLabels: true
89
- IndentPPDirectives: None
90
- IndentExternBlock: AfterExternBlock
91
- IndentWidth: 2
92
- IndentWrappedFunctionNames: false
93
- InsertTrailingCommas: None
94
- JavaScriptQuotes: Leave
95
- JavaScriptWrapImports: true
96
- KeepEmptyLinesAtTheStartOfBlocks: true
97
- MacroBlockBegin: ''
98
- MacroBlockEnd: ''
99
- MaxEmptyLinesToKeep: 1
100
- NamespaceIndentation: None
101
- ObjCBinPackProtocolList: Auto
102
- ObjCBlockIndentWidth: 2
103
- ObjCBreakBeforeNestedBlockParam: true
104
- ObjCSpaceAfterProperty: false
105
- ObjCSpaceBeforeProtocolList: true
106
- PenaltyBreakAssignment: 2
107
- PenaltyBreakBeforeFirstCallParameter: 19
108
- PenaltyBreakComment: 300
109
- PenaltyBreakFirstLessLess: 120
110
- PenaltyBreakString: 1000
111
- PenaltyBreakTemplateDeclaration: 10
112
- PenaltyExcessCharacter: 1000000
113
- PenaltyReturnTypeOnItsOwnLine: 60
114
- PointerAlignment: Left
115
- ReflowComments: true
116
- SortIncludes: true
117
- SortUsingDeclarations: true
118
- SpaceAfterCStyleCast: false
119
- SpaceAfterLogicalNot: false
120
- SpaceAfterTemplateKeyword: true
121
- SpaceBeforeAssignmentOperators: true
122
- SpaceBeforeCpp11BracedList: false
123
- SpaceBeforeCtorInitializerColon: true
124
- SpaceBeforeInheritanceColon: true
125
- SpaceBeforeParens: ControlStatements
126
- SpaceBeforeRangeBasedForLoopColon: true
127
- SpaceInEmptyBlock: false
128
- SpaceInEmptyParentheses: false
129
- SpacesBeforeTrailingComments: 1
130
- SpacesInAngles: false
131
- SpacesInConditionalStatement: false
132
- SpacesInContainerLiterals: true
133
- SpacesInCStyleCastParentheses: false
134
- SpacesInParentheses: false
135
- SpacesInSquareBrackets: false
136
- SpaceBeforeSquareBrackets: false
137
- Standard: Latest
138
- StatementMacros:
139
- - Q_UNUSED
140
- - QT_REQUIRE_VERSION
141
- TabWidth: 8
142
- UseCRLF: false
143
- UseTab: Never
144
- WhitespaceSensitiveMacros:
145
- - STRINGIZE
146
- - PP_STRINGIZE
147
- - BOOST_PP_STRINGIZE
148
- ...
149
-
data/.coveralls.yml DELETED
@@ -1 +0,0 @@
1
- service_name: github-ci
@@ -1,27 +0,0 @@
1
- name: build
2
-
3
- on: [push, pull_request]
4
-
5
- jobs:
6
- build:
7
- runs-on: ubuntu-20.04
8
- strategy:
9
- matrix:
10
- ruby: [ '2.6', '2.7', '3.0' ]
11
- steps:
12
- - uses: actions/checkout@v2
13
- - name: Checkout submodule
14
- shell: bash
15
- run: |
16
- auth_header="$(git config --local --get http.https://github.com/.extraheader)"
17
- git submodule sync --recursive
18
- git submodule update --init --force --recursive
19
- - name: Set up Ruby ${{ matrix.ruby }}
20
- uses: actions/setup-ruby@v1
21
- with:
22
- ruby-version: ${{ matrix.ruby }}
23
- - name: Build and test with Rake
24
- run: |
25
- gem install bundler
26
- bundle install --jobs 4 --retry 3
27
- bundle exec rake
@@ -1,32 +0,0 @@
1
- name: coverage
2
-
3
- on:
4
- push:
5
- branches: [ main ]
6
- pull_request:
7
- branches: [ main ]
8
-
9
- jobs:
10
- coverage:
11
- runs-on: ubuntu-20.04
12
- steps:
13
- - uses: actions/checkout@v2
14
- - name: Checkout submodule
15
- shell: bash
16
- run: |
17
- auth_header="$(git config --local --get http.https://github.com/.extraheader)"
18
- git submodule sync --recursive
19
- git submodule update --init --force --recursive
20
- - name: Set up Ruby 2.7
21
- uses: actions/setup-ruby@v1
22
- with:
23
- ruby-version: '2.7'
24
- - name: Build and test with Rake
25
- run: |
26
- gem install bundler
27
- bundle install
28
- bundle exec rake
29
- - name: Coveralls GitHub Action
30
- uses: coverallsapp/github-action@v1.1.2
31
- with:
32
- github-token: ${{ secrets.GITHUB_TOKEN }}
data/.gitignore DELETED
@@ -1,20 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
- /bin/
11
-
12
- # rspec failure tracking
13
- .rspec_status
14
-
15
- *.swp
16
- *.bundle
17
- mkmf.log
18
- tags
19
- .DS_Store
20
- .ruby-version
data/.gitmodules DELETED
@@ -1,4 +0,0 @@
1
- [submodule "ext/numo/pocketfft/pocketfft"]
2
- path = ext/numo/pocketfft/pocketfft
3
- url = https://gitlab.mpcdf.mpg.de/mtr/pocketfft.git
4
- ignore = dirty
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
data/CODE_OF_CONDUCT.md DELETED
@@ -1,74 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at yoshoku@outlook.com. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [http://contributor-covenant.org/version/1/4][version]
72
-
73
- [homepage]: http://contributor-covenant.org
74
- [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile DELETED
@@ -1,12 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- # Specify your gem's dependencies in numo-pocketfft.gemspec
4
- gemspec
5
-
6
- gem 'rake', '~> 13.0'
7
- gem 'rake-compiler', '~> 1.0'
8
- gem 'rspec', '~> 3.0'
9
- gem 'simplecov', '~> 0.19'
10
- gem 'simplecov-lcov', '~> 0.8'
11
- gem 'rbs', '~> 1.2'
12
- gem 'steep', '~> 0.44'
data/Rakefile DELETED
@@ -1,16 +0,0 @@
1
- require 'bundler/gem_tasks'
2
- require 'rspec/core/rake_task'
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- require 'rake/extensiontask'
7
-
8
- task :build => :compile
9
-
10
- Rake::ExtensionTask.new('pocketfftext') do |ext|
11
- ext.ext_dir = 'ext/numo/pocketfft'
12
- ext.lib_dir = 'lib/numo/pocketfft'
13
- end
14
-
15
- task :default => [:clobber, :compile, :spec]
16
-
data/Steepfile DELETED
@@ -1,20 +0,0 @@
1
- target :lib do
2
- signature "sig", "sig-deps"
3
- #
4
- check "lib" # Directory name
5
- # check "Gemfile" # File name
6
- # check "app/models/**/*.rb" # Glob
7
- # # ignore "lib/templates/*.rb"
8
- #
9
- # # library "pathname", "set" # Standard libraries
10
- # library "numo-narray" # Gems
11
- end
12
-
13
- # target :spec do
14
- # signature "sig", "sig-private"
15
- #
16
- # check "spec"
17
- #
18
- # # library "pathname", "set" # Standard libraries
19
- # # library "rspec"
20
- # end
@@ -1,55 +0,0 @@
1
- PocketFFT
2
- ---------
3
-
4
- This is a heavily modified implementation of FFTPack [1,2], with the following
5
- advantages:
6
-
7
- - strictly C99 compliant
8
- - more accurate twiddle factor computation
9
- - very fast plan generation
10
- - worst case complexity for transform sizes with large prime factors is
11
- `N*log(N)`, because Bluestein's algorithm [3] is used for these cases.
12
-
13
- License
14
- -------
15
-
16
- 3-clause BSD (see LICENSE.md)
17
-
18
-
19
- Some code details
20
- -----------------
21
-
22
- Twiddle factor computation:
23
-
24
- - making use of symmetries to reduce number of sin/cos evaluations
25
- - all angles are reduced to the range `[0; pi/4]` for higher accuracy
26
- - an adapted implementation of `sincospi()` is used, which actually computes
27
- `sin(x)` and `(cos(x)-1)`.
28
- - if `n` sin/cos pairs are required, the adjusted `sincospi()` is only called
29
- `2*sqrt(n)` times; the remaining values are obtained by evaluating the
30
- angle addition theorems in a numerically accurate way.
31
-
32
- Parallel invocation:
33
-
34
- - Plans only contain read-only data; all temporary arrays are allocated and
35
- deallocated during an individual FFT execution. This means that a single plan
36
- can be used in several threads at the same time.
37
-
38
- Efficient codelets are available for the factors:
39
-
40
- - 2, 3, 4, 5, 7, 11 for complex-valued FFTs
41
- - 2, 3, 4, 5 for real-valued FFTs
42
-
43
- Larger prime factors are handled by somewhat less efficient, generic routines.
44
-
45
- For lengths with very large prime factors, Bluestein's algorithm is used, and
46
- instead of an FFT of length `n`, a convolution of length `n2 >= 2*n-1`
47
- is performed, where `n2` is chosen to be highly composite.
48
-
49
-
50
- [1] Swarztrauber, P. 1982, Vectorizing the Fast Fourier Transforms
51
- (New York: Academic Press), 51
52
-
53
- [2] https://www.netlib.org/fftpack/
54
-
55
- [3] https://en.wikipedia.org/wiki/Chirp_Z-transform
@@ -1,96 +0,0 @@
1
- /*
2
- * This file is part of pocketfft.
3
- * Licensed under a 3-clause BSD style license - see LICENSE.md
4
- */
5
-
6
- /*
7
- * Test codes for pocketfft.
8
- *
9
- * Copyright (C) 2004-2018 Max-Planck-Society
10
- * \author Martin Reinecke
11
- */
12
-
13
- #include <stdio.h>
14
- #include <stdlib.h>
15
- #include <math.h>
16
- #include <string.h>
17
- #include "pocketfft.h"
18
-
19
- #define maxlen 8192
20
-
21
- static void fill_random (double *data, size_t length)
22
- {
23
- for (size_t m=0; m<length; ++m)
24
- data[m] = rand()/(RAND_MAX+1.0)-0.5;
25
- }
26
-
27
- static double errcalc (double *data, double *odata, size_t length)
28
- {
29
- double sum = 0, errsum = 0;
30
- for (size_t m=0; m<length; ++m)
31
- {
32
- errsum += (data[m]-odata[m])*(data[m]-odata[m]);
33
- sum += odata[m]*odata[m];
34
- }
35
- return sqrt(errsum/sum);
36
- }
37
-
38
- static int test_real(void)
39
- {
40
- double data[maxlen], odata[maxlen];
41
- const double epsilon=2e-15;
42
- int ret = 0;
43
- fill_random (odata, maxlen);
44
- double errsum=0;
45
- for (int length=1; length<=maxlen; ++length)
46
- {
47
- memcpy (data,odata,length*sizeof(double));
48
- rfft_plan plan = make_rfft_plan (length);
49
- rfft_forward (plan, data, 1.);
50
- rfft_backward (plan, data, 1./length);
51
- destroy_rfft_plan (plan);
52
- double err = errcalc (data, odata, length);
53
- if (err>epsilon)
54
- {
55
- printf("problem at real length %i: %e\n",length,err);
56
- ret = 1;
57
- }
58
- errsum+=err;
59
- }
60
- printf("errsum: %e\n",errsum);
61
- return ret;
62
- }
63
-
64
- static int test_complex(void)
65
- {
66
- double data[2*maxlen], odata[2*maxlen];
67
- fill_random (odata, 2*maxlen);
68
- const double epsilon=2e-15;
69
- int ret = 0;
70
- double errsum=0;
71
- for (int length=1; length<=maxlen; ++length)
72
- {
73
- memcpy (data,odata,2*length*sizeof(double));
74
- cfft_plan plan = make_cfft_plan (length);
75
- cfft_forward(plan, data, 1.);
76
- cfft_backward(plan, data, 1./length);
77
- destroy_cfft_plan (plan);
78
- double err = errcalc (data, odata, 2*length);
79
- if (err>epsilon)
80
- {
81
- printf("problem at complex length %i: %e\n",length,err);
82
- ret = 1;
83
- }
84
- errsum+=err;
85
- }
86
- printf("errsum: %e\n",errsum);
87
- return ret;
88
- }
89
-
90
- int main(void)
91
- {
92
- int ret = 0;
93
- ret = test_real();
94
- ret += test_complex();
95
- return ret;
96
- }
@@ -1,48 +0,0 @@
1
- lib = File.expand_path('lib', __dir__)
2
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
- require 'numo/pocketfft/version'
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = 'numo-pocketfft'
7
- spec.version = Numo::Pocketfft::VERSION
8
- spec.authors = ['yoshoku']
9
- spec.email = ['yoshoku@outlook.com']
10
-
11
- spec.summary = <<~MSG
12
- Numo::Pocketfft provides functions for descrete Fourier Transform based on pocketfft.
13
- MSG
14
- spec.description = <<~MSG
15
- Numo::Pocketfft provides functions for descrete Fourier Transform based on pocketfft.
16
- MSG
17
- spec.homepage = 'https://github.com/yoshoku/numo-pocketfft'
18
- spec.license = 'BSD-3-Clause'
19
-
20
- # Specify which files should be added to the gem when it is released.
21
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
22
- spec.files = Dir.chdir(File.expand_path(__dir__)) do
23
- `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|sig-deps)/}) }
24
- end
25
-
26
- # Add files in submodule: https://gist.github.com/mattconnolly/5875987
27
- `git submodule --quiet foreach pwd`.split($INPUT_RECORD_SEPARATOR).each do |submodule_path|
28
- Dir.chdir(submodule_path) do
29
- submodule_relative_path = submodule_path.sub("#{__dir__}/", '')
30
- `git ls-files -z`.split("\x0").select { |f| f.match?(/^*(\.md|\.c|\.h)$/) }.each do |filename|
31
- spec.files << "#{submodule_relative_path}/#{filename}"
32
- end
33
- end
34
- end
35
-
36
- spec.require_paths = ['lib']
37
- spec.extensions = ['ext/numo/pocketfft/extconf.rb']
38
-
39
- spec.metadata = {
40
- 'homepage_uri' => 'https://github.com/yoshoku/numo-pocketfft',
41
- 'changelog_uri' => 'https://github.com/yoshoku/numo-pocketfft/blob/main/CHANGELOG.md',
42
- 'source_code_uri' => 'https://github.com/yoshoku/numo-pocketfft',
43
- 'documentation_uri' => 'https://yoshoku.github.io/numo-pocketfft/doc/',
44
- 'bug_tracker_uri' => 'https://github.com/yoshoku/numo-pocketfft/issues'
45
- }
46
-
47
- spec.add_runtime_dependency 'numo-narray', '>= 0.9.1'
48
- end