statsample-optimization 2.1.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/.gemtest +0 -0
- data/History.txt +3 -0
- data/Manifest.txt +1 -0
- data/README.txt +2 -0
- data/Rakefile +2 -2
- data/ext/statsamplert/statsamplert.c +30 -10
- data/ext/statsamplert/statsamplert.h +10 -0
- data/test/test_statsample_optimization.rb +32 -4
- metadata +117 -125
- metadata.gz.sig +0 -0
data.tar.gz.sig
CHANGED
Binary file
|
data/.gemtest
ADDED
File without changes
|
data/History.txt
CHANGED
data/Manifest.txt
CHANGED
data/README.txt
CHANGED
data/Rakefile
CHANGED
@@ -8,11 +8,11 @@ Hoe.plugin :git
|
|
8
8
|
|
9
9
|
task "test" => ["lib/statsamplert.so"]
|
10
10
|
spec=Hoe.spec 'statsample-optimization' do
|
11
|
-
self.version="2.1.
|
11
|
+
self.version="2.1.1"
|
12
12
|
self.spec_extras[:extensions] = ["ext/statsamplert/extconf.rb"]
|
13
13
|
self.rubyforge_name = 'ruby-statsample'
|
14
14
|
self.developer('Claudio Bustos', 'clbustos_at_gmail.com')
|
15
|
-
self.extra_deps << ["statsample","~>
|
15
|
+
self.extra_deps << ["statsample","~>1.2"] << ["statistics2", "~>0.54"] << ["gsl", "~>1.14"]
|
16
16
|
self.extra_deps << ["rake-compiler"]
|
17
17
|
|
18
18
|
end
|
@@ -1,14 +1,18 @@
|
|
1
1
|
#include <ruby.h>
|
2
|
+
#include "statsamplert.h"
|
2
3
|
#include "as116.h"
|
3
4
|
/**
|
4
5
|
* :stopdoc:
|
5
6
|
*/
|
6
7
|
|
8
|
+
#define GET_SYM(sym) ID2SYM(rb_intern(sym))
|
9
|
+
|
7
10
|
void Init_statsamplert();
|
8
11
|
VALUE statsample_frequencies(VALUE self, VALUE data);
|
9
12
|
VALUE statsample_set_valid_data_intern(VALUE self, VALUE vector);
|
10
13
|
VALUE statsample_case_as_hash(VALUE self, VALUE ds, VALUE index);
|
11
14
|
VALUE statsample_case_as_array(VALUE self, VALUE ds, VALUE index);
|
15
|
+
VALUE statsample_check_type(VALUE self, VALUE v, VALUE type);
|
12
16
|
VALUE statsample_tetrachoric(VALUE self, VALUE a, VALUE b, VALUE c, VALUE d);
|
13
17
|
|
14
18
|
void Init_statsamplert()
|
@@ -33,6 +37,7 @@ void Init_statsamplert()
|
|
33
37
|
|
34
38
|
rb_define_const(mStatsample, "OPTIMIZED",Qtrue);
|
35
39
|
rb_define_module_function(mSTATSAMPLE__,"frequencies",statsample_frequencies,1);
|
40
|
+
rb_define_module_function(mSTATSAMPLE__,"check_type",statsample_check_type,2);
|
36
41
|
rb_define_module_function(mSTATSAMPLE__,"set_valid_data_intern", statsample_set_valid_data_intern, 1);
|
37
42
|
rb_define_module_function(mSTATSAMPLE__,"case_as_hash",statsample_case_as_hash,2);
|
38
43
|
rb_define_module_function(mSTATSAMPLE__,"case_as_array",statsample_case_as_array,2);
|
@@ -77,7 +82,7 @@ VALUE statsample_set_valid_data_intern(VALUE self, VALUE vector) {
|
|
77
82
|
return Qnil;
|
78
83
|
}
|
79
84
|
/**
|
80
|
-
*
|
85
|
+
* Returns frequencies for an array as a hash, with
|
81
86
|
* keys as items and values as number of items
|
82
87
|
*/
|
83
88
|
VALUE statsample_frequencies(VALUE self, VALUE data) {
|
@@ -133,6 +138,23 @@ VALUE statsample_case_as_array(VALUE self, VALUE ds, VALUE index) {
|
|
133
138
|
return ar;
|
134
139
|
}
|
135
140
|
|
141
|
+
//raise NoMethodError if (t==:scale and @type!=:scale) or (t==:ordinal and @type==:nominal) or (t==:date) or (@type==:date)
|
142
|
+
|
143
|
+
VALUE statsample_check_type(VALUE self, VALUE vector, VALUE type) {
|
144
|
+
VALUE vector_type=rb_iv_get(vector,"@type");
|
145
|
+
VALUE scale=GET_SYM("scale");
|
146
|
+
VALUE ordinal=GET_SYM("ordinal");
|
147
|
+
VALUE nominal=GET_SYM("nominal");
|
148
|
+
VALUE date=GET_SYM("date");
|
149
|
+
|
150
|
+
if ((type==scale && vector_type!=scale) ||
|
151
|
+
(type==ordinal && vector_type==nominal) ||
|
152
|
+
(type==date) ||
|
153
|
+
(vector_type==date)) {
|
154
|
+
rb_raise(rb_eNoMethodError,"Method not available");
|
155
|
+
}
|
156
|
+
return Qnil;
|
157
|
+
}
|
136
158
|
|
137
159
|
|
138
160
|
VALUE statsample_tetrachoric(VALUE self, VALUE a, VALUE b, VALUE c, VALUE d) {
|
@@ -157,14 +179,12 @@ VALUE statsample_tetrachoric(VALUE self, VALUE a, VALUE b, VALUE c, VALUE d) {
|
|
157
179
|
|
158
180
|
result= tetra(&pa,&pb, &pc, &pd, &r,
|
159
181
|
&sdr, &sdzero, &t_x,&t_y, &itype, &ifault);
|
160
|
-
rb_hash_aset(h,
|
161
|
-
rb_hash_aset(h,
|
162
|
-
rb_hash_aset(h,
|
163
|
-
rb_hash_aset(h,
|
164
|
-
rb_hash_aset(h,
|
165
|
-
rb_hash_aset(h,
|
166
|
-
rb_hash_aset(h,
|
167
|
-
|
182
|
+
rb_hash_aset(h, GET_SYM("r"), DBL2NUM(r));
|
183
|
+
rb_hash_aset(h, GET_SYM("sdr"), DBL2NUM(sdr));
|
184
|
+
rb_hash_aset(h, GET_SYM("sdzero"), DBL2NUM(sdzero));
|
185
|
+
rb_hash_aset(h, GET_SYM("threshold_x"), DBL2NUM(t_x));
|
186
|
+
rb_hash_aset(h, GET_SYM("threshold_y"), DBL2NUM(t_y));
|
187
|
+
rb_hash_aset(h, GET_SYM("itype"), INT2NUM(itype));
|
188
|
+
rb_hash_aset(h, GET_SYM("ifault"), INT2NUM(ifault));
|
168
189
|
return h;
|
169
|
-
|
170
190
|
}
|
@@ -43,10 +43,38 @@ class TestRubyStatsampleOpt < Test::Unit::TestCase
|
|
43
43
|
assert(Statsample::STATSAMPLE__.respond_to?(:tetrachoric))
|
44
44
|
a,b,c,d = 30,40,70,20
|
45
45
|
result=Statsample::STATSAMPLE__.tetrachoric(a,b,c,d)
|
46
|
-
assert_in_delta(-0.53980, result[
|
47
|
-
assert_in_delta(0.09940, result[
|
48
|
-
assert_in_delta(-0.15731, result[
|
49
|
-
assert_in_delta(0.31864, result[
|
46
|
+
assert_in_delta(-0.53980, result[:r], 0.0001)
|
47
|
+
assert_in_delta(0.09940, result[:sdr], 0.0001)
|
48
|
+
assert_in_delta(-0.15731, result[:threshold_x], 0.0001)
|
49
|
+
assert_in_delta(0.31864, result[:threshold_y], 0.0001)
|
50
|
+
end
|
51
|
+
def test_check_type
|
52
|
+
assert(Statsample::STATSAMPLE__.respond_to?(:check_type))
|
53
|
+
|
54
|
+
v=Statsample::Vector.new
|
55
|
+
v.type=:nominal
|
56
|
+
assert_raise(NoMethodError) { Statsample::STATSAMPLE__.check_type(v,:scale)}
|
57
|
+
assert_raise(NoMethodError) { Statsample::STATSAMPLE__.check_type(v, :ordinal)}
|
58
|
+
assert(Statsample::STATSAMPLE__.check_type(v, :nominal).nil?)
|
59
|
+
|
60
|
+
v.type=:ordinal
|
61
|
+
|
62
|
+
assert_raise(NoMethodError) { Statsample::STATSAMPLE__.check_type(v,:scale)}
|
63
|
+
|
64
|
+
assert(Statsample::STATSAMPLE__.check_type(v,:ordinal).nil?)
|
65
|
+
assert(Statsample::STATSAMPLE__.check_type(v,:nominal).nil?)
|
66
|
+
|
67
|
+
|
68
|
+
v.type=:scale
|
69
|
+
assert(Statsample::STATSAMPLE__.check_type(v,:scale).nil?)
|
70
|
+
assert(Statsample::STATSAMPLE__.check_type(v,:ordinal).nil?)
|
71
|
+
assert(Statsample::STATSAMPLE__.check_type(v,:nominal).nil?)
|
72
|
+
|
73
|
+
v.type=:date
|
74
|
+
assert_raise(NoMethodError) { Statsample::STATSAMPLE__.check_type(v,:scale)}
|
75
|
+
assert_raise(NoMethodError) { Statsample::STATSAMPLE__.check_type(v,:ordinal)}
|
76
|
+
assert_raise(NoMethodError) { Statsample::STATSAMPLE__.check_type(v,:nominal)}
|
77
|
+
|
50
78
|
|
51
79
|
end
|
52
80
|
|
metadata
CHANGED
@@ -1,137 +1,134 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: statsample-optimization
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 2
|
8
|
-
- 1
|
9
|
-
- 0
|
10
|
-
version: 2.1.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.1.1
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Claudio Bustos
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
|
-
cert_chain:
|
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
|
-
|
11
|
+
cert_chain:
|
12
|
+
- !binary |-
|
13
|
+
LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURNakNDQWhxZ0F3SUJB
|
14
|
+
Z0lCQURBTkJna3Foa2lHOXcwQkFRVUZBREEvTVJFd0R3WURWUVFEREFoamJH
|
15
|
+
SjEKYzNSdmN6RVZNQk1HQ2dtU0pvbVQ4aXhrQVJrV0JXZHRZV2xzTVJNd0VR
|
16
|
+
WUtDWkltaVpQeUxHUUJHUllEWTI5dApNQjRYRFRFd01ETXlPVEl4TXpnMU5W
|
17
|
+
b1hEVEV4TURNeU9USXhNemcxTlZvd1B6RVJNQThHQTFVRUF3d0lZMnhpCmRY
|
18
|
+
TjBiM014RlRBVEJnb0praWFKay9Jc1pBRVpGZ1ZuYldGcGJERVRNQkVHQ2dt
|
19
|
+
U0pvbVQ4aXhrQVJrV0EyTn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BdmI4TUd6U1ZnazJp
|
35
|
+
MDZPSlRxa0JUd3Z2CkpISmRveXczKzhidzlSSitqTGFOb1EreHUrMXBRZFMy
|
36
|
+
YmIzbTd4alpwdWZtbC9tOHpGQ3RqWU0vN3Fna0tSOHoKL1padDhsQ2lLZkZB
|
37
|
+
cnBwUnJaYXlFMkZWc3BzNFg2V3dCZHJLVE1aMENLU1hUUmN0YkVqMUJBWjY3
|
38
|
+
ZW9UdkJCdApycFAwampzMAotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
|
39
|
+
date: 2011-12-28 00:00:00.000000000 Z
|
40
|
+
dependencies:
|
41
|
+
- !ruby/object:Gem::Dependency
|
43
42
|
name: statsample
|
44
|
-
|
45
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
43
|
+
requirement: &23461100 !ruby/object:Gem::Requirement
|
46
44
|
none: false
|
47
|
-
requirements:
|
45
|
+
requirements:
|
48
46
|
- - ~>
|
49
|
-
- !ruby/object:Gem::Version
|
50
|
-
|
51
|
-
segments:
|
52
|
-
- 0
|
53
|
-
- 17
|
54
|
-
version: "0.17"
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '1.2'
|
55
49
|
type: :runtime
|
56
|
-
version_requirements: *id001
|
57
|
-
- !ruby/object:Gem::Dependency
|
58
|
-
name: statistics2
|
59
50
|
prerelease: false
|
60
|
-
|
51
|
+
version_requirements: *23461100
|
52
|
+
- !ruby/object:Gem::Dependency
|
53
|
+
name: statistics2
|
54
|
+
requirement: &23460640 !ruby/object:Gem::Requirement
|
61
55
|
none: false
|
62
|
-
requirements:
|
56
|
+
requirements:
|
63
57
|
- - ~>
|
64
|
-
- !ruby/object:Gem::Version
|
65
|
-
|
66
|
-
segments:
|
67
|
-
- 0
|
68
|
-
- 54
|
69
|
-
version: "0.54"
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0.54'
|
70
60
|
type: :runtime
|
71
|
-
version_requirements: *id002
|
72
|
-
- !ruby/object:Gem::Dependency
|
73
|
-
name: gsl
|
74
61
|
prerelease: false
|
75
|
-
|
62
|
+
version_requirements: *23460640
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: gsl
|
65
|
+
requirement: &23460140 !ruby/object:Gem::Requirement
|
76
66
|
none: false
|
77
|
-
requirements:
|
67
|
+
requirements:
|
78
68
|
- - ~>
|
79
|
-
- !ruby/object:Gem::Version
|
80
|
-
|
81
|
-
segments:
|
82
|
-
- 1
|
83
|
-
- 14
|
84
|
-
version: "1.14"
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '1.14'
|
85
71
|
type: :runtime
|
86
|
-
version_requirements: *id003
|
87
|
-
- !ruby/object:Gem::Dependency
|
88
|
-
name: rake-compiler
|
89
72
|
prerelease: false
|
90
|
-
|
73
|
+
version_requirements: *23460140
|
74
|
+
- !ruby/object:Gem::Dependency
|
75
|
+
name: rake-compiler
|
76
|
+
requirement: &23459740 !ruby/object:Gem::Requirement
|
91
77
|
none: false
|
92
|
-
requirements:
|
93
|
-
- -
|
94
|
-
- !ruby/object:Gem::Version
|
95
|
-
|
96
|
-
segments:
|
97
|
-
- 0
|
98
|
-
version: "0"
|
78
|
+
requirements:
|
79
|
+
- - ! '>='
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
99
82
|
type: :runtime
|
100
|
-
version_requirements: *id004
|
101
|
-
- !ruby/object:Gem::Dependency
|
102
|
-
name: hoe
|
103
83
|
prerelease: false
|
104
|
-
|
84
|
+
version_requirements: *23459740
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
name: rdoc
|
87
|
+
requirement: &23459240 !ruby/object:Gem::Requirement
|
105
88
|
none: false
|
106
|
-
requirements:
|
107
|
-
- -
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
|
110
|
-
segments:
|
111
|
-
- 2
|
112
|
-
- 8
|
113
|
-
- 0
|
114
|
-
version: 2.8.0
|
89
|
+
requirements:
|
90
|
+
- - ~>
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '3.10'
|
115
93
|
type: :development
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
94
|
+
prerelease: false
|
95
|
+
version_requirements: *23459240
|
96
|
+
- !ruby/object:Gem::Dependency
|
97
|
+
name: hoe
|
98
|
+
requirement: &23458660 !ruby/object:Gem::Requirement
|
99
|
+
none: false
|
100
|
+
requirements:
|
101
|
+
- - ~>
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '2.12'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: *23458660
|
107
|
+
description: ! 'Install gsl, statistics2 and provides a C extension to optimize the
|
108
|
+
following methods
|
109
|
+
|
110
|
+
|
120
111
|
* Vector#frecuencies
|
112
|
+
|
121
113
|
* Vector#set_valid_data
|
114
|
+
|
115
|
+
* Vector#check_type
|
116
|
+
|
122
117
|
* Dataset#case_as_hash
|
118
|
+
|
123
119
|
* Dataset#case_as_array
|
124
|
-
|
120
|
+
|
121
|
+
* Bivariate::Tetrachoric'
|
122
|
+
email:
|
125
123
|
- clbustos_at_gmail.com
|
126
124
|
executables: []
|
127
|
-
|
128
|
-
extensions:
|
125
|
+
extensions:
|
129
126
|
- ext/statsamplert/extconf.rb
|
130
|
-
extra_rdoc_files:
|
127
|
+
extra_rdoc_files:
|
131
128
|
- History.txt
|
132
129
|
- Manifest.txt
|
133
130
|
- README.txt
|
134
|
-
files:
|
131
|
+
files:
|
135
132
|
- History.txt
|
136
133
|
- Manifest.txt
|
137
134
|
- README.txt
|
@@ -140,41 +137,36 @@ files:
|
|
140
137
|
- ext/statsamplert/as116.h
|
141
138
|
- ext/statsamplert/extconf.rb
|
142
139
|
- ext/statsamplert/statsamplert.c
|
140
|
+
- ext/statsamplert/statsamplert.h
|
143
141
|
- test/test_statsample_optimization.rb
|
144
|
-
|
142
|
+
- .gemtest
|
145
143
|
homepage: http://rubyforge.org/projects/ruby-statsample/
|
146
144
|
licenses: []
|
147
|
-
|
148
145
|
post_install_message:
|
149
|
-
rdoc_options:
|
146
|
+
rdoc_options:
|
150
147
|
- --main
|
151
148
|
- README.txt
|
152
|
-
require_paths:
|
149
|
+
require_paths:
|
153
150
|
- lib
|
154
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
151
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
155
152
|
none: false
|
156
|
-
requirements:
|
157
|
-
- -
|
158
|
-
- !ruby/object:Gem::Version
|
159
|
-
|
160
|
-
|
161
|
-
- 0
|
162
|
-
version: "0"
|
163
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
153
|
+
requirements:
|
154
|
+
- - ! '>='
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
version: '0'
|
157
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
164
158
|
none: false
|
165
|
-
requirements:
|
166
|
-
- -
|
167
|
-
- !ruby/object:Gem::Version
|
168
|
-
|
169
|
-
segments:
|
170
|
-
- 0
|
171
|
-
version: "0"
|
159
|
+
requirements:
|
160
|
+
- - ! '>='
|
161
|
+
- !ruby/object:Gem::Version
|
162
|
+
version: '0'
|
172
163
|
requirements: []
|
173
|
-
|
174
164
|
rubyforge_project: ruby-statsample
|
175
|
-
rubygems_version: 1.
|
165
|
+
rubygems_version: 1.8.10
|
176
166
|
signing_key:
|
177
167
|
specification_version: 3
|
178
|
-
summary: Install gsl, statistics2 and provides a C extension to optimize the following
|
179
|
-
|
168
|
+
summary: Install gsl, statistics2 and provides a C extension to optimize the following
|
169
|
+
methods * Vector#frecuencies * Vector#set_valid_data * Vector#check_type * Dataset#case_as_hash
|
170
|
+
* Dataset#case_as_array * Bivariate::Tetrachoric
|
171
|
+
test_files:
|
180
172
|
- test/test_statsample_optimization.rb
|
metadata.gz.sig
CHANGED
Binary file
|