ruby-mpfi 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/Manifest.txt +62 -0
- data/PostInstall.txt +7 -0
- data/README.rdoc +48 -0
- data/Rakefile +26 -0
- data/ext/mpfi/extconf.rb +10 -0
- data/ext/mpfi/func_mpfi_extention.c +52 -0
- data/ext/mpfi/func_mpfi_extention.h +2 -0
- data/ext/mpfi/make_c_source.rb +115 -0
- data/ext/mpfi/ruby_mpfi.c +1452 -0
- data/ext/mpfi/ruby_mpfi.h +39 -0
- data/ext/mpfi/ruby_mpfr.h +38 -0
- data/ext/mpfi/yasnippet_mpfi.el +44 -0
- data/ext/mpfi_complex/mpfi/extconf.rb +10 -0
- data/ext/mpfi_complex/mpfi/func_mpfi_extention.h +2 -0
- data/ext/mpfi_complex/mpfi/func_ruby_mpfi_complex.c +130 -0
- data/ext/mpfi_complex/mpfi/func_ruby_mpfi_complex.h +35 -0
- data/ext/mpfi_complex/mpfi/ruby_mpfi.h +39 -0
- data/ext/mpfi_complex/mpfi/ruby_mpfi_complex.c +217 -0
- data/ext/mpfi_complex/mpfi/ruby_mpfi_complex.h +15 -0
- data/ext/mpfi_complex/mpfi/ruby_mpfr.h +38 -0
- data/ext/mpfi_matrix/mpfi/extconf.rb +9 -0
- data/ext/mpfi_matrix/mpfi/func_mpfi_extention.h +2 -0
- data/ext/mpfi_matrix/mpfi/func_mpfi_matrix.c +795 -0
- data/ext/mpfi_matrix/mpfi/func_mpfi_matrix.h +103 -0
- data/ext/mpfi_matrix/mpfi/func_mpfr_matrix.h +72 -0
- data/ext/mpfi_matrix/mpfi/func_ruby_mpfi_complex.h +35 -0
- data/ext/mpfi_matrix/mpfi/ruby_mpfi.h +39 -0
- data/ext/mpfi_matrix/mpfi/ruby_mpfi_complex.h +15 -0
- data/ext/mpfi_matrix/mpfi/ruby_mpfi_matrix.c +1200 -0
- data/ext/mpfi_matrix/mpfi/ruby_mpfi_matrix.h +13 -0
- data/ext/mpfi_matrix/mpfi/ruby_mpfr.h +38 -0
- data/ext/mpfi_matrix/mpfi/ruby_mpfr_matrix.h +13 -0
- data/lib/mpfi/matrix.rb +188 -0
- data/lib/mpfi/version.rb +3 -0
- data/ruby-mpfi.gemspec +35 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/spec/mpfi/generate_number_module.rb +48 -0
- data/spec/mpfi/mpfi_alloc_spec.rb +55 -0
- data/spec/mpfi/mpfi_diam_arithmetic_spec.rb +25 -0
- data/spec/mpfi/mpfi_interval_arithmetic_spec.rb +105 -0
- data/spec/mpfi/mpfi_interval_functions_spec.rb +95 -0
- data/spec/mpfi/mpfi_math_functions_spec.rb +16 -0
- data/spec/mpfi/mpfi_set_operation_spec.rb +102 -0
- data/spec/mpfi/ruby-mpfi_spec.rb +11 -0
- data/spec/mpfi/spec_helper.rb +10 -0
- data/spec/mpfi_complex/spec_helper.rb +10 -0
- data/spec/mpfi_matrix/generate_matrix_arguments.rb +65 -0
- data/spec/mpfi_matrix/mpfi_matrix_alloc_spec.rb +134 -0
- data/spec/mpfi_matrix/mpfi_matrix_arithmetic_spec.rb +156 -0
- data/spec/mpfi_matrix/mpfi_matrix_interval_func_spec.rb +30 -0
- data/spec/mpfi_matrix/mpfi_matrix_set_element_spec.rb +55 -0
- data/spec/mpfi_matrix/mpfi_matrix_set_operation_spec.rb +71 -0
- data/spec/mpfi_matrix/mpfi_matrix_string_spec.rb +32 -0
- data/spec/mpfi_matrix/mpfi_matrix_subdivision_spec.rb +14 -0
- data/spec/mpfi_matrix/mpfi_square_matrix_spec.rb +37 -0
- data/spec/mpfi_matrix/mpfi_vector_spec.rb +15 -0
- data/spec/mpfi_matrix/spec_helper.rb +19 -0
- data/spec/spec.opts +1 -0
- data/tasks/extconf.rake +36 -0
- metadata +132 -0
@@ -0,0 +1,37 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper.rb'
|
2
|
+
|
3
|
+
describe MPFI::SquareMatrix, "when calculating LU decomposition" do
|
4
|
+
before(:all) do
|
5
|
+
MPFR.set_default_prec(128)
|
6
|
+
@dim = 7
|
7
|
+
@mat = GenerateNumber.float_matrix_arguments(100, @dim, @dim).map{ |a| MPFI::SquareMatrix.new(a) }
|
8
|
+
@mat_fr = @mat.map { |a| a.mid_interval }
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should include lu decomposition of MPFR::SquareMatrix" do
|
12
|
+
@mat.each_with_index do |m, i|
|
13
|
+
l, u, indx = m.lu_decomp
|
14
|
+
l_fr, u_fr, indx_fr = @mat_fr[i].lu_decomp
|
15
|
+
l.include?(l_fr).should be_true
|
16
|
+
u.include?(u_fr).should be_true
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
describe MPFI::SquareMatrix, "when calculating determinant" do
|
22
|
+
before(:all) do
|
23
|
+
MPFR.set_default_prec(512)
|
24
|
+
@error = MPFR.new('1e-30')
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should include value of determinant of MPFR::SquareMatrix" do
|
28
|
+
(2..6).each do |dim|
|
29
|
+
GenerateNumber.float_matrix_arguments(100, dim, dim).each do |src|
|
30
|
+
m = MPFI::SquareMatrix.new(src)
|
31
|
+
m_fr = MPFR::SquareMatrix.new(src)
|
32
|
+
m.determinant.include?(m_fr.determinant).should be_true
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper.rb'
|
2
|
+
|
3
|
+
describe MPFI::ColumnVector, "when dividing to some parts" do
|
4
|
+
before(:all) do
|
5
|
+
MPFR.set_default_prec(128)
|
6
|
+
@vec = MPFI::ColumnVector.new([MPFI.interval(1, 3), MPFI.interval(-5, -4), MPFI.interval(2, 5)])
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should return divided boxes." do
|
10
|
+
size = MPFR.new('0.5')
|
11
|
+
ary = @vec.subdivision_by_size(size)
|
12
|
+
ary.size.should == 48
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
begin
|
2
|
+
require 'spec'
|
3
|
+
rescue LoadError
|
4
|
+
require 'rubygems' unless ENV['NO_RUBYGEMS']
|
5
|
+
gem 'rspec'
|
6
|
+
require 'spec'
|
7
|
+
end
|
8
|
+
|
9
|
+
$:.unshift(File.dirname(__FILE__) + '/../../lib')
|
10
|
+
$:.unshift(*Dir.glob(File.dirname(__FILE__) + '/../../ext/*'))
|
11
|
+
$:.unshift(File.dirname(__FILE__))
|
12
|
+
|
13
|
+
require 'mpfr'
|
14
|
+
require 'mpfr/matrix'
|
15
|
+
require 'mpfi'
|
16
|
+
require 'mpfi/complex'
|
17
|
+
require 'mpfi/matrix'
|
18
|
+
require "generate_matrix_arguments"
|
19
|
+
|
data/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
data/tasks/extconf.rake
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
begin
|
2
|
+
require 'spec'
|
3
|
+
rescue LoadError
|
4
|
+
require 'rubygems' unless ENV['NO_RUBYGEMS']
|
5
|
+
require 'spec'
|
6
|
+
end
|
7
|
+
begin
|
8
|
+
require 'spec/rake/spectask'
|
9
|
+
rescue LoadError
|
10
|
+
puts <<-EOS
|
11
|
+
To use rspec for testing you must install rspec gem:
|
12
|
+
gem install rspec
|
13
|
+
EOS
|
14
|
+
exit(0)
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "Run 'make realclean' for extended libraries"
|
18
|
+
task "ext:realclean" do
|
19
|
+
Dir.glob("ext/**/Makefile").each do |path|
|
20
|
+
system("cd #{File.dirname(path)}; make realclean")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
desc "Run 'make clean' for extended libraries"
|
25
|
+
task "ext:clean" do
|
26
|
+
Dir.glob("ext/**/Makefile").each do |path|
|
27
|
+
system("cd #{File.dirname(path)}; make clean")
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
desc "Run 'make realclean' for extended libraries"
|
32
|
+
task 'ext:make' do
|
33
|
+
Dir.glob("ext/**/extconf.rb").each do |path|
|
34
|
+
system("cd #{File.dirname(path)}; ruby extconf.rb && make")
|
35
|
+
end
|
36
|
+
end
|
metadata
ADDED
@@ -0,0 +1,132 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ruby-mpfi
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Takayuki YAMAGUCHI
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-12-17 00:00:00 +09:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: hoe
|
17
|
+
type: :development
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 2.4.0
|
24
|
+
version:
|
25
|
+
description: FIX (describe your package)
|
26
|
+
email:
|
27
|
+
- d@ytak.info
|
28
|
+
executables: []
|
29
|
+
|
30
|
+
extensions:
|
31
|
+
- ext/mpfi/extconf.rb
|
32
|
+
- ext/mpfi_complex/mpfi/extconf.rb
|
33
|
+
- ext/mpfi_matrix/mpfi/extconf.rb
|
34
|
+
extra_rdoc_files:
|
35
|
+
- History.txt
|
36
|
+
- Manifest.txt
|
37
|
+
- PostInstall.txt
|
38
|
+
files:
|
39
|
+
- History.txt
|
40
|
+
- Manifest.txt
|
41
|
+
- PostInstall.txt
|
42
|
+
- README.rdoc
|
43
|
+
- Rakefile
|
44
|
+
- ext/mpfi/extconf.rb
|
45
|
+
- ext/mpfi/func_mpfi_extention.c
|
46
|
+
- ext/mpfi/func_mpfi_extention.h
|
47
|
+
- ext/mpfi/make_c_source.rb
|
48
|
+
- ext/mpfi/ruby_mpfi.c
|
49
|
+
- ext/mpfi/ruby_mpfi.h
|
50
|
+
- ext/mpfi/ruby_mpfr.h
|
51
|
+
- ext/mpfi/yasnippet_mpfi.el
|
52
|
+
- ext/mpfi_complex/mpfi/extconf.rb
|
53
|
+
- ext/mpfi_complex/mpfi/func_mpfi_extention.h
|
54
|
+
- ext/mpfi_complex/mpfi/func_ruby_mpfi_complex.c
|
55
|
+
- ext/mpfi_complex/mpfi/func_ruby_mpfi_complex.h
|
56
|
+
- ext/mpfi_complex/mpfi/ruby_mpfi.h
|
57
|
+
- ext/mpfi_complex/mpfi/ruby_mpfi_complex.c
|
58
|
+
- ext/mpfi_complex/mpfi/ruby_mpfi_complex.h
|
59
|
+
- ext/mpfi_complex/mpfi/ruby_mpfr.h
|
60
|
+
- ext/mpfi_matrix/mpfi/extconf.rb
|
61
|
+
- ext/mpfi_matrix/mpfi/func_mpfi_extention.h
|
62
|
+
- ext/mpfi_matrix/mpfi/func_mpfi_matrix.c
|
63
|
+
- ext/mpfi_matrix/mpfi/func_mpfi_matrix.h
|
64
|
+
- ext/mpfi_matrix/mpfi/func_mpfr_matrix.h
|
65
|
+
- ext/mpfi_matrix/mpfi/func_ruby_mpfi_complex.h
|
66
|
+
- ext/mpfi_matrix/mpfi/ruby_mpfi.h
|
67
|
+
- ext/mpfi_matrix/mpfi/ruby_mpfi_complex.h
|
68
|
+
- ext/mpfi_matrix/mpfi/ruby_mpfi_matrix.c
|
69
|
+
- ext/mpfi_matrix/mpfi/ruby_mpfi_matrix.h
|
70
|
+
- ext/mpfi_matrix/mpfi/ruby_mpfr.h
|
71
|
+
- ext/mpfi_matrix/mpfi/ruby_mpfr_matrix.h
|
72
|
+
- lib/mpfi/matrix.rb
|
73
|
+
- lib/mpfi/version.rb
|
74
|
+
- ruby-mpfi.gemspec
|
75
|
+
- script/console
|
76
|
+
- script/destroy
|
77
|
+
- script/generate
|
78
|
+
- spec/mpfi/generate_number_module.rb
|
79
|
+
- spec/mpfi/mpfi_alloc_spec.rb
|
80
|
+
- spec/mpfi/mpfi_diam_arithmetic_spec.rb
|
81
|
+
- spec/mpfi/mpfi_interval_arithmetic_spec.rb
|
82
|
+
- spec/mpfi/mpfi_interval_functions_spec.rb
|
83
|
+
- spec/mpfi/mpfi_math_functions_spec.rb
|
84
|
+
- spec/mpfi/mpfi_set_operation_spec.rb
|
85
|
+
- spec/mpfi/ruby-mpfi_spec.rb
|
86
|
+
- spec/mpfi/spec_helper.rb
|
87
|
+
- spec/mpfi_complex/spec_helper.rb
|
88
|
+
- spec/mpfi_matrix/generate_matrix_arguments.rb
|
89
|
+
- spec/mpfi_matrix/mpfi_matrix_alloc_spec.rb
|
90
|
+
- spec/mpfi_matrix/mpfi_matrix_arithmetic_spec.rb
|
91
|
+
- spec/mpfi_matrix/mpfi_matrix_interval_func_spec.rb
|
92
|
+
- spec/mpfi_matrix/mpfi_matrix_set_element_spec.rb
|
93
|
+
- spec/mpfi_matrix/mpfi_matrix_set_operation_spec.rb
|
94
|
+
- spec/mpfi_matrix/mpfi_matrix_string_spec.rb
|
95
|
+
- spec/mpfi_matrix/mpfi_matrix_subdivision_spec.rb
|
96
|
+
- spec/mpfi_matrix/mpfi_square_matrix_spec.rb
|
97
|
+
- spec/mpfi_matrix/mpfi_vector_spec.rb
|
98
|
+
- spec/mpfi_matrix/spec_helper.rb
|
99
|
+
- spec/spec.opts
|
100
|
+
- tasks/extconf.rake
|
101
|
+
has_rdoc: true
|
102
|
+
homepage: http://github.com/#{github_username}/#{project_name}
|
103
|
+
licenses: []
|
104
|
+
|
105
|
+
post_install_message: PostInstall.txt
|
106
|
+
rdoc_options:
|
107
|
+
- --main
|
108
|
+
- README.rdoc
|
109
|
+
require_paths:
|
110
|
+
- lib
|
111
|
+
- ext
|
112
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: "0"
|
117
|
+
version:
|
118
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - ">="
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: "0"
|
123
|
+
version:
|
124
|
+
requirements: []
|
125
|
+
|
126
|
+
rubyforge_project: ruby-mpfi
|
127
|
+
rubygems_version: 1.3.5
|
128
|
+
signing_key:
|
129
|
+
specification_version: 3
|
130
|
+
summary: FIX (describe your package)
|
131
|
+
test_files: []
|
132
|
+
|