ffts 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +3 -2
- data/ext/ffts/ffts.c +15 -7
- data/lib/ffts/version.rb +1 -1
- metadata +16 -16
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10f347bd4abb1ff4718df56c1d5bb03e2a445419
|
4
|
+
data.tar.gz: 1ba1ed3c8241c42cce9aee993fef4b8b8690b45a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 73a5833e4ba612e2497300175881ebd2eb25447c35fec9aca22ee25412b3f88c8b03e72d776af9d00fb2c67076812d4ec49c213dadb7d6462d544851357ef91f
|
7
|
+
data.tar.gz: 15e31ca601b38e7f65478b3b85d6ab39fcbf1e9cc301fe3e38cb450f167fcda955565aeb994974364f94ef0dc08f2f4ec9d3c5a3bbbb38224e4cbfee199cb17e
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
@@ -1,2 +1,3 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
S5%� ei�C�|�q��D7����rd�`�Q�|�S�A'�:$7N'��q�z1c=�o4n�ܣ<h\_G�oñDFE��D6�#��MhU<�ׯQo��%l������p"�~���.S-��Cf>���OP���
|
2
|
+
?���H�#��(,f�`y
|
3
|
+
��z�����h�m6L�`l�e��1�=���5ջ�V�����d�
|
data/ext/ffts/ffts.c
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
#include <ruby.h>
|
2
1
|
#include <stdio.h>
|
2
|
+
#include <stdbool.h>
|
3
|
+
#include <ruby.h>
|
3
4
|
#include <ffts/ffts.h>
|
4
5
|
|
5
6
|
// Declare variables.
|
@@ -7,12 +8,14 @@ VALUE mFFTS;
|
|
7
8
|
VALUE cPlan;
|
8
9
|
VALUE cCPlan;
|
9
10
|
|
11
|
+
bool is_power_of_two(size_t num);
|
12
|
+
|
10
13
|
static VALUE
|
11
14
|
ffts_plan_initialize(VALUE self, VALUE rb_frames, VALUE rb_sign) {
|
12
15
|
ffts_plan_t *plan;
|
13
16
|
|
14
|
-
size_t
|
15
|
-
if (
|
17
|
+
size_t n = RARRAY_LEN(rb_frames);
|
18
|
+
if (!is_power_of_two(n)) {
|
16
19
|
rb_raise(rb_eRuntimeError, "Frames must be a power of 2.");
|
17
20
|
return Qnil;
|
18
21
|
}
|
@@ -23,11 +26,11 @@ ffts_plan_initialize(VALUE self, VALUE rb_frames, VALUE rb_sign) {
|
|
23
26
|
return Qnil;
|
24
27
|
}
|
25
28
|
|
26
|
-
plan = ffts_init_1d(
|
29
|
+
plan = ffts_init_1d(n, sign_v);
|
27
30
|
|
28
31
|
VALUE rb_plan = Data_Wrap_Struct(cCPlan, NULL, ffts_free, plan);
|
29
32
|
|
30
|
-
rb_funcall(self, rb_intern("n="), 1, INT2NUM(
|
33
|
+
rb_funcall(self, rb_intern("n="), 1, INT2NUM(n));
|
31
34
|
rb_funcall(self, rb_intern("frames="), 1, rb_frames);
|
32
35
|
rb_funcall(self, rb_intern("sign="), 1, rb_sign);
|
33
36
|
rb_funcall(self, rb_intern("plan="), 1, rb_plan);
|
@@ -46,8 +49,8 @@ ffts_plan_execute(VALUE self) {
|
|
46
49
|
ffts_plan_t *plan;
|
47
50
|
Data_Get_Struct(rb_plan, ffts_plan_t, plan);
|
48
51
|
|
49
|
-
|
50
|
-
if (n
|
52
|
+
size_t n = NUM2INT(rb_n);
|
53
|
+
if (!is_power_of_two(n)) {
|
51
54
|
return Qnil;
|
52
55
|
}
|
53
56
|
|
@@ -72,6 +75,11 @@ ffts_plan_execute(VALUE self) {
|
|
72
75
|
return rb_output;
|
73
76
|
}
|
74
77
|
|
78
|
+
bool
|
79
|
+
is_power_of_two(size_t num) {
|
80
|
+
return num != 0 && (num & (num - 1)) == 0;
|
81
|
+
}
|
82
|
+
|
75
83
|
void
|
76
84
|
Init_ffts(void) {
|
77
85
|
mFFTS = rb_const_get(rb_cObject, rb_intern("FFTS"));
|
data/lib/ffts/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ffts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Rasband
|
@@ -12,23 +12,23 @@ cert_chain:
|
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
13
|
MIIDeDCCAmCgAwIBAgIBATANBgkqhkiG9w0BAQUFADBBMRMwEQYDVQQDDApkYW5y
|
14
14
|
YXNiYW5kMRUwEwYKCZImiZPyLGQBGRYFZ21haWwxEzARBgoJkiaJk/IsZAEZFgNj
|
15
|
-
|
15
|
+
b20wHhcNMTUxMDI2MjIxNjI3WhcNMTYxMDI1MjIxNjI3WjBBMRMwEQYDVQQDDApk
|
16
16
|
YW5yYXNiYW5kMRUwEwYKCZImiZPyLGQBGRYFZ21haWwxEzARBgoJkiaJk/IsZAEZ
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
17
|
+
FgNjb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDFuophDHk/VC9o
|
18
|
+
shxuFTd6o+R2GTyQcs4cslooCpXvwnH6nCu6P34VKTVvlKAio595xtzq+8u1+oIv
|
19
|
+
d2NIFM0Z7M00s0AjIgp5ax6OotBH8Z0HimJ+N7DPBV3f6IIWD8EE2XIXLzoZ6315
|
20
|
+
g51ezhnmpOwM+FDbNI5IwSgJifh7AaHQT62hf/3s8XWlS63O9cLQIfJgxeIRXtx7
|
21
|
+
Oj5F/GqZs/RAMb8J/9Z2XvFcKgHXQl+EIE4FYqS+oC3YT81S1Dvg8K/cYFt0BnlH
|
22
|
+
FeKPqIGnyLEgo6azEQkdyCZ+n9A/UKING05BiOqxs7XENo/PstaFIvWt+FENZPNZ
|
23
|
+
N2Ywufu5AgMBAAGjezB5MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQW
|
24
|
+
BBS1w2DSMrIeIMYPR8c2K6bd6sLyQzAfBgNVHREEGDAWgRRkYW5yYXNiYW5kQGdt
|
25
25
|
YWlsLmNvbTAfBgNVHRIEGDAWgRRkYW5yYXNiYW5kQGdtYWlsLmNvbTANBgkqhkiG
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
26
|
+
9w0BAQUFAAOCAQEAcgIu1pWJWj7E5noRhfTAVYX3+i3xJiW484bky20n0VSQEX2T
|
27
|
+
s8ENyBhI0y1Y/1BUbWSfhZtKmSJvKjWEVT4NipbFcKod4lrnBruizQ9aTqj9x1B5
|
28
|
+
6KJZl3ppvwqbvSxNxjaOeVO+rGpiRO/zdNLDAJPPuehJOZSyPOILGA2hy5PnOmJE
|
29
|
+
237mrci4Axp8xDT9Qp7ZfgPdp1ZDTdEMXCjb4ihgJiN4cFoZs7IgAQCzyYF3soTL
|
30
|
+
5dFUvDBq46FYLdfJJHzAZrez850ti1TKMYo7ABWoFVLP6yBMquIYU4arv5pQFX7Q
|
31
|
+
bRWJCvjhK7kCrH7LGywoYctBEz0OfIYZ9URmVw==
|
32
32
|
-----END CERTIFICATE-----
|
33
33
|
date: 2015-10-26 00:00:00.000000000 Z
|
34
34
|
dependencies:
|
metadata.gz.sig
CHANGED
Binary file
|