numo-pocketfft 0.1.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.clang-format +149 -0
- data/.coveralls.yml +1 -1
- data/.github/workflows/build.yml +27 -0
- data/.github/workflows/coverage.yml +32 -0
- data/CHANGELOG.md +22 -0
- data/Gemfile +8 -0
- data/LICENSE.txt +1 -1
- data/README.md +7 -5
- data/Steepfile +20 -0
- data/ext/numo/pocketfft/pocketfftext.c +60 -28
- data/ext/numo/pocketfft/pocketfftext.h +1 -0
- data/lib/numo/pocketfft.rb +107 -9
- data/lib/numo/pocketfft/version.rb +1 -1
- data/numo-pocketfft.gemspec +8 -6
- data/sig/numo/pocketfft.rbs +28 -0
- data/sig/patch.rbs +22 -0
- metadata +16 -78
- data/.travis.yml +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f3fe78551040f4879625ac62a60b76e257893e014f30f1d740d8fccfac4f4f2b
|
4
|
+
data.tar.gz: 6fdc89c8a1143109859fd2ac77b1a27bc03ca3979ddf3421b13efcd3588905d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6bed07e163241fc82e64236739eeaadebe8030307b08e07e53a9637abf4283cbb1250fb0c68213c03a127c953bc7c4c3317f52743423fa6f4a5234bec5f06707
|
7
|
+
data.tar.gz: c71560d98756712516bfcdd494e236f3ff945cf1f989211c068d81bb27305875ca2ebbc361026f49d9e04a937b59881510109b72860e42d732ca3efc2caa5354
|
data/.clang-format
ADDED
@@ -0,0 +1,149 @@
|
|
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
CHANGED
@@ -1 +1 @@
|
|
1
|
-
service_name:
|
1
|
+
service_name: github-ci
|
@@ -0,0 +1,27 @@
|
|
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
|
@@ -0,0 +1,32 @@
|
|
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/CHANGELOG.md
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# 0.3.0
|
2
|
+
- Add type declaration file: sig/numo/pocketfft.rbs
|
3
|
+
- Refactor to avoid generating unnecessary arrays.
|
4
|
+
|
5
|
+
# 0.2.2
|
6
|
+
- Fix bug that caused segmentation fault due to garbage collection ([#4](https://github.com/yoshoku/numo-pocketfft/pull/4)).
|
7
|
+
- Fix some configuration files.
|
8
|
+
|
9
|
+
# 0.2.1
|
10
|
+
- Fix the link to the document.
|
11
|
+
- Several documentation improvements.
|
12
|
+
|
13
|
+
# 0.2.0
|
14
|
+
- Add fftconvolve method that convolves two arrays with FFT.
|
15
|
+
|
16
|
+
# 0.1.1
|
17
|
+
- Add input validation for empty array.
|
18
|
+
- Add input validation for non-Numo::NArray object.
|
19
|
+
- Fix to raise NoMemoryError when happened memory allocation error.
|
20
|
+
|
21
|
+
# 0.1.0
|
22
|
+
- First release.
|
data/Gemfile
CHANGED
@@ -2,3 +2,11 @@ source "https://rubygems.org"
|
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in numo-pocketfft.gemspec
|
4
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/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
# Numo::Pocketfft
|
2
2
|
|
3
|
-
[![Build Status](https://
|
4
|
-
[![Coverage Status](https://coveralls.io/repos/github/yoshoku/numo-pocketfft/badge.svg?branch=
|
5
|
-
[![
|
3
|
+
[![Build Status](https://github.com/yoshoku/numo-pocketfft/workflows/build/badge.svg)](https://github.com/yoshoku/numo-pocketfft/actions?query=workflow%3Abuild)
|
4
|
+
[![Coverage Status](https://coveralls.io/repos/github/yoshoku/numo-pocketfft/badge.svg?branch=main)](https://coveralls.io/github/yoshoku/numo-pocketfft?branch=main)
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/numo-pocketfft.svg)](https://badge.fury.io/rb/numo-pocketfft)
|
6
|
+
[![BSD 3-Clause License](https://img.shields.io/badge/License-BSD%203--Clause-orange.svg)](https://github.com/yoshoku/numo-pocketfft/blob/main/LICENSE.txt)
|
7
|
+
[![Documentation](http://img.shields.io/badge/docs-rdoc.info-blue.svg)](https://yoshoku.github.io/numo-pocketfft/doc/)
|
6
8
|
|
7
9
|
Numo::Pocketfft provides functions for performing descrete Fourier Transform with
|
8
10
|
[Numo::NArray](https://github.com/ruby-numo/numo-narray) by using
|
@@ -13,7 +15,7 @@ Note: There are other useful Ruby gems perform descrete Fourier Transform with N
|
|
13
15
|
|
14
16
|
## Installation
|
15
17
|
|
16
|
-
Numo::Pocketfft bundles pocketfft codes, so there is no need to install
|
18
|
+
Numo::Pocketfft bundles pocketfft codes, so there is no need to install another external library in advance.
|
17
19
|
Add this line to your application's Gemfile:
|
18
20
|
|
19
21
|
```ruby
|
@@ -73,4 +75,4 @@ The gem is available as open source under the terms of the [BSD-3-Clause License
|
|
73
75
|
|
74
76
|
## Code of Conduct
|
75
77
|
|
76
|
-
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/
|
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).
|
data/Steepfile
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
target :lib do
|
2
|
+
signature "sig"
|
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
|
@@ -3,8 +3,7 @@
|
|
3
3
|
VALUE mNumo;
|
4
4
|
VALUE mPocketfft;
|
5
5
|
|
6
|
-
VALUE numo_pocketfft_fft(VALUE x_val, int is_forward)
|
7
|
-
{
|
6
|
+
VALUE numo_pocketfft_fft(VALUE x_val, int is_forward) {
|
8
7
|
narray_t* x_nary;
|
9
8
|
double* x_pt;
|
10
9
|
size_t length;
|
@@ -12,6 +11,7 @@ VALUE numo_pocketfft_fft(VALUE x_val, int is_forward)
|
|
12
11
|
int n_repeats;
|
13
12
|
int i;
|
14
13
|
int res;
|
14
|
+
int fail;
|
15
15
|
double fct;
|
16
16
|
VALUE z_val;
|
17
17
|
double* z_pt;
|
@@ -30,22 +30,27 @@ VALUE numo_pocketfft_fft(VALUE x_val, int is_forward)
|
|
30
30
|
length = NA_SHAPE(x_nary)[n_dims - 1];
|
31
31
|
x_pt = (double*)na_get_pointer_for_read(x_val);
|
32
32
|
|
33
|
-
z_val = nary_s_new_like(numo_cDComplex, x_val);
|
34
|
-
z_pt = (double*)na_get_pointer_for_write(z_val);
|
35
|
-
GetNArray(z_val, z_nary);
|
36
|
-
for (i = 0; i < (int)(NA_SIZE(z_nary) * 2); z_pt[i++] = 0.0);
|
37
|
-
|
38
|
-
fct = is_forward == 1 ? 1.0 : 1.0 / length;
|
39
33
|
plan = make_cfft_plan(length);
|
40
34
|
if (!plan) {
|
35
|
+
rb_raise(rb_eNoMemError, "Failed to allocate memory for plan of pocketfft.");
|
41
36
|
return Qnil;
|
42
37
|
}
|
43
38
|
|
39
|
+
z_val = nary_s_new_like(numo_cDComplex, x_val);
|
40
|
+
z_pt = (double*)na_get_pointer_for_write(z_val);
|
41
|
+
GetNArray(z_val, z_nary);
|
42
|
+
memset(z_pt, 0, (NA_SIZE(z_nary) * 2) * sizeof(double));
|
43
|
+
|
44
|
+
fail = 0;
|
45
|
+
fct = is_forward == 1 ? 1.0 : 1.0 / length;
|
44
46
|
n_repeats = (int)(NA_SIZE(x_nary)) / length;
|
45
47
|
for (i = 0; i < n_repeats; i++) {
|
46
48
|
memcpy(z_pt, x_pt, 2 * length * sizeof(double));
|
47
49
|
res = is_forward == 1 ? cfft_forward(plan, z_pt, fct) : cfft_backward(plan, z_pt, fct);
|
48
|
-
if (res != 0) {
|
50
|
+
if (res != 0) {
|
51
|
+
fail = 1;
|
52
|
+
break;
|
53
|
+
}
|
49
54
|
z_pt += length * 2;
|
50
55
|
x_pt += length * 2;
|
51
56
|
}
|
@@ -54,36 +59,38 @@ VALUE numo_pocketfft_fft(VALUE x_val, int is_forward)
|
|
54
59
|
destroy_cfft_plan(plan);
|
55
60
|
}
|
56
61
|
|
62
|
+
RB_GC_GUARD(x_val);
|
63
|
+
|
64
|
+
if (fail) {
|
65
|
+
rb_raise(rb_eNoMemError, "Failed to allocate memory in function of pocketfft.");
|
66
|
+
rb_funcall(z_val, rb_intern("free"), 0);
|
67
|
+
return Qnil;
|
68
|
+
}
|
69
|
+
|
57
70
|
return z_val;
|
58
71
|
}
|
59
72
|
|
60
73
|
/**
|
61
74
|
* @!visibility private
|
62
75
|
*/
|
63
|
-
static VALUE numo_pocketfft_cfft(VALUE self, VALUE x_val)
|
64
|
-
{
|
65
|
-
return numo_pocketfft_fft(x_val, 1);
|
66
|
-
}
|
76
|
+
static VALUE numo_pocketfft_cfft(VALUE self, VALUE x_val) { return numo_pocketfft_fft(x_val, 1); }
|
67
77
|
|
68
78
|
/**
|
69
79
|
* @!visibility private
|
70
80
|
*/
|
71
|
-
static VALUE numo_pocketfft_icfft(VALUE self, VALUE x_val)
|
72
|
-
{
|
73
|
-
return numo_pocketfft_fft(x_val, 0);
|
74
|
-
}
|
81
|
+
static VALUE numo_pocketfft_icfft(VALUE self, VALUE x_val) { return numo_pocketfft_fft(x_val, 0); }
|
75
82
|
|
76
83
|
/**
|
77
84
|
* @!visibility private
|
78
85
|
*/
|
79
|
-
static VALUE numo_pocketfft_rfft(VALUE self, VALUE x_val)
|
80
|
-
{
|
86
|
+
static VALUE numo_pocketfft_rfft(VALUE self, VALUE x_val) {
|
81
87
|
narray_t* x_nary;
|
82
88
|
double* x_pt;
|
83
89
|
int n_dims;
|
84
90
|
size_t length;
|
85
91
|
int n_repeats;
|
86
92
|
int i;
|
93
|
+
int fail;
|
87
94
|
size_t* z_shape;
|
88
95
|
VALUE z_val;
|
89
96
|
narray_t* z_nary;
|
@@ -105,6 +112,7 @@ static VALUE numo_pocketfft_rfft(VALUE self, VALUE x_val)
|
|
105
112
|
|
106
113
|
plan = make_rfft_plan(length);
|
107
114
|
if (!plan) {
|
115
|
+
rb_raise(rb_eNoMemError, "Failed to allocate memory for plan of pocketfft.");
|
108
116
|
return Qnil;
|
109
117
|
}
|
110
118
|
|
@@ -116,14 +124,18 @@ static VALUE numo_pocketfft_rfft(VALUE self, VALUE x_val)
|
|
116
124
|
z_val = rb_narray_new(numo_cDComplex, n_dims, z_shape);
|
117
125
|
z_pt = (double*)na_get_pointer_for_write(z_val);
|
118
126
|
GetNArray(z_val, z_nary);
|
119
|
-
|
127
|
+
memset(z_pt, 0, (NA_SIZE(z_nary) * 2) * sizeof(double));
|
120
128
|
|
129
|
+
fail = 0;
|
121
130
|
z_step = (int)(NA_SHAPE(z_nary)[n_dims - 1]) * 2;
|
122
131
|
n_repeats = (int)(NA_SIZE(x_nary)) / length;
|
123
132
|
for (i = 0; i < n_repeats; i++) {
|
124
133
|
z_pt[z_step - 1] = 0.0;
|
125
134
|
memcpy(z_pt + 1, x_pt, length * sizeof(double));
|
126
|
-
if (rfft_forward(plan, z_pt + 1, 1.0) != 0) {
|
135
|
+
if (rfft_forward(plan, z_pt + 1, 1.0) != 0) {
|
136
|
+
fail = 1;
|
137
|
+
break;
|
138
|
+
}
|
127
139
|
z_pt[0] = z_pt[1];
|
128
140
|
z_pt[1] = 0.0;
|
129
141
|
z_pt += z_step;
|
@@ -134,20 +146,28 @@ static VALUE numo_pocketfft_rfft(VALUE self, VALUE x_val)
|
|
134
146
|
destroy_rfft_plan(plan);
|
135
147
|
}
|
136
148
|
|
149
|
+
RB_GC_GUARD(x_val);
|
150
|
+
|
151
|
+
if (fail) {
|
152
|
+
rb_raise(rb_eNoMemError, "Failed to allocate memory in function of pocketfft.");
|
153
|
+
rb_funcall(z_val, rb_intern("free"), 0);
|
154
|
+
return Qnil;
|
155
|
+
}
|
156
|
+
|
137
157
|
return z_val;
|
138
158
|
}
|
139
159
|
|
140
160
|
/**
|
141
161
|
* @!visibility private
|
142
162
|
*/
|
143
|
-
static VALUE numo_pocketfft_irfft(VALUE self, VALUE x_val)
|
144
|
-
{
|
163
|
+
static VALUE numo_pocketfft_irfft(VALUE self, VALUE x_val) {
|
145
164
|
narray_t* x_nary;
|
146
165
|
double* x_pt;
|
147
166
|
size_t length;
|
148
167
|
int n_dims;
|
149
168
|
int n_repeats;
|
150
169
|
int i;
|
170
|
+
int fail;
|
151
171
|
double fct;
|
152
172
|
size_t* z_shape;
|
153
173
|
VALUE z_val;
|
@@ -166,10 +186,10 @@ static VALUE numo_pocketfft_irfft(VALUE self, VALUE x_val)
|
|
166
186
|
n_dims = NA_NDIM(x_nary);
|
167
187
|
length = NA_SHAPE(x_nary)[n_dims - 1];
|
168
188
|
x_pt = (double*)na_get_pointer_for_read(x_val);
|
169
|
-
fct = 1.0 / length;
|
170
189
|
|
171
190
|
plan = make_rfft_plan(length);
|
172
191
|
if (!plan) {
|
192
|
+
rb_raise(rb_eNoMemError, "Failed to allocate memory for plan of pocketfft.");
|
173
193
|
return Qnil;
|
174
194
|
}
|
175
195
|
|
@@ -181,13 +201,18 @@ static VALUE numo_pocketfft_irfft(VALUE self, VALUE x_val)
|
|
181
201
|
z_val = rb_narray_new(numo_cDFloat, n_dims, z_shape);
|
182
202
|
z_pt = (double*)na_get_pointer_for_write(z_val);
|
183
203
|
GetNArray(z_val, z_nary);
|
184
|
-
|
204
|
+
memset(z_pt, 0, NA_SIZE(z_nary) * sizeof(double));
|
185
205
|
|
206
|
+
fail = 0;
|
207
|
+
fct = 1.0 / length;
|
186
208
|
n_repeats = (int)(NA_SIZE(z_nary)) / length;
|
187
209
|
for (i = 0; i < n_repeats; i++) {
|
188
210
|
memcpy(z_pt + 1, x_pt + 2, (length - 1) * sizeof(double));
|
189
211
|
z_pt[0] = x_pt[0];
|
190
|
-
if (rfft_backward(plan, z_pt, fct) != 0) {
|
212
|
+
if (rfft_backward(plan, z_pt, fct) != 0) {
|
213
|
+
fail = 1;
|
214
|
+
break;
|
215
|
+
}
|
191
216
|
z_pt += length;
|
192
217
|
x_pt += length * 2;
|
193
218
|
}
|
@@ -196,11 +221,18 @@ static VALUE numo_pocketfft_irfft(VALUE self, VALUE x_val)
|
|
196
221
|
destroy_rfft_plan(plan);
|
197
222
|
}
|
198
223
|
|
224
|
+
RB_GC_GUARD(x_val);
|
225
|
+
|
226
|
+
if (fail) {
|
227
|
+
rb_raise(rb_eNoMemError, "Failed to allocate memory in function of pocketfft.");
|
228
|
+
rb_funcall(z_val, rb_intern("free"), 0);
|
229
|
+
return Qnil;
|
230
|
+
}
|
231
|
+
|
199
232
|
return z_val;
|
200
233
|
}
|
201
234
|
|
202
|
-
void Init_pocketfftext()
|
203
|
-
{
|
235
|
+
void Init_pocketfftext() {
|
204
236
|
rb_require("numo/narray");
|
205
237
|
|
206
238
|
mNumo = rb_define_module("Numo");
|
data/lib/numo/pocketfft.rb
CHANGED
@@ -10,106 +10,205 @@ module Numo
|
|
10
10
|
|
11
11
|
# Compute the 1-dimensional discrete Fourier Transform.
|
12
12
|
# @param a [Numo::DFloat/Numo::DComplex] Real or complex 1-dimensional input array.
|
13
|
+
# @raise [ArgumentError] This error is raised if input array is not Numo::NArray, is not one-dimensional array, or is empty.
|
13
14
|
# @return [Numo::DComplex] Transformed data.
|
14
15
|
def fft(a)
|
16
|
+
raise ArgumentError, 'Expect class of input array to be Numo::NArray.' unless a.is_a?(Numo::NArray)
|
17
|
+
raise ArgumentError, 'Expect input array to be non-empty.' if a.empty?
|
15
18
|
raise ArgumentError, 'Expect input array to be one-dimensional.' unless a.ndim == 1
|
19
|
+
|
16
20
|
raw_fft(a, 0, inverse: false, real: false)
|
17
21
|
end
|
18
22
|
|
19
23
|
# Compute the 1-dimensional inverse discrete Fourier Transform.
|
20
24
|
# @param a [Numo::DComplex] Complex 1-dimensional input array.
|
25
|
+
# @raise [ArgumentError] This error is raised if input array is not Numo::NArray, is not one-dimensional array, or is empty.
|
21
26
|
# @return [Numo::DComplex] Inversed transformed data.
|
22
27
|
def ifft(a)
|
28
|
+
raise ArgumentError, 'Expect class of input array to be Numo::NArray.' unless a.is_a?(Numo::NArray)
|
29
|
+
raise ArgumentError, 'Expect input array to be non-empty.' if a.empty?
|
23
30
|
raise ArgumentError, 'Expect input array to be one-dimensional.' unless a.ndim == 1
|
31
|
+
|
24
32
|
raw_fft(a, 0, inverse: true, real: false)
|
25
33
|
end
|
26
34
|
|
27
35
|
# Compute the 2-dimensional discrete Fourier Transform.
|
28
36
|
# @param a [Numo::DFloat/Numo::DComplex] Real or complex 2-dimensional input array.
|
37
|
+
# @raise [ArgumentError] This error is raised if input array is not Numo::NArray, is not two-dimensional array, or is empty.
|
29
38
|
# @return [Numo::DComplex] Transformed data.
|
30
39
|
def fft2(a)
|
40
|
+
raise ArgumentError, 'Expect class of input array to be Numo::NArray.' unless a.is_a?(Numo::NArray)
|
41
|
+
raise ArgumentError, 'Expect input array to be non-empty.' if a.empty?
|
31
42
|
raise ArgumentError, 'Expect input array to be two-dimensional.' unless a.ndim == 2
|
43
|
+
|
32
44
|
fftn(a)
|
33
45
|
end
|
34
46
|
|
35
47
|
# Compute the 2-dimensional inverse discrete Fourier Transform.
|
36
48
|
# @param a [Numo::DComplex] Complex 2-dimensional input array.
|
49
|
+
# @raise [ArgumentError] This error is raised if input array is not Numo::NArray, is not two-dimensional array, or is empty.
|
37
50
|
# @return [Numo::DComplex] Inversed transformed data.
|
38
51
|
def ifft2(a)
|
52
|
+
raise ArgumentError, 'Expect class of input array to be Numo::NArray.' unless a.is_a?(Numo::NArray)
|
53
|
+
raise ArgumentError, 'Expect input array to be non-empty.' if a.empty?
|
39
54
|
raise ArgumentError, 'Expect input array to be two-dimensional.' unless a.ndim == 2
|
55
|
+
|
40
56
|
ifftn(a)
|
41
57
|
end
|
42
58
|
|
43
59
|
# Compute the N-dimensional discrete Fourier Transform.
|
44
60
|
# @param a [Numo::DFloat/Numo::DComplex] Real or complex input array with any-dimension.
|
61
|
+
# @raise [ArgumentError] This error is raised if input array is not Numo::NArray or is empty.
|
45
62
|
# @return [Numo::DComplex] Transformed data.
|
46
63
|
def fftn(a)
|
47
|
-
|
48
|
-
|
64
|
+
raise ArgumentError, 'Expect class of input array to be Numo::NArray.' unless a.is_a?(Numo::NArray)
|
65
|
+
raise ArgumentError, 'Expect input array to be non-empty.' if a.empty?
|
66
|
+
|
67
|
+
return raw_fft(a, 0, inverse: false, real: false) if a.ndim == 1
|
68
|
+
|
69
|
+
last_axis_id = a.ndim - 1
|
70
|
+
b = raw_fft(a, last_axis_id, inverse: false, real: false)
|
71
|
+
(last_axis_id - 1).downto(0) { |ax_id| b = raw_fft(b, ax_id, inverse: false, real: false) }
|
49
72
|
b
|
50
73
|
end
|
51
74
|
|
52
75
|
# Compute the N-dimensional inverse discrete Fourier Transform.
|
53
76
|
# @param a [Numo::DComplex] Complex input array with any-dimension.
|
77
|
+
# @raise [ArgumentError] This error is raised if input array is not Numo::NArray or is empty.
|
54
78
|
# @return [Numo::DComplex] Inversed transformed data.
|
55
79
|
def ifftn(a)
|
56
|
-
|
57
|
-
|
80
|
+
raise ArgumentError, 'Expect class of input array to be Numo::NArray.' unless a.is_a?(Numo::NArray)
|
81
|
+
raise ArgumentError, 'Expect input array to be non-empty.' if a.empty?
|
82
|
+
|
83
|
+
return raw_fft(a, 0, inverse: true, real: false) if a.ndim == 1
|
84
|
+
|
85
|
+
last_axis_id = a.ndim - 1
|
86
|
+
b = raw_fft(a, 0, inverse: true, real: false)
|
87
|
+
1.upto(last_axis_id) { |ax_id| b = raw_fft(b, ax_id, inverse: true, real: false) }
|
58
88
|
b
|
59
89
|
end
|
60
90
|
|
61
91
|
# Compute the 1-dimensional discrete Fourier Transform for real input.
|
62
92
|
# @param a [Numo::DFloat] Real 1-dimensional input array.
|
93
|
+
# @raise [ArgumentError] This error is raised if input array is not Numo::NArray, is not one-dimensional array, or is empty.
|
63
94
|
# @return [Numo::DComplex] Transformed data.
|
64
95
|
def rfft(a)
|
96
|
+
raise ArgumentError, 'Expect class of input array to be Numo::NArray.' unless a.is_a?(Numo::NArray)
|
97
|
+
raise ArgumentError, 'Expect input array to be non-empty.' if a.empty?
|
65
98
|
raise ArgumentError, 'Expect input array to be one-dimensional.' unless a.ndim == 1
|
99
|
+
|
66
100
|
raw_fft(a, 0, inverse: false, real: true)
|
67
101
|
end
|
68
102
|
|
69
103
|
# Compute the inverse of the 1-dimensional discrete Fourier Transform of real input.
|
70
104
|
# @param a [Numo::DComplex] Complex 1-dimensional input array.
|
105
|
+
# @raise [ArgumentError] This error is raised if input array is not Numo::NArray, is not one-dimensional array, or is empty.
|
71
106
|
# @return [Numo::DFloat] Inverse transformed data.
|
72
107
|
def irfft(a)
|
108
|
+
raise ArgumentError, 'Expect class of input array to be Numo::NArray.' unless a.is_a?(Numo::NArray)
|
109
|
+
raise ArgumentError, 'Expect input array to be non-empty.' if a.empty?
|
73
110
|
raise ArgumentError, 'Expect input array to be one-dimensional.' unless a.ndim == 1
|
111
|
+
|
74
112
|
raw_fft(a, 0, inverse: true, real: true)
|
75
113
|
end
|
76
114
|
|
77
115
|
# Compute the 2-dimensional discrete Fourier Transform for real input.
|
78
116
|
# @param a [Numo::DFloat] Real 2-dimensional input array.
|
117
|
+
# @raise [ArgumentError] This error is raised if input array is not Numo::NArray, is not two-dimensional array, or is empty.
|
79
118
|
# @return [Numo::DComplex] Transformed data.
|
80
119
|
def rfft2(a)
|
120
|
+
raise ArgumentError, 'Expect class of input array to be Numo::NArray.' unless a.is_a?(Numo::NArray)
|
121
|
+
raise ArgumentError, 'Expect input array to be non-empty.' if a.empty?
|
81
122
|
raise ArgumentError, 'Expect input array to be two-dimensional.' unless a.ndim == 2
|
123
|
+
|
82
124
|
rfftn(a)
|
83
125
|
end
|
84
126
|
|
85
127
|
# Compute the inverse of the 2-dimensional discrete Fourier Transform of real input.
|
86
128
|
# @param a [Numo::DComplex] Complex 2-dimensional input array.
|
129
|
+
# @raise [ArgumentError] This error is raised if input array is not Numo::NArray, is not two-dimensional array, or is empty.
|
87
130
|
# @return [Numo::DFloat] Inverse transformed data.
|
88
131
|
def irfft2(a)
|
132
|
+
raise ArgumentError, 'Expect class of input array to be Numo::NArray.' unless a.is_a?(Numo::NArray)
|
133
|
+
raise ArgumentError, 'Expect input array to be non-empty.' if a.empty?
|
89
134
|
raise ArgumentError, 'Expect input array to be two-dimensional.' unless a.ndim == 2
|
135
|
+
|
90
136
|
irfftn(a)
|
91
137
|
end
|
92
138
|
|
93
139
|
# Compute the N-dimensional discrete Fourier Transform for real input.
|
94
140
|
# @param a [Numo::DFloat] Real input array with any-dimension.
|
141
|
+
# @raise [ArgumentError] This error is raised if input array is not Numo::NArray or is empty.
|
95
142
|
# @return [Numo::DComplex] Transformed data.
|
96
143
|
def rfftn(a)
|
144
|
+
raise ArgumentError, 'Expect class of input array to be Numo::NArray.' unless a.is_a?(Numo::NArray)
|
145
|
+
raise ArgumentError, 'Expect input array to be non-empty.' if a.empty?
|
146
|
+
|
147
|
+
return raw_fft(a, 0, inverse: false, real: true) if a.ndim == 1
|
148
|
+
|
97
149
|
last_axis_id = a.ndim - 1
|
98
150
|
b = raw_fft(a, last_axis_id, inverse: false, real: true)
|
99
|
-
(
|
151
|
+
(last_axis_id - 1).downto(0) { |ax_id| b = raw_fft(b, ax_id, inverse: false, real: false) }
|
100
152
|
b
|
101
153
|
end
|
102
154
|
|
103
155
|
# Compute the inverse of the N-dimensional discrete Fourier Transform of real input.
|
104
156
|
# @param a [Numo::DComplex] Complex input array with any-dimension.
|
157
|
+
# @raise [ArgumentError] This error is raised if input array is not Numo::NArray or is empty.
|
105
158
|
# @return [Numo::DFloat] Inverse transformed data.
|
106
159
|
def irfftn(a)
|
160
|
+
raise ArgumentError, 'Expect class of input array to be Numo::NArray.' unless a.is_a?(Numo::NArray)
|
161
|
+
raise ArgumentError, 'Expect input array to be non-empty.' if a.empty?
|
162
|
+
|
163
|
+
return raw_fft(a, 0, inverse: true, real: true) if a.ndim == 1
|
164
|
+
|
107
165
|
last_axis_id = a.ndim - 1
|
108
|
-
b = a
|
109
|
-
(
|
166
|
+
b = raw_fft(a, 0, inverse: true, real: false)
|
167
|
+
1.upto(last_axis_id - 1) { |ax_id| b = raw_fft(b, ax_id, inverse: true, real: false) }
|
110
168
|
raw_fft(b, last_axis_id, inverse: true, real: true)
|
111
169
|
end
|
112
170
|
|
171
|
+
# Convolve two N-dimensinal arrays using dscrete Fourier Transform.
|
172
|
+
# @example
|
173
|
+
# require 'numo/pocketfftw'
|
174
|
+
#
|
175
|
+
# a = Numo::DFloat[1, 2, 3]
|
176
|
+
# b = Numo::DFloat[4, 5]
|
177
|
+
# p Numo::Pocketfft.fftconvolve(a, b)
|
178
|
+
# # Numo::DFloat#shape=[4]
|
179
|
+
# # [4, 13, 22, 15]
|
180
|
+
#
|
181
|
+
# a = Numo::DFloat[[1, 2], [3, 4]]
|
182
|
+
# b = Numo::DFloat[[5, 6], [7, 8]]
|
183
|
+
# p Numo::Pocketfft.fftconvolve(a, b)
|
184
|
+
# # Numo::DFloat#shape=[3,3]
|
185
|
+
# # [[5, 16, 12],
|
186
|
+
# # [22, 60, 40],
|
187
|
+
# # [21, 52, 32]]
|
188
|
+
# @param a [Numo::DFloat/Numo::DComplex] Fisrt input array with any-dimension.
|
189
|
+
# @param b [Numo::DFloat/Numo::DComplex] Second input array with the same number of dimensions as first input array.
|
190
|
+
# @raise [ArgumentError] This error is raised if input arrays are not Numo::NArray, are not the same dimensionality, or are empty.
|
191
|
+
# @return [Numo::DFloat/Numo::DComplex] The discrete linear convolution of 'a' with 'b'.
|
192
|
+
def fftconvolve(a, b)
|
193
|
+
raise ArgumentError, 'Expect class of input array to be Numo::NArray.' unless a.is_a?(Numo::NArray) && b.is_a?(Numo::NArray)
|
194
|
+
raise ArgumentError, 'Expect input array to be non-empty.' if a.empty? || b.empty?
|
195
|
+
raise ArgumentError, 'Input arrays should have the same dimensionarity' if a.ndim != b.ndim
|
196
|
+
|
197
|
+
ashp = a.shape
|
198
|
+
bshp = b.shape
|
199
|
+
|
200
|
+
return a * b if (ashp + bshp).all? { |el| el == 1 }
|
201
|
+
|
202
|
+
retshp = Array.new(a.ndim) { |n| ashp[n] + bshp[n] - 1 }
|
203
|
+
a_zp = Numo::DComplex.zeros(*retshp).tap { |arr| arr[*ashp.map { |n| 0...n }] = a }
|
204
|
+
b_zp = Numo::DComplex.zeros(*retshp).tap { |arr| arr[*bshp.map { |n| 0...n }] = b }
|
205
|
+
ret = ifftn(fftn(a_zp) * fftn(b_zp))
|
206
|
+
|
207
|
+
return ret if a.is_a?(Numo::DComplex) || a.is_a?(Numo::SComplex) || b.is_a?(Numo::DComplex) || b.is_a?(Numo::SComplex)
|
208
|
+
|
209
|
+
ret.real
|
210
|
+
end
|
211
|
+
|
113
212
|
# @!visibility private
|
114
213
|
def raw_fft(a, axis_id, inverse:, real:)
|
115
214
|
if axis_id == a.ndim - 1
|
@@ -120,8 +219,7 @@ module Numo
|
|
120
219
|
b_shape = a.shape
|
121
220
|
b_shape[-1] = n
|
122
221
|
b = Numo::DComplex.zeros(*b_shape)
|
123
|
-
b_range =
|
124
|
-
b_range[-1] = 0...a.shape[-1]
|
222
|
+
b_range = Array.new(b.ndim) { |idx| idx < b.ndim - 1 ? true : 0...a.shape[-1] }
|
125
223
|
b[*b_range] = a
|
126
224
|
# inverse of dft for real data
|
127
225
|
ext_irfft(b)
|
data/numo-pocketfft.gemspec
CHANGED
@@ -37,11 +37,13 @@ Gem::Specification.new do |spec|
|
|
37
37
|
spec.require_paths = ['lib']
|
38
38
|
spec.extensions = ['ext/numo/pocketfft/extconf.rb']
|
39
39
|
|
40
|
-
spec.
|
40
|
+
spec.metadata = {
|
41
|
+
'homepage_uri' => 'https://github.com/yoshoku/numo-pocketfft',
|
42
|
+
'changelog_uri' => 'https://github.com/yoshoku/numo-pocketfft/blob/main/CHANGELOG.md',
|
43
|
+
'source_code_uri' => 'https://github.com/yoshoku/numo-pocketfft',
|
44
|
+
'documentation_uri' => 'https://yoshoku.github.io/numo-pocketfft/doc/',
|
45
|
+
'bug_tracker_uri' => 'https://github.com/yoshoku/numo-pocketfft/issues'
|
46
|
+
}
|
41
47
|
|
42
|
-
spec.
|
43
|
-
spec.add_development_dependency 'coveralls', '~> 0.8'
|
44
|
-
spec.add_development_dependency 'rake', '~> 10.0'
|
45
|
-
spec.add_development_dependency 'rake-compiler', '~> 1.0'
|
46
|
-
spec.add_development_dependency 'rspec', '~> 3.0'
|
48
|
+
spec.add_runtime_dependency 'numo-narray', '~> 0.9.1'
|
47
49
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module Numo
|
2
|
+
module Pocketfft
|
3
|
+
VERSION: String
|
4
|
+
|
5
|
+
def self?.fft: (Numo::DFloat | Numo::DComplex a) -> Numo::DComplex
|
6
|
+
def self?.fft2: (Numo::DFloat | Numo::DComplex a) -> Numo::DComplex
|
7
|
+
def self?.fftn: (Numo::DFloat | Numo::DComplex a) -> Numo::DComplex
|
8
|
+
def self?.ifft: (Numo::DComplex a) -> Numo::DComplex
|
9
|
+
def self?.ifft2: (Numo::DComplex a) -> Numo::DComplex
|
10
|
+
def self?.ifftn: (Numo::DComplex a) -> Numo::DComplex
|
11
|
+
def self?.rfft: (Numo::DFloat a) -> Numo::DComplex
|
12
|
+
def self?.rfft2: (Numo::DFloat a) -> Numo::DComplex
|
13
|
+
def self?.rfftn: (Numo::DFloat a) -> Numo::DComplex
|
14
|
+
def self?.irfft: (Numo::DComplex a) -> Numo::DFloat
|
15
|
+
def self?.irfft2: (Numo::DComplex a) -> Numo::DFloat
|
16
|
+
def self?.irfftn: (Numo::DComplex a) -> Numo::DFloat
|
17
|
+
def self?.fftconvolve: (Numo::DFloat | Numo::DComplex a, Numo::DFloat | Numo::DComplex b) -> Numo::DComplex
|
18
|
+
| (Numo::DFloat a, Numo::DFloat b) -> Numo::DFloat
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def self?.ext_cfft: (untyped a) -> untyped
|
23
|
+
def self?.ext_icfft: (untyped a) -> untyped
|
24
|
+
def self?.ext_rfft: (untyped a) -> untyped
|
25
|
+
def self?.ext_irfft: (untyped a) -> untyped
|
26
|
+
def self?.raw_fft: (untyped a, Integer axis_id, inverse: bool inverse, real: bool real) -> untyped
|
27
|
+
end
|
28
|
+
end
|
data/sig/patch.rbs
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
module Numo
|
2
|
+
class NArray
|
3
|
+
def empty?: () -> bool
|
4
|
+
def ndim: () -> Integer
|
5
|
+
def shape: () -> Array[Integer]
|
6
|
+
def swapaxes: (Integer, Integer) -> untyped
|
7
|
+
end
|
8
|
+
|
9
|
+
class DFloat < NArray
|
10
|
+
def *: (untyped) -> untyped
|
11
|
+
def []: (*untyped) -> untyped
|
12
|
+
def []=: (*untyped) -> untyped
|
13
|
+
end
|
14
|
+
|
15
|
+
class DComplex < NArray
|
16
|
+
def self.zeros: (*untyped) -> Numo::DComplex
|
17
|
+
def *: (untyped) -> untyped
|
18
|
+
def []: (*untyped) -> untyped
|
19
|
+
def []=: (*untyped) -> untyped
|
20
|
+
def real: () -> Numo::DFloat
|
21
|
+
end
|
22
|
+
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.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- yoshoku
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: numo-narray
|
@@ -24,76 +24,6 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.9.1
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: bundler
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '2.0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '2.0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: coveralls
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0.8'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0.8'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rake
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '10.0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '10.0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rake-compiler
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '1.0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '1.0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: rspec
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '3.0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '3.0'
|
97
27
|
description: 'Numo::Pocketfft provides functions for descrete Fourier Transform based
|
98
28
|
on pocketfft.
|
99
29
|
|
@@ -105,18 +35,20 @@ extensions:
|
|
105
35
|
- ext/numo/pocketfft/extconf.rb
|
106
36
|
extra_rdoc_files: []
|
107
37
|
files:
|
38
|
+
- ".clang-format"
|
108
39
|
- ".coveralls.yml"
|
40
|
+
- ".github/workflows/build.yml"
|
41
|
+
- ".github/workflows/coverage.yml"
|
109
42
|
- ".gitignore"
|
110
43
|
- ".gitmodules"
|
111
44
|
- ".rspec"
|
112
|
-
-
|
45
|
+
- CHANGELOG.md
|
113
46
|
- CODE_OF_CONDUCT.md
|
114
47
|
- Gemfile
|
115
48
|
- LICENSE.txt
|
116
49
|
- README.md
|
117
50
|
- Rakefile
|
118
|
-
-
|
119
|
-
- bin/setup
|
51
|
+
- Steepfile
|
120
52
|
- ext/numo/pocketfft/extconf.rb
|
121
53
|
- ext/numo/pocketfft/pocketfft/.gitlab-ci.yml
|
122
54
|
- ext/numo/pocketfft/pocketfft/LICENSE.md
|
@@ -130,10 +62,17 @@ files:
|
|
130
62
|
- lib/numo/pocketfft.rb
|
131
63
|
- lib/numo/pocketfft/version.rb
|
132
64
|
- numo-pocketfft.gemspec
|
65
|
+
- sig/numo/pocketfft.rbs
|
66
|
+
- sig/patch.rbs
|
133
67
|
homepage: https://github.com/yoshoku/numo-pocketfft
|
134
68
|
licenses:
|
135
69
|
- BSD-3-Clause
|
136
|
-
metadata:
|
70
|
+
metadata:
|
71
|
+
homepage_uri: https://github.com/yoshoku/numo-pocketfft
|
72
|
+
changelog_uri: https://github.com/yoshoku/numo-pocketfft/blob/main/CHANGELOG.md
|
73
|
+
source_code_uri: https://github.com/yoshoku/numo-pocketfft
|
74
|
+
documentation_uri: https://yoshoku.github.io/numo-pocketfft/doc/
|
75
|
+
bug_tracker_uri: https://github.com/yoshoku/numo-pocketfft/issues
|
137
76
|
post_install_message:
|
138
77
|
rdoc_options: []
|
139
78
|
require_paths:
|
@@ -149,8 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
149
88
|
- !ruby/object:Gem::Version
|
150
89
|
version: '0'
|
151
90
|
requirements: []
|
152
|
-
|
153
|
-
rubygems_version: 2.6.14.4
|
91
|
+
rubygems_version: 3.1.6
|
154
92
|
signing_key:
|
155
93
|
specification_version: 4
|
156
94
|
summary: Numo::Pocketfft provides functions for descrete Fourier Transform based on
|