congruence_solver 0.3.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d41325020ecfa40cc46d234828df89bc2fb40f49
4
- data.tar.gz: acde70a6f821e7ec7952ab6db97a7c0fe4d61484
3
+ metadata.gz: a5434d225bea224333675e4eba2a96f3642fa326
4
+ data.tar.gz: 14f70c00d5674fc1e260add8e9b5787463c29550
5
5
  SHA512:
6
- metadata.gz: fd914b02d0bb19bec1f30558d3fde308225eafbebc11029d0d2fe0ef6f1c91f31cfb03896596cdbd8da194a176bb5cad7bcf5cf339f21fed0ba1377afaeeff62
7
- data.tar.gz: af76d6607a3acf0c327c1d60e9daf7fbbca921bc1877dde9803928d49a4131bd62975766ac8f7a2f3452153da5a6be4b8c6549de4a55c4292c3edcf0aaac5422
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
- $LOAD_PATH << "#{Dir.pwd}/lib/"
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
- $LOAD_PATH << "#{Dir.pwd}/lib/"
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
- files_to_rm = `find ext/congruence_solver/* -not -path "*.[ch]" -not -path *Makefile -not -path *extconf.rb`.split("\n")
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 => [:clean, :update_ext, :build] do
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.exe arith_utils_test.exe congruences_test.exe
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
- int tot = coeffs[degree];
105
+ long tot = coeffs[degree];
106
106
  int i;
107
107
 
108
108
  for(i = degree - 1; i >= 0; i--){
109
- tot = mod_product(tot, x, mod);
110
- tot = mod_sum(tot, coeffs[i], mod);
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
+ */
@@ -1,3 +1,3 @@
1
1
  module CongruenceSolver
2
- VERSION = "0.3.2"
2
+ VERSION = "0.4.0"
3
3
  end
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.3.2
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-24 00:00:00.000000000 Z
11
+ date: 2017-02-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler