ruby-mpfr 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest.txt CHANGED
@@ -24,6 +24,7 @@ ext/mpfr_matrix/mpfr/ruby_mpfr_matrix.c
24
24
  ext/mpfr_matrix/mpfr/ruby_mpfr_matrix.h
25
25
  lib/mpfr/gmp.rb
26
26
  lib/mpfr/matrix.rb
27
+ lib/mpfr/rspec.rb
27
28
  lib/mpfr/version.rb
28
29
  ruby-mpfr.gemspec
29
30
  script/console
data/lib/mpfr/rspec.rb ADDED
@@ -0,0 +1,35 @@
1
+ class MPFR
2
+ @@error = MPFR('1e-12')
3
+
4
+ def self.set_error_of_test(err)
5
+ @error = err
6
+ end
7
+
8
+ def self.get_error_of_test
9
+ @error
10
+ end
11
+
12
+ def check_error(other, error = nil)
13
+ (self - other).abs < (error || @@error)
14
+ end
15
+
16
+ class Matrix
17
+ def check_error(other, error = nil)
18
+ err = error || @error
19
+ column_size.times.all? do |i|
20
+ row_siize.times.all? do |j|
21
+ self[i][j].check_error(other[i][j], err)
22
+ end
23
+ end
24
+ end
25
+ end
26
+
27
+ module Vector
28
+ def check_error(other, error = nil)
29
+ err = error || @error
30
+ size.times.all? do |i|
31
+ self[i].check_error(other[i], err)
32
+ end
33
+ end
34
+ end
35
+ end
data/lib/mpfr/version.rb CHANGED
@@ -1 +1 @@
1
- RUBY_MPFR_VERSION = '0.0.11'
1
+ RUBY_MPFR_VERSION = '0.0.12'
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: ruby-mpfr
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.11
5
+ version: 0.0.12
6
6
  platform: ruby
7
7
  authors:
8
8
  - Takayuki YAMAGUCHI
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-02-26 00:00:00 +09:00
13
+ date: 2011-02-27 00:00:00 +09:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -73,6 +73,7 @@ files:
73
73
  - ext/mpfr_matrix/mpfr/ruby_mpfr_matrix.h
74
74
  - lib/mpfr/gmp.rb
75
75
  - lib/mpfr/matrix.rb
76
+ - lib/mpfr/rspec.rb
76
77
  - lib/mpfr/version.rb
77
78
  - ruby-mpfr.gemspec
78
79
  - script/console