congruence_solver 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 +4 -4
- data/Rakefile +8 -11
- data/ext/congruence_solver/Makefile +3 -2
- data/ext/congruence_solver/arith_utils.c +5 -5
- data/lib/congruence_solver/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5434d225bea224333675e4eba2a96f3642fa326
|
4
|
+
data.tar.gz: 14f70c00d5674fc1e260add8e9b5787463c29550
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c3bf873aa8549385ded3cd7e9504cd36d4613b0645db636c4cda567af541dffdcfa33df756ef86a68723890fe05f0a2ea93fcdd5b5074e4d6289b9da92bb87b
|
7
|
+
data.tar.gz: bba1bc6e5ea41eb4220511d746e04cd995d094c086cd2594d10b82b399f0e8f1a6cc2a30a14d9efff6a27935e4ed173d45ffb9642bf3c031ba0c5fc524a2c61d
|
data/Rakefile
CHANGED
@@ -20,8 +20,7 @@ end
|
|
20
20
|
|
21
21
|
# runs the csolve binary
|
22
22
|
task :exe do
|
23
|
-
|
24
|
-
require_relative "bin/csolve.rb"
|
23
|
+
system "bin/csolve"
|
25
24
|
end
|
26
25
|
|
27
26
|
#spec runs all RSpec examples
|
@@ -42,13 +41,7 @@ end
|
|
42
41
|
|
43
42
|
# runs benchmarks
|
44
43
|
task :bench do
|
45
|
-
|
46
|
-
Dir.foreach("bench") do |bm_file|
|
47
|
-
path = "bench/#{bm_file}"
|
48
|
-
if File.file? path and path =~ "_bm.rb^"
|
49
|
-
require_relative path
|
50
|
-
end
|
51
|
-
end
|
44
|
+
system "csolve bench"
|
52
45
|
end
|
53
46
|
|
54
47
|
# download source files for the extension
|
@@ -78,7 +71,11 @@ task :update_ext => [:purge_ext, :download_ext, :compile_ext]
|
|
78
71
|
|
79
72
|
# remove files generated or left behind by build
|
80
73
|
task :clean do
|
81
|
-
|
74
|
+
ext_compiled_files = `find ext/congruence_solver/* -not -path "*.[ch]" -not -path *Makefile -not -path *extconf.rb`.split("\n")
|
75
|
+
files_to_rm = ext_compiled_files + %w[
|
76
|
+
*.gem
|
77
|
+
lib/congruence_solver/congruence_solver.*
|
78
|
+
]
|
82
79
|
verbose_rm_files files_to_rm
|
83
80
|
end
|
84
81
|
|
@@ -100,7 +97,7 @@ task :install => [:clean, :update_ext, :test, :build] do
|
|
100
97
|
end
|
101
98
|
end
|
102
99
|
|
103
|
-
task :publish
|
100
|
+
task :publish do
|
104
101
|
cmd = "gem push *.gem"
|
105
102
|
p cmd
|
106
103
|
system cmd
|
@@ -14,5 +14,6 @@ test: prime_gen_test arith_utils_test congruences_test
|
|
14
14
|
./congruences_test
|
15
15
|
|
16
16
|
clean:
|
17
|
-
rm -f prime_gen_test
|
18
|
-
|
17
|
+
rm -f prime_gen_test arith_utils_test congruences_test
|
18
|
+
rm -rf prime_gen_test.dSYM arith_utils_test.dSYM congruences_test.dSYM
|
19
|
+
|
@@ -102,15 +102,15 @@ int totient(int n){
|
|
102
102
|
|
103
103
|
|
104
104
|
int mod_eval_polynomial(int degree, int coeffs[], int mod, int x){
|
105
|
-
|
105
|
+
long tot = coeffs[degree];
|
106
106
|
int i;
|
107
107
|
|
108
108
|
for(i = degree - 1; i >= 0; i--){
|
109
|
-
tot =
|
110
|
-
tot =
|
109
|
+
tot = (x*tot) % mod;
|
110
|
+
tot = (tot + coeffs[i]) % mod;
|
111
111
|
}
|
112
112
|
|
113
|
-
return tot;
|
113
|
+
return (int) tot;
|
114
114
|
}
|
115
115
|
|
116
116
|
|
@@ -133,4 +133,4 @@ long eval_polynomial(int degree, int coeffs[], int x){
|
|
133
133
|
int * linear_diophantine_solution(int order, int coeffs[], int scal){
|
134
134
|
|
135
135
|
*=}
|
136
|
-
*/
|
136
|
+
*/
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: congruence_solver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- lane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|