gsl 1.16.0.6 → 2.1.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 +4 -4
- data/.travis.yml +5 -13
- data/ChangeLog +6 -0
- data/Gemfile +1 -0
- data/README.md +77 -1
- data/Rakefile +7 -1
- data/examples/linalg/QR_solve_narray.rb +2 -1
- data/examples/linalg/SV_narray.rb +10 -0
- data/examples/linalg/chol_narray.rb +3 -0
- data/examples/wavelet/wavelet1.rb +4 -2
- data/ext/gsl_native/array.c +10 -0
- data/ext/gsl_native/bspline.c +15 -2
- data/ext/gsl_native/cheb.c +76 -10
- data/ext/gsl_native/common.c +33 -0
- data/ext/gsl_native/dht.c +26 -0
- data/ext/gsl_native/eigen.c +129 -0
- data/ext/gsl_native/extconf.rb +60 -6
- data/ext/gsl_native/fft.c +42 -0
- data/ext/gsl_native/function.c +18 -0
- data/ext/gsl_native/gsl.c +5 -0
- data/ext/gsl_native/gsl_nmatrix.c +204 -0
- data/ext/gsl_native/histogram.c +42 -0
- data/ext/gsl_native/include/rb_gsl.h +4 -0
- data/ext/gsl_native/include/rb_gsl_array.h +4 -0
- data/ext/gsl_native/include/rb_gsl_common.h +5 -0
- data/ext/gsl_native/include/rb_gsl_interp.h +4 -0
- data/ext/gsl_native/include/rb_gsl_with_nmatrix.h +28 -0
- data/ext/gsl_native/interp.c +14 -0
- data/ext/gsl_native/linalg.c +414 -22
- data/ext/gsl_native/math.c +64 -0
- data/ext/gsl_native/multifit.c +61 -0
- data/ext/gsl_native/randist.c +42 -0
- data/ext/gsl_native/sf.c +6 -0
- data/ext/gsl_native/sf_ellint.c +4 -4
- data/ext/gsl_native/sf_mathieu.c +48 -0
- data/ext/gsl_native/spline.c +30 -0
- data/ext/gsl_native/tamu_anova.c +1 -1
- data/gsl.gemspec +8 -1
- data/lib/gsl.rb +5 -0
- data/lib/gsl/version.rb +1 -1
- data/rdoc/nmatrix.rdoc +129 -0
- data/rdoc/ref.rdoc +1 -0
- data/test.sh +21 -0
- data/test/gsl/bspline_test.rb +15 -14
- data/test/gsl/combination_test.rb +17 -6
- data/test/gsl/dht_test.rb +42 -33
- data/test/gsl/nmatrix_tests/nmatrix_cheb_test.rb +34 -0
- data/test/gsl/nmatrix_tests/nmatrix_eigen_test.rb +28 -0
- data/test/gsl/nmatrix_tests/nmatrix_gsl_test.rb +65 -0
- data/test/gsl/nmatrix_tests/nmatrix_interp_test.rb +45 -0
- data/test/gsl/nmatrix_tests/nmatrix_linalg_test.rb +100 -0
- data/test/gsl/nmatrix_tests/nmatrix_stats_test.rb +88 -0
- data/test/gsl/nmatrix_tests/nmatrix_wavelet_test.rb +5 -0
- data/test/gsl/randist_test.rb +43 -23
- data/test/test_helper.rb +30 -2
- metadata +191 -51
data/ext/gsl_native/tamu_anova.c
CHANGED
@@ -32,7 +32,7 @@ VALUE rb_tamu_anova_alloc(int argc, VALUE *argv, VALUE klass)
|
|
32
32
|
VALUE rb_tamu_anova_printtable(VALUE *vTable)
|
33
33
|
{
|
34
34
|
struct tamu_anova_table *table;
|
35
|
-
Data_Get_Struct(vTable, struct tamu_anova_table, table);
|
35
|
+
Data_Get_Struct(*vTable, struct tamu_anova_table, table);
|
36
36
|
tamu_anova_printtable(*table);
|
37
37
|
return Qtrue;
|
38
38
|
}
|
data/gsl.gemspec
CHANGED
@@ -21,9 +21,16 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.required_ruby_version = '>= 1.9.3'
|
22
22
|
s.requirements = ['GSL (http://www.gnu.org/software/gsl/)']
|
23
23
|
|
24
|
-
s.post_install_message =
|
24
|
+
s.post_install_message = %{
|
25
|
+
#{s.name} can be installed with or without narray support. Please install
|
26
|
+
narray before and reinstall #{s.name} if it is missing.
|
27
|
+
|
28
|
+
#{s.name} is also now compatible with NMatrix. Please install nmatrix before
|
29
|
+
installing #{s.name}.
|
30
|
+
}
|
25
31
|
|
26
32
|
s.add_development_dependency 'rake-compiler', '>= 0'
|
27
33
|
s.add_development_dependency 'rake', '>= 0'
|
28
34
|
s.add_development_dependency 'test-unit', '>= 0'
|
35
|
+
s.add_development_dependency 'bundler', '~> 1.11'
|
29
36
|
end
|
data/lib/gsl.rb
CHANGED
data/lib/gsl/version.rb
CHANGED
data/rdoc/nmatrix.rdoc
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
#
|
2
|
+
# = NMatrix compatibilities
|
3
|
+
# === Contents:
|
4
|
+
# 1. {Data type conversions}[link:rdoc/nmatrix_rdoc.html#label-Data+type+conversions]
|
5
|
+
# 1. {Methods which accepts NArray}[link:rdoc/narray_rdoc.html#label-Methods+which+accepts+NArray]
|
6
|
+
#
|
7
|
+
# == Data type conversions
|
8
|
+
# === GSL to NMatrix
|
9
|
+
#
|
10
|
+
# ---
|
11
|
+
# * GSL::Vector#to_nm
|
12
|
+
# * GSL::Vector::Complex#to_nm
|
13
|
+
# * GSL::Vector::Int#to_nm
|
14
|
+
# * GSL::Matrix#to_nm
|
15
|
+
# * GSL::Matrix::Complex#to_nm
|
16
|
+
# * GSL::Matrix::Int#to_nm
|
17
|
+
#
|
18
|
+
# Convert GSL objects to NMatrix. The data contained by the GSL objects
|
19
|
+
# are copied to a newly allocated memory block of the NMatrix objects created.
|
20
|
+
#
|
21
|
+
# === NMatrix to GSL
|
22
|
+
# ---
|
23
|
+
# * NMatrix#to_gslv
|
24
|
+
# * NMatrix#to_gslm
|
25
|
+
#
|
26
|
+
# <tt>NMatrix#to_gslv</tt> converts NMatrix objects to <tt>GSL::Vector</tt>,
|
27
|
+
# <tt>GSL::Vector::Complex</tt> or <tt>GSL::Vector::Int</tt>.
|
28
|
+
# <tt>NMatrix#to_gslm</tt> converts NMatrix objects to <tt>GSL::Matrix</tt>,
|
29
|
+
# <tt>GSL::Matrix::Int</tt> or <tt>GSL::Matrix::Complex</tt>.
|
30
|
+
#
|
31
|
+
# The data contained by the NMatrix objects are copied to a newly allocated
|
32
|
+
# memory block of the GSL objects created.
|
33
|
+
#
|
34
|
+
# == Methods which accepts NMatrix
|
35
|
+
# === <tt>GSL</tt> module
|
36
|
+
# ---
|
37
|
+
# * GSL::graph()
|
38
|
+
# * GSL::log1p(x)
|
39
|
+
# * GSL::expm1(x)
|
40
|
+
# * GSL::hypot(x, y)
|
41
|
+
# * GSL::acosh(x)
|
42
|
+
# * GSL::asinh(x)
|
43
|
+
# * GSL::atanh(x)
|
44
|
+
# * GSL::pow(x, a)
|
45
|
+
# * GSL::pow_int(x, n)
|
46
|
+
# * GSL::pow_2(x), ..., GSL::pow_9(x)
|
47
|
+
#
|
48
|
+
#
|
49
|
+
# === <tt>Sf</tt> module
|
50
|
+
# ---
|
51
|
+
# * {Any}[link:rdoc/sf_rdoc.html]
|
52
|
+
#
|
53
|
+
# === <tt>Linalg</tt> module
|
54
|
+
# ---
|
55
|
+
# * GSL::Linalg::LU.decomp(na)
|
56
|
+
# * GSL::Linalg::LU.solve(lu, b)
|
57
|
+
# * GSL::Linalg::LU.svx(lu, bx)
|
58
|
+
# * GSL::Linalg::LU.det(lu, sign)
|
59
|
+
# * GSL::Linalg::LU.invert(lu, perm)
|
60
|
+
# * GSL::Linalg::QR.decomp(m)
|
61
|
+
# * GSL::Linalg::QR.solve(qr, tau, b)
|
62
|
+
# * GSL::Linalg::QR.svx(qr, tau, bx)
|
63
|
+
# * GSL::Linalg::SV.decomp(m)
|
64
|
+
# * GSL::Linalg::SV.solve(u, v, s, b)
|
65
|
+
# * GSL::Linalg::SV.svx(u, v, s, bx)
|
66
|
+
# * GSL::Linalg::Cholesky.decomp(m)
|
67
|
+
# * GSL::Linalg::Cholesky.solve(u, v, s, b)
|
68
|
+
# * GSL::Linalg::Cholesky.svx(u, v, s, bx)
|
69
|
+
# * GSL::Linalg::HH.solve(m, b)
|
70
|
+
# * GSL::Linalg::HH.svx(m, bx)
|
71
|
+
#
|
72
|
+
#
|
73
|
+
# === <tt>Eigen</tt> module
|
74
|
+
# ---
|
75
|
+
# * GSL::Eigen::symm(na)
|
76
|
+
# * GSL::Eigen::symmv(na)
|
77
|
+
#
|
78
|
+
#
|
79
|
+
# === <tt>FFT</tt> module
|
80
|
+
# ---
|
81
|
+
# * {Many}[link:rdoc/fft_rdoc.html]
|
82
|
+
#
|
83
|
+
# === <tt>Function</tt> class
|
84
|
+
# ---
|
85
|
+
# * GSL::Function#eval
|
86
|
+
# * GSL::Function#deriv_central(x, h)
|
87
|
+
# * GSL::Function#deriv_forward(x, h)
|
88
|
+
# * GSL::Function#deriv_backward(x, h)
|
89
|
+
# * GSL::Function#diff_central(x, h)
|
90
|
+
# * GSL::Function#diff_forward(x, h)
|
91
|
+
# * GSL::Function#diff_backward(x, h)
|
92
|
+
#
|
93
|
+
#
|
94
|
+
# === <tt>Ran</tt> and <tt>Cdf</tt> module
|
95
|
+
# ---
|
96
|
+
# * {Many}[link:rdoc/randist_rdoc.html]
|
97
|
+
#
|
98
|
+
# === <tt>Stats</tt> module
|
99
|
+
# ---
|
100
|
+
# * {Any}[link:rdoc/stats_rdoc.html]
|
101
|
+
#
|
102
|
+
# === <tt>Interp</tt> and <tt>Spline</tt> class
|
103
|
+
# ---
|
104
|
+
# * GSL::Interp#init
|
105
|
+
# * GSL::Interp#eval
|
106
|
+
# * GSL::Spline#init
|
107
|
+
# * GSL::Spline#eval
|
108
|
+
#
|
109
|
+
#
|
110
|
+
# === <tt>Deriv</tt> and <tt>Diff</tt> module
|
111
|
+
# ---
|
112
|
+
# TODO
|
113
|
+
#
|
114
|
+
#
|
115
|
+
# === <tt>Cheb</tt> class
|
116
|
+
# ---
|
117
|
+
# * GSL::Cheb#eval(x)
|
118
|
+
# * GSL::Cheb#eval_n(n, x)
|
119
|
+
#
|
120
|
+
#
|
121
|
+
# === <tt>Wavelet</tt> class
|
122
|
+
# ---
|
123
|
+
# TODO
|
124
|
+
#
|
125
|
+
# {prev}[link:rdoc/tensor_rdoc.html]
|
126
|
+
#
|
127
|
+
# {Reference index}[link:rdoc/ref_rdoc.html]
|
128
|
+
# {top}[link:index.html]
|
129
|
+
#
|
data/rdoc/ref.rdoc
CHANGED
@@ -84,6 +84,7 @@
|
|
84
84
|
# 1. {NDLINEAR: multi-linear, multi-parameter least squares fitting}[link:rdoc/ndlinear_rdoc.html]
|
85
85
|
# 1. {ALF: associated Legendre polynomials}[link:rdoc/alf_rdoc.html]
|
86
86
|
# 1. {NArray compatibilities}[link:rdoc/narray_rdoc.html]
|
87
|
+
# 1. {NMatrix compatibilities}[link:rdoc/nmatrix_rdoc.html]
|
87
88
|
# 1. {Changes since Ruby/GSL 1.10.3}[link:rdoc/changes_rdoc.html]
|
88
89
|
# 1. {GNU Free Documentation Licence}[https://gnu.org/software/gsl/manual/html_node/GNU-Free-Documentation-License.html]
|
89
90
|
#
|
data/test.sh
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
function compile_and_test {
|
3
|
+
bundle install
|
4
|
+
rake clobber
|
5
|
+
rake compile --silent --quiet
|
6
|
+
rake test
|
7
|
+
}
|
8
|
+
echo "Testing without NMATRIX or NARRAY...\n\n"
|
9
|
+
unset NMATRIX
|
10
|
+
unset NARRAY
|
11
|
+
compile_and_test
|
12
|
+
|
13
|
+
echo "Testing with NMATRIX=1...\n\n"
|
14
|
+
export NMATRIX=1
|
15
|
+
compile_and_test
|
16
|
+
unset NMATRIX
|
17
|
+
|
18
|
+
echo "Testing with NARRAY=1...\n\n"
|
19
|
+
export NARRAY=1
|
20
|
+
compile_and_test
|
21
|
+
unset NARRAY
|
data/test/gsl/bspline_test.rb
CHANGED
@@ -42,22 +42,23 @@ class BsplineTest < GSL::TestCase
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def test_bspline_knots
|
45
|
-
1.upto(NMAX)
|
46
|
-
2.upto(BMAX)
|
45
|
+
1.upto(NMAX) do |order|
|
46
|
+
2.upto(BMAX) do |breakpoints|
|
47
47
|
a, b = -1.23 * order, 45.6 * order
|
48
48
|
|
49
49
|
bw = GSL::BSpline.alloc(order, breakpoints)
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
50
|
+
test_data = [GSL::Vector.alloc(breakpoints)]
|
51
|
+
test_data << NMatrix.new([breakpoints], dtype: :float64) if ENV['NMATRIX']
|
52
|
+
test_data.each do |k|
|
53
|
+
breakpoints.times do |i|
|
54
|
+
f = GSL.sqrt(i.to_f / (breakpoints - 1.0))
|
55
|
+
k[i] = (1 - f) * a + f * b
|
56
|
+
end
|
57
|
+
|
58
|
+
bw.knots(k)
|
59
|
+
_test_bspline(bw)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
61
63
|
end
|
62
|
-
|
63
64
|
end
|
@@ -4,14 +4,25 @@ class CombinationTest < GSL::TestCase
|
|
4
4
|
|
5
5
|
def setup
|
6
6
|
@c63 = GSL::Matrix.alloc(
|
7
|
-
[0, 1, 2],
|
8
|
-
[0,
|
9
|
-
[0,
|
7
|
+
[0, 1, 2],
|
8
|
+
[0, 1, 3],
|
9
|
+
[0, 1, 4],
|
10
|
+
[0, 1, 5],
|
11
|
+
[0, 2, 3],
|
12
|
+
[0, 2, 4],
|
13
|
+
[0, 2, 5],
|
14
|
+
[0, 3, 4],
|
15
|
+
[0, 3, 5],
|
10
16
|
[0, 4, 5],
|
11
|
-
[1, 2, 3],
|
12
|
-
[1,
|
17
|
+
[1, 2, 3],
|
18
|
+
[1, 2, 4],
|
19
|
+
[1, 2, 5],
|
20
|
+
[1, 3, 4],
|
21
|
+
[1, 3, 5],
|
13
22
|
[1, 4, 5],
|
14
|
-
[2, 3, 4],
|
23
|
+
[2, 3, 4],
|
24
|
+
[2, 3, 5],
|
25
|
+
[2, 4, 5],
|
15
26
|
[3, 4, 5]
|
16
27
|
)
|
17
28
|
end
|
data/test/gsl/dht_test.rb
CHANGED
@@ -4,26 +4,38 @@ class DhtTest < GSL::TestCase
|
|
4
4
|
|
5
5
|
N = 128
|
6
6
|
|
7
|
+
def test_dht
|
8
|
+
test_data = [GSL::Vector.alloc(N)]
|
9
|
+
test_data << NMatrix.new([N], dtype: :float64) if ENV['NMATRIX']
|
10
|
+
test_data.each do |vin|
|
11
|
+
dht2 vin
|
12
|
+
dht3 vin
|
13
|
+
dht4 vin
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
7
17
|
def test_dht1
|
8
|
-
|
9
|
-
|
18
|
+
test_data = [GSL::Vector.alloc(1, 2, 3)]
|
19
|
+
test_data << NMatrix.new([3], [1,2,3], dtype: :float64) if ENV['NMATRIX']
|
20
|
+
test_data.each do |vin|
|
21
|
+
dht = GSL::Dht.alloc(3, 1.0, 1.0)
|
10
22
|
|
11
|
-
|
23
|
+
vout = dht.apply(vin)
|
12
24
|
|
13
|
-
|
14
|
-
|
15
|
-
|
25
|
+
assert_in_delta 0.3752546494075203, vout[0], 0.001
|
26
|
+
assert_in_delta(-0.13350787269556064, vout[1], 0.001)
|
27
|
+
assert_in_delta 0.0446799251438404, vout[2], 0.001
|
16
28
|
|
17
|
-
|
18
|
-
|
29
|
+
vin2 = dht.apply(vout)
|
30
|
+
vin2 = vin2 * (13.323691936314223 ** 2)
|
19
31
|
|
20
|
-
|
21
|
-
|
22
|
-
|
32
|
+
assert_in_delta 1.0000119186762644, vin2[0], 0.001
|
33
|
+
assert_in_delta 1.9999790476647084, vin2[1], 0.001
|
34
|
+
assert_in_delta 3.000035803234503, vin2[2], 0.001
|
35
|
+
end
|
23
36
|
end
|
24
37
|
|
25
|
-
def
|
26
|
-
vin = GSL::Vector.alloc(N)
|
38
|
+
def dht2 vin
|
27
39
|
dht = GSL::Dht.alloc(N, 0.0, 100.0)
|
28
40
|
|
29
41
|
N.times { |i|
|
@@ -33,15 +45,14 @@ class DhtTest < GSL::TestCase
|
|
33
45
|
|
34
46
|
vout = dht.apply(vin)
|
35
47
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
48
|
+
assert_in_delta 3.999613382195876, vout[0], 0.001
|
49
|
+
assert_in_delta 1.8387637474026606, vout[5], 0.001
|
50
|
+
assert_in_delta 1.2677885358829588, vout[10], 0.001
|
51
|
+
assert_in_delta 0.3521910403797792, vout[35], 0.001
|
52
|
+
assert_in_delta 0.02373661279695407, vout[100], 0.001
|
41
53
|
end
|
42
54
|
|
43
|
-
def
|
44
|
-
vin = GSL::Vector.alloc(N)
|
55
|
+
def dht3 vin
|
45
56
|
dht = GSL::Dht.alloc(N, 1.0, 20.0)
|
46
57
|
|
47
58
|
N.times { |i|
|
@@ -51,15 +62,14 @@ class DhtTest < GSL::TestCase
|
|
51
62
|
|
52
63
|
vout = dht.apply(vin)
|
53
64
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
65
|
+
assert_in_delta 0.18148296716239096, vout[0], 0.001
|
66
|
+
assert_in_delta 0.35680451269699853, vout[5], 0.001
|
67
|
+
assert_in_delta 0.21101009980456306, vout[10], 0.001
|
68
|
+
assert_in_delta 0.02892068100516861, vout[35], 0.001
|
69
|
+
assert_in_delta 0.0022121119664674426, vout[100], 0.001
|
59
70
|
end
|
60
71
|
|
61
|
-
def
|
62
|
-
vin = GSL::Vector.alloc(N)
|
72
|
+
def dht4 vin
|
63
73
|
dht = GSL::Dht.alloc(N, 1.0, 1.0)
|
64
74
|
|
65
75
|
N.times { |i|
|
@@ -69,11 +79,10 @@ class DhtTest < GSL::TestCase
|
|
69
79
|
|
70
80
|
vout = dht.apply(vin)
|
71
81
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
82
|
+
assert_in_delta 0.05727421417071144, vout[0], 0.001
|
83
|
+
assert_in_delta -0.0001908501261051786, vout[5], 0.001
|
84
|
+
assert_in_delta 2.434180086051901e-05, vout[10], 0.001
|
85
|
+
assert_in_delta -4.0392713194195724e-07, vout[35], 0.001
|
86
|
+
assert_in_delta 8.255662619348403e-09, vout[100], 0.001
|
77
87
|
end
|
78
|
-
|
79
88
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require_relative '../../test_helper'
|
2
|
+
|
3
|
+
class NMatrixChebTest < GSL::TestCase
|
4
|
+
def test_eval
|
5
|
+
f = GSL::Function.alloc do |x|
|
6
|
+
if x < 0.5
|
7
|
+
0.25
|
8
|
+
else
|
9
|
+
0.75
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
n = 1000
|
14
|
+
order = 40
|
15
|
+
cs = GSL::Cheb.alloc(order)
|
16
|
+
x = NMatrix.new([n], GSL::Vector.linspace(0, 1, n).to_a, dtype: :float64)
|
17
|
+
|
18
|
+
ff = f.eval(x)
|
19
|
+
|
20
|
+
assert ff.class == NMatrix
|
21
|
+
|
22
|
+
cs.init(f, 0, 1)
|
23
|
+
r10 = cs.eval_n(10, x)
|
24
|
+
r40 = cs.eval(x)
|
25
|
+
|
26
|
+
assert r10.class == NMatrix
|
27
|
+
assert_rel r10.to_a.last, 0.758879, 0.001, 'test r10.last'
|
28
|
+
assert_rel r10[5] , 0.247816, 0.001, 'test r10[5]'
|
29
|
+
|
30
|
+
assert r40.class == NMatrix
|
31
|
+
assert_rel r40[5] , 0.255682, 0.001, 'test r40[5]'
|
32
|
+
assert_rel r40.first, 0.25633 , 0.001, 'test r40.first'
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class NMatrixEigenTest < GSL::TestCase
|
4
|
+
def setup
|
5
|
+
@nmatrix = NMatrix.new([4,4],
|
6
|
+
[1.0, 1/2.0, 1/3.0, 1/4.0,
|
7
|
+
1/2.0, 1/3.0, 1/4.0, 1/5.0,
|
8
|
+
1/3.0, 1/4.0, 1/5.0, 1/6.0,
|
9
|
+
1/4.0, 1/5.0, 1/6.0, 1/7.0], dtype: :float64)
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_symm_symmv
|
13
|
+
eigen_values = NMatrix.new([4],
|
14
|
+
[1.50021, 0.169141, 0.00673827, 9.67023e-05], dtype: :float64)
|
15
|
+
eigen_vectors = NMatrix.new([4,4],
|
16
|
+
[0.792608, 0.582076,-0.179186,-0.0291933,
|
17
|
+
0.451923,-0.370502, 0.741918, 0.328712 ,
|
18
|
+
0.322416,-0.509579,-0.100228,-0.791411 ,
|
19
|
+
0.252161,-0.514048,-0.638283, 0.514553], dtype: :float64)
|
20
|
+
|
21
|
+
assert_enum_abs GSL::Eigen.symm(@nmatrix), eigen_values, 0.001, "GSL::Eigen.symm(nmatrix)"
|
22
|
+
|
23
|
+
# val, vec = GSL::Eigen.symmv(@nmatrix)
|
24
|
+
|
25
|
+
# assert_enum_abs val, eigen_values , 0.001, "GSL::Eigen.symmv(nmatrix)"
|
26
|
+
# assert_enum_abs vec, eigen_vectors, 0.001, "GSL::Eigen.symmv(nmatrix)"
|
27
|
+
end
|
28
|
+
end
|