ruby-lapack 1.4 → 1.4.1a
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.
- data/README.rdoc +13 -1
- data/Rakefile +47 -43
- data/dev/defs/cggbal +2 -1
- data/dev/defs/sggbal +2 -1
- data/dev/defs/zggbal +2 -1
- data/ext/extconf.rb +10 -68
- data/tests/lapack_test.rb +2 -2
- data/tests/lin/ge/test_gelss.rb +2 -2
- data/tests/lin/ge/test_gelsy.rb +2 -2
- metadata +13 -12
- data/tests/test_all.rb +0 -7
data/README.rdoc
CHANGED
@@ -1,13 +1,25 @@
|
|
1
1
|
= What's Ruby-LAPACK
|
2
2
|
|
3
3
|
Ruby-LAPACK is a Ruby wrapper of LAPACK.
|
4
|
-
|
4
|
+
|
5
|
+
= Requires
|
5
6
|
|
6
7
|
* Ruby (http://www.ruby-lang.org/)
|
7
8
|
* LAPACK (http://www.netlib.org/lapack/)
|
8
9
|
* NArray (http://narray.rubyforge.org/index.html.en)
|
9
10
|
|
10
11
|
|
12
|
+
= Install
|
13
|
+
|
14
|
+
== with gem
|
15
|
+
# gem install ruby-lapack
|
16
|
+
|
17
|
+
== build from source
|
18
|
+
% rake
|
19
|
+
% rake tests
|
20
|
+
% sudo rake install
|
21
|
+
|
22
|
+
|
11
23
|
= Usage
|
12
24
|
|
13
25
|
You need require numru/lapack to use Ruby-lapack
|
data/Rakefile
CHANGED
@@ -1,86 +1,89 @@
|
|
1
1
|
require "rubygems"
|
2
2
|
require "rake/clean"
|
3
3
|
require "rake/gempackagetask"
|
4
|
+
require "rake/testtask"
|
4
5
|
|
6
|
+
version = "1.4.1a"
|
5
7
|
target_prefix = "numru"
|
6
8
|
|
7
|
-
# get
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
end
|
13
|
-
|
14
|
-
# get sitelibdir
|
15
|
-
if i = ARGV.index{|arg| /\ASITELIBDIR=/ =~ arg}
|
16
|
-
libdir = ARGV[i].sub(/\ASITELIBDIR=/,"")
|
17
|
-
unless File.exist?(libdir) && File.directory?(libdir)
|
18
|
-
raise "SITELIBDIR is invalid: #{sitelibdir}"
|
19
|
-
end
|
20
|
-
else
|
21
|
-
libdir = Config::CONFIG["sitelibdir"]
|
22
|
-
end
|
23
|
-
# get sitearchdir
|
24
|
-
if i = ARGV.index{|arg| /\ASITEARCHDIR=/ =~ arg}
|
25
|
-
archdir = ARGV[i].sub(/\ASITEARCHLIBDIR=/,"")
|
26
|
-
unless File.exist?(archdir) && File.directory?(archdir)
|
27
|
-
raise "SITEARCHDIR is invalid: #{sitearchdir}"
|
28
|
-
end
|
29
|
-
else
|
30
|
-
archdir = Config::CONFIG["sitearchdir"]
|
31
|
-
end
|
32
|
-
|
33
|
-
|
9
|
+
# get options
|
10
|
+
destdir = ENV["DESTDIR"]
|
11
|
+
libdir = ENV["SITELIBDIR"] || Config::CONFIG["sitelibdir"]
|
12
|
+
archdir = ENV["SITEARCHDIR"] || Config::CONFIG["sitearchdir"]
|
13
|
+
config_opts = ENV["CONFIG_OPTIONS"]
|
34
14
|
|
35
15
|
NAME = "lapack"
|
36
16
|
LIBS = FileList["lib/#{target_prefix}/*rb"]
|
37
17
|
DLLIB = "ext/#{NAME}.so"
|
18
|
+
so_file = File.join("lib", target_prefix, "#{NAME}.so")
|
38
19
|
|
39
20
|
|
40
|
-
task :default =>
|
21
|
+
task :default => so_file
|
41
22
|
|
42
|
-
desc "
|
23
|
+
desc "Building extensions"
|
24
|
+
file so_file => DLLIB do
|
25
|
+
mkdir_p File.dirname(so_file)
|
26
|
+
rm_f so_file
|
27
|
+
cp DLLIB, so_file
|
28
|
+
end
|
43
29
|
file DLLIB => "ext/Makefile" do
|
44
30
|
system("cd ext; make")
|
45
31
|
end
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
32
|
+
file "ext/Makefile" => "ext/rb_lapack.h" do
|
33
|
+
unless system("cd ext; ruby extconf.rb #{config_opts}")
|
34
|
+
warn <<-EOL
|
35
|
+
|
36
|
+
To give options to extconf.rb, set the options to CONFIG_OPTIONS
|
37
|
+
e.g.
|
38
|
+
% rake CONFIG_OPTIONS="--with-lapack=/opt/lapack"
|
39
|
+
EOL
|
40
|
+
end
|
50
41
|
end
|
51
|
-
file "ext/
|
52
|
-
system("
|
42
|
+
file "ext/rb_lapack.h" => "dev/make_csrc.rb" do
|
43
|
+
system("ruby dev/make_csrc.rb")
|
53
44
|
end
|
54
45
|
|
55
|
-
desc "
|
46
|
+
desc "Install files to system"
|
56
47
|
task :install => [:install_so, :install_rb]
|
57
48
|
|
58
49
|
task :install_so => DLLIB do
|
59
|
-
|
50
|
+
dst = File.join(destdir, archdir, target_prefix)
|
51
|
+
mkdir_p dst
|
52
|
+
install DLLIB, dst, :mode => 0755
|
60
53
|
end
|
61
54
|
|
62
55
|
task :install_rb => LIBS do
|
63
|
-
|
64
|
-
|
56
|
+
dst = File.join(destdir, libdir, target_prefix)
|
57
|
+
mkdir_p dst
|
58
|
+
LIBS.each do |lib|
|
59
|
+
install lib, dst, :mode => 644
|
65
60
|
end
|
66
61
|
end
|
67
62
|
|
68
|
-
|
69
63
|
CLEAN.include("ext/*.o")
|
70
|
-
CLOBBER.include(
|
64
|
+
CLOBBER.include(DLLIB, so_file)
|
65
|
+
CLOBBER.include("ext/Makefile")
|
71
66
|
|
72
67
|
|
73
68
|
PKG_FILES = FileList["lib/#{target_prefix}/*rb"]
|
74
|
-
PKG_FILES.include("ext
|
69
|
+
PKG_FILES.include("ext/rb_lapack.h")
|
70
|
+
PKG_FILES.include("ext/f2c_minimal.h")
|
71
|
+
PKG_FILES.include("ext/*.c")
|
75
72
|
PKG_FILES.include("Rakefile")
|
76
73
|
PKG_FILES.include("COPYING", "GPL", "README.rdoc")
|
77
74
|
PKG_FILES.include("doc/*.html", "samples/**/*rb")
|
78
75
|
PKG_FILES.include("dev/*.rb", "dev/defs/*")
|
79
76
|
TEST_FILES = FileList["tests/**/*.rb"]
|
80
77
|
|
78
|
+
Rake::TestTask.new do |t|
|
79
|
+
t.libs << "lib"
|
80
|
+
t.libs << "tests"
|
81
|
+
t.test_files = TEST_FILES
|
82
|
+
end
|
83
|
+
|
81
84
|
spec = Gem::Specification.new do |s|
|
82
85
|
s.name = "ruby-lapack"
|
83
|
-
s.version =
|
86
|
+
s.version = version
|
84
87
|
s.summary = "A Ruby wrapper of Lapack"
|
85
88
|
s.description = <<EOL
|
86
89
|
Ruby-LAPACK is a Ruby wrapper of Lapack, which is a linear algebra package (http://www.netlib.org/lapack/).
|
@@ -110,6 +113,7 @@ task :binary_package => binary_pkg
|
|
110
113
|
file binary_pkg => so_file do
|
111
114
|
files = PKG_FILES.dup
|
112
115
|
files.include so_file
|
116
|
+
files.exclude "ext"
|
113
117
|
spec.platform = Gem::Platform::CURRENT
|
114
118
|
spec.files = files
|
115
119
|
spec.extensions = []
|
data/dev/defs/cggbal
CHANGED
@@ -46,7 +46,8 @@
|
|
46
46
|
- work:
|
47
47
|
:type: real
|
48
48
|
:intent: workspace
|
49
|
-
:dims:
|
49
|
+
:dims:
|
50
|
+
- "(lsame_(&job,\"S\")||lsame_(&job,\"B\")) ? MAX(1,6*n) : (lsame_(&job,\"N\")||lsame_(&job,\"P\")) ? 1 : 0"
|
50
51
|
- info:
|
51
52
|
:type: integer
|
52
53
|
:intent: output
|
data/dev/defs/sggbal
CHANGED
@@ -46,7 +46,8 @@
|
|
46
46
|
- work:
|
47
47
|
:type: real
|
48
48
|
:intent: workspace
|
49
|
-
:dims:
|
49
|
+
:dims:
|
50
|
+
- "(lsame_(&job,\"S\")||lsame_(&job,\"B\")) ? MAX(1,6*n) : (lsame_(&job,\"N\")||lsame_(&job,\"P\")) ? 1 : 0"
|
50
51
|
- info:
|
51
52
|
:type: integer
|
52
53
|
:intent: output
|
data/dev/defs/zggbal
CHANGED
@@ -46,7 +46,8 @@
|
|
46
46
|
- work:
|
47
47
|
:type: doublereal
|
48
48
|
:intent: workspace
|
49
|
-
:dims:
|
49
|
+
:dims:
|
50
|
+
- "(lsame_(&job,\"S\")||lsame_(&job,\"B\")) ? MAX(1,6*n) : (lsame_(&job,\"N\")||lsame_(&job,\"P\")) ? 1 : 0"
|
50
51
|
- info:
|
51
52
|
:type: integer
|
52
53
|
:intent: output
|
data/ext/extconf.rb
CHANGED
@@ -31,73 +31,10 @@ EOF
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
-
def try_func(func, libs, headers = nil, &b)
|
35
|
-
headers = cpp_include(headers)
|
36
|
-
try_link(<<"SRC", libs, &b) or try_link(<<"SRC", libs, &b)
|
37
|
-
#{COMMON_HEADERS}
|
38
|
-
#{headers}
|
39
|
-
/*top*/
|
40
|
-
int main() { return 0; }
|
41
|
-
int MAIN__() { return main(); }
|
42
|
-
int t() { void ((*volatile p)()); p = (void ((*)()))#{func}; return 0; }
|
43
|
-
SRC
|
44
|
-
#{headers}
|
45
|
-
/*top*/
|
46
|
-
int main() { return 0; }
|
47
|
-
int MAIN__() { return main(); }
|
48
|
-
int t() { #{func}(); return 0; }
|
49
|
-
SRC
|
50
|
-
end
|
51
|
-
|
52
|
-
|
53
|
-
def find_library(lib, func=nil, name=nil)
|
54
|
-
func = "main" if !func or func.empty?
|
55
|
-
ldir = with_config(lib+'-lib')
|
56
|
-
ldirs = ldir ? Array === ldir ? ldir : ldir.split(File::PATH_SEPARATOR) : []
|
57
|
-
$LIBPATH = ldirs | $LIBPATH
|
58
|
-
if /\.(a|so)$/ =~ name
|
59
|
-
libs = $libs
|
60
|
-
$LIBPATH.each{|path|
|
61
|
-
f = File.join(path,name)
|
62
|
-
if File.exist?(f)
|
63
|
-
libs = f + " " + $libs
|
64
|
-
break
|
65
|
-
end
|
66
|
-
}
|
67
|
-
else
|
68
|
-
name = LIBARG%lib
|
69
|
-
libs = append_library($libs, lib)
|
70
|
-
end
|
71
|
-
paths = {}
|
72
|
-
checking_for "#{func}() in #{name}" do
|
73
|
-
libpath = $LIBPATH
|
74
|
-
begin
|
75
|
-
until r = try_func(func, libs) or paths.empty?
|
76
|
-
$LIBPATH = libpath | [paths.shift]
|
77
|
-
end
|
78
|
-
if r
|
79
|
-
$libs = libs
|
80
|
-
libpath = nil
|
81
|
-
end
|
82
|
-
ensure
|
83
|
-
$LIBPATH = libpath if libpath
|
84
|
-
end
|
85
|
-
r
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
|
90
|
-
unless File.exist?("rb_lapack.c")
|
91
|
-
print "making c source files\n"
|
92
|
-
cmd = File.join( File.dirname(__FILE__), "..", "dev", "make_csrc.rb")
|
93
|
-
unless system("ruby #{cmd} > /dev/null")
|
94
|
-
raise "error occure in making c source files"
|
95
|
-
end
|
96
|
-
end
|
97
34
|
|
98
35
|
|
99
36
|
dir_config("lapack")
|
100
|
-
unless find_library("lapack")
|
37
|
+
unless find_library("lapack", nil)
|
101
38
|
library_not_found("lapack",nil)
|
102
39
|
|
103
40
|
warn "LAPACK will be tried to find"
|
@@ -126,11 +63,16 @@ end
|
|
126
63
|
|
127
64
|
sitearchdir = Config::CONFIG["sitearchdir"]
|
128
65
|
dir_config("narray", sitearchdir, sitearchdir)
|
129
|
-
|
130
|
-
|
66
|
+
gem_path = nil
|
67
|
+
begin
|
68
|
+
require "rubygems"
|
69
|
+
if (spec = Gem.source_index.find_name("narray")).any?
|
70
|
+
gem_path = spec.last.full_gem_path
|
71
|
+
end
|
72
|
+
rescue LoadError
|
131
73
|
end
|
132
|
-
unless
|
133
|
-
|
74
|
+
unless find_header("narray.h",gem_path) && have_header("narray_config.h")
|
75
|
+
header_not_found("narray")
|
134
76
|
end
|
135
77
|
|
136
78
|
create_makefile("numru/lapack")
|
data/tests/lapack_test.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
$:.unshift(File.dirname(__FILE__), "..", "lib")
|
1
|
+
$:.unshift(File.join(File.dirname(__FILE__), "..", "lib"))
|
2
2
|
require "test/unit"
|
3
3
|
require "numru/lapack"
|
4
4
|
|
@@ -10,7 +10,7 @@ module LapackTest
|
|
10
10
|
unless delta
|
11
11
|
case actual.typecode
|
12
12
|
when NArray::SFLOAT, NArray::SCOMPLEX
|
13
|
-
delta =
|
13
|
+
delta = 5.0e-5
|
14
14
|
when NArray::DFLOAT, NArray::DCOMPLEX
|
15
15
|
delta = 1.0e-13
|
16
16
|
when NArray::INT, NArray::LINT
|
data/tests/lin/ge/test_gelss.rb
CHANGED
@@ -44,7 +44,7 @@ class GelssTest < Test::Unit::TestCase
|
|
44
44
|
assert_equal 0, info
|
45
45
|
assert_narray @b_exp[rc], b, 1e-4
|
46
46
|
assert_narray @s_exp[rc], s, 1e-4
|
47
|
-
|
47
|
+
assert_equal @rank_exp[rc], rank
|
48
48
|
end
|
49
49
|
|
50
50
|
define_method("test_#{method}_inquiring_lwork") do
|
@@ -56,7 +56,7 @@ class GelssTest < Test::Unit::TestCase
|
|
56
56
|
assert_equal lwork, get_int(work[0])
|
57
57
|
assert_narray @b_exp[rc], b, 1e-4
|
58
58
|
assert_narray @s_exp[rc], s, 1e-4
|
59
|
-
|
59
|
+
assert_equal @rank_exp[rc], rank
|
60
60
|
end
|
61
61
|
|
62
62
|
define_method("test_#{method}_inquiring_lwork_oldargstyle") do
|
data/tests/lin/ge/test_gelsy.rb
CHANGED
@@ -45,7 +45,7 @@ class GelsyTest < Test::Unit::TestCase
|
|
45
45
|
rank, work, info, a, b, jpvt = NumRu::Lapack.send(method, @a[rc], @b[rc], @jpvt[rc], @rcond)
|
46
46
|
assert_equal 0, info
|
47
47
|
assert_narray @b_exp[rc], b, 1e-4
|
48
|
-
|
48
|
+
assert_equal @rank_exp[rc], rank
|
49
49
|
end
|
50
50
|
|
51
51
|
define_method("test_#{method}_inquiring_lwork") do
|
@@ -56,7 +56,7 @@ class GelsyTest < Test::Unit::TestCase
|
|
56
56
|
assert_equal 0, info
|
57
57
|
assert_equal lwork, get_int(work[0])
|
58
58
|
assert_narray @b_exp[rc], b, 1e-4
|
59
|
-
|
59
|
+
assert_equal @rank_exp[rc], rank
|
60
60
|
end
|
61
61
|
|
62
62
|
define_method("test_#{method}_inquiring_lwork_oldargstyle") do
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-lapack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 3314901
|
5
|
+
prerelease: true
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 4
|
9
|
-
|
9
|
+
- 1a
|
10
|
+
version: 1.4.1a
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Seiya Nishizawa
|
@@ -14,7 +15,7 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2011-04-
|
18
|
+
date: 2011-04-22 00:00:00 +09:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
@@ -43,6 +44,8 @@ extra_rdoc_files: []
|
|
43
44
|
|
44
45
|
files:
|
45
46
|
- lib/numru/lapack.rb
|
47
|
+
- ext/rb_lapack.h
|
48
|
+
- ext/f2c_minimal.h
|
46
49
|
- ext/sstemr.c
|
47
50
|
- ext/ilaenv.c
|
48
51
|
- ext/slaqp2.c
|
@@ -1674,8 +1677,6 @@ files:
|
|
1674
1677
|
- ext/dgeqr2.c
|
1675
1678
|
- ext/zpotrs.c
|
1676
1679
|
- ext/cunglq.c
|
1677
|
-
- ext/f2c_minimal.h
|
1678
|
-
- ext/rb_lapack.h
|
1679
1680
|
- Rakefile
|
1680
1681
|
- COPYING
|
1681
1682
|
- GPL
|
@@ -3449,7 +3450,6 @@ files:
|
|
3449
3450
|
- tests/eig/sb/test_sbev.rb
|
3450
3451
|
- tests/eig/gg/test_ggev.rb
|
3451
3452
|
- tests/eig/gg/test_ggsvd.rb
|
3452
|
-
- tests/test_all.rb
|
3453
3453
|
- tests/lin/ge/test_gelsy.rb
|
3454
3454
|
- tests/lin/ge/test_gesv.rb
|
3455
3455
|
- tests/lin/ge/test_gelss.rb
|
@@ -3481,12 +3481,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
3481
3481
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
3482
3482
|
none: false
|
3483
3483
|
requirements:
|
3484
|
-
- - "
|
3484
|
+
- - ">"
|
3485
3485
|
- !ruby/object:Gem::Version
|
3486
|
-
hash:
|
3486
|
+
hash: 25
|
3487
3487
|
segments:
|
3488
|
-
-
|
3489
|
-
|
3488
|
+
- 1
|
3489
|
+
- 3
|
3490
|
+
- 1
|
3491
|
+
version: 1.3.1
|
3490
3492
|
requirements: []
|
3491
3493
|
|
3492
3494
|
rubyforge_project:
|
@@ -3501,7 +3503,6 @@ test_files:
|
|
3501
3503
|
- tests/eig/sb/test_sbev.rb
|
3502
3504
|
- tests/eig/gg/test_ggev.rb
|
3503
3505
|
- tests/eig/gg/test_ggsvd.rb
|
3504
|
-
- tests/test_all.rb
|
3505
3506
|
- tests/lin/ge/test_gelsy.rb
|
3506
3507
|
- tests/lin/ge/test_gesv.rb
|
3507
3508
|
- tests/lin/ge/test_gelss.rb
|