rb-gsl 1.16.0.2 → 1.16.0.3.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +5 -0
- data/README +2 -2
- data/Rakefile +2 -3
- data/lib/gsl/version.rb +1 -1
- data/rdoc/alf.rdoc +5 -5
- data/rdoc/blas.rdoc +8 -8
- data/rdoc/bspline.rdoc +16 -16
- data/rdoc/changes.rdoc +4 -9
- data/rdoc/cheb.rdoc +24 -24
- data/rdoc/cholesky_complex.rdoc +21 -21
- data/rdoc/combi.rdoc +36 -36
- data/rdoc/complex.rdoc +21 -21
- data/rdoc/const.rdoc +46 -46
- data/rdoc/dht.rdoc +48 -48
- data/rdoc/diff.rdoc +41 -41
- data/rdoc/ehandling.rdoc +5 -5
- data/rdoc/eigen.rdoc +152 -152
- data/rdoc/fft.rdoc +145 -145
- data/rdoc/fit.rdoc +108 -108
- data/rdoc/function.rdoc +10 -10
- data/rdoc/graph.rdoc +16 -16
- data/rdoc/hist.rdoc +102 -102
- data/rdoc/hist2d.rdoc +41 -41
- data/rdoc/hist3d.rdoc +8 -8
- data/rdoc/index.rdoc +18 -21
- data/rdoc/integration.rdoc +109 -109
- data/rdoc/interp.rdoc +70 -70
- data/rdoc/intro.rdoc +6 -6
- data/rdoc/linalg.rdoc +187 -187
- data/rdoc/linalg_complex.rdoc +1 -1
- data/rdoc/math.rdoc +57 -57
- data/rdoc/matrix.rdoc +272 -272
- data/rdoc/min.rdoc +56 -56
- data/rdoc/monte.rdoc +21 -21
- data/rdoc/multimin.rdoc +94 -94
- data/rdoc/multiroot.rdoc +79 -79
- data/rdoc/narray.rdoc +31 -31
- data/rdoc/ndlinear.rdoc +53 -53
- data/rdoc/nonlinearfit.rdoc +99 -99
- data/rdoc/ntuple.rdoc +30 -30
- data/rdoc/odeiv.rdoc +87 -87
- data/rdoc/perm.rdoc +89 -89
- data/rdoc/poly.rdoc +65 -65
- data/rdoc/qrng.rdoc +20 -20
- data/rdoc/randist.rdoc +81 -81
- data/rdoc/ref.rdoc +56 -56
- data/rdoc/rng.rdoc +84 -84
- data/rdoc/roots.rdoc +56 -56
- data/rdoc/sf.rdoc +427 -427
- data/rdoc/siman.rdoc +18 -18
- data/rdoc/sort.rdoc +29 -29
- data/rdoc/start.rdoc +8 -8
- data/rdoc/stats.rdoc +51 -51
- data/rdoc/sum.rdoc +11 -11
- data/rdoc/tensor.rdoc +30 -30
- data/rdoc/tut.rdoc +1 -1
- data/rdoc/use.rdoc +37 -37
- data/rdoc/vector.rdoc +187 -187
- data/rdoc/vector_complex.rdoc +23 -23
- data/rdoc/wavelet.rdoc +46 -46
- metadata +17 -20
- data/rdoc/rngextra.rdoc +0 -11
- data/rdoc/screenshot.rdoc +0 -40
data/rdoc/linalg_complex.rdoc
CHANGED
data/rdoc/math.rdoc
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
#
|
2
2
|
# = Mathematical Functions
|
3
3
|
# Contents:
|
4
|
-
# 1. {Mathematical Constants}[link:
|
5
|
-
# 1. {Infinities and Not-a-number}[link:
|
6
|
-
# 1. {Constants}[link:
|
7
|
-
# 1. {Module functions}[link:
|
8
|
-
# 1. {Elementary Functions}[link:
|
9
|
-
# 1. {Small Integer Powers}[link:
|
10
|
-
# 1. {Testing the Sign of Numbers}[link:
|
11
|
-
# 1. {Testing for Odd and Even Numbers}[link:
|
12
|
-
# 1. {Maximum and Minimum functions}[link:
|
13
|
-
# 1. {Approximate Comparison of Floating Point Numbers}[link:
|
14
|
-
#
|
15
|
-
# ==
|
4
|
+
# 1. {Mathematical Constants}[link:math_rdoc.html#label-Mathematical+Constants]
|
5
|
+
# 1. {Infinities and Not-a-number}[link:math_rdoc.html#label-Infinities+and+Not-a-number]
|
6
|
+
# 1. {Constants}[link:math_rdoc.html#label-Constants]
|
7
|
+
# 1. {Module functions}[link:math_rdoc.html#label-Module+functions]
|
8
|
+
# 1. {Elementary Functions}[link:math_rdoc.html#label-Elementary+Functions]
|
9
|
+
# 1. {Small Integer Powers}[link:math_rdoc.html#label-Small+Integer+Powers]
|
10
|
+
# 1. {Testing the Sign of Numbers}[link:math_rdoc.html#label-Testing+the+Sign+of+Numbers]
|
11
|
+
# 1. {Testing for Odd and Even Numbers}[link:math_rdoc.html#label-Testing+for+Odd+and+Even+Numbers]
|
12
|
+
# 1. {Maximum and Minimum functions}[link:math_rdoc.html#label-Maximum+and+Minimum+functions]
|
13
|
+
# 1. {Approximate Comparison of Floating Point Numbers}[link:math_rdoc.html#label-Approximate+Comparison+of+Floating+Point+Numbers]
|
14
|
+
#
|
15
|
+
# == Mathematical Constants
|
16
16
|
# ---
|
17
17
|
# * GSL::M_E
|
18
18
|
#
|
@@ -82,18 +82,18 @@
|
|
82
82
|
#
|
83
83
|
# Euler's constant
|
84
84
|
#
|
85
|
-
# ==
|
85
|
+
# == Infinities and Not-a-number
|
86
86
|
#
|
87
|
-
# ===
|
87
|
+
# === Constants
|
88
88
|
# ---
|
89
89
|
# * GSL::POSINF
|
90
90
|
#
|
91
|
-
# The IEEE representation of positive infinity,
|
91
|
+
# The IEEE representation of positive infinity,
|
92
92
|
# computed from the expression +1.0/0.0.
|
93
93
|
# ---
|
94
94
|
# * GSL::NEGINF
|
95
95
|
#
|
96
|
-
# The IEEE representation of negative infinity,
|
96
|
+
# The IEEE representation of negative infinity,
|
97
97
|
# computed from the expression -1.0/0.0.
|
98
98
|
# ---
|
99
99
|
# * GSL::NAN
|
@@ -101,7 +101,7 @@
|
|
101
101
|
# The IEEE representation of the Not-a-Number symbol,
|
102
102
|
# computed from the ratio 0.0/0.0.
|
103
103
|
#
|
104
|
-
# ===
|
104
|
+
# === Module functions
|
105
105
|
# ---
|
106
106
|
# * GSL::isnan(x)
|
107
107
|
#
|
@@ -113,59 +113,59 @@
|
|
113
113
|
# ---
|
114
114
|
# * GSL::isinf(x)
|
115
115
|
#
|
116
|
-
# This returns +1 if <tt>x</tt> is positive infinity,
|
116
|
+
# This returns +1 if <tt>x</tt> is positive infinity,
|
117
117
|
# -1 if <tt>x</tt> is negative infinity and 0 otherwise.
|
118
118
|
# NOTE: In Darwin9.5.0-gcc4.0.1, this method returns 1 for -inf.
|
119
119
|
# ---
|
120
120
|
# * GSL::isinf?(x)
|
121
121
|
#
|
122
|
-
# This returns <tt>true</tt> if <tt>x</tt> is positive or negative infinity,
|
122
|
+
# This returns <tt>true</tt> if <tt>x</tt> is positive or negative infinity,
|
123
123
|
# and <tt>false</tt> otherwise.
|
124
124
|
# ---
|
125
125
|
# * GSL::finite(x)
|
126
126
|
#
|
127
|
-
# This returns 1 if <tt>x</tt> is a real number,
|
127
|
+
# This returns 1 if <tt>x</tt> is a real number,
|
128
128
|
# and 0 if it is infinite or not-a-number.
|
129
129
|
# ---
|
130
130
|
# * GSL::finite?(x)
|
131
131
|
#
|
132
|
-
# This returns <tt>true</tt> if <tt>x</tt> is a real number,
|
132
|
+
# This returns <tt>true</tt> if <tt>x</tt> is a real number,
|
133
133
|
# and <tt>false</tt> if it is infinite or not-a-number.
|
134
134
|
#
|
135
|
-
# ==
|
135
|
+
# == Elementary Functions
|
136
136
|
# ---
|
137
137
|
# * GSL::log1p(x)
|
138
138
|
#
|
139
|
-
# This method computes the value of log(1+x)
|
140
|
-
# in a way that is accurate for small <tt>x</tt>. It provides an alternative
|
139
|
+
# This method computes the value of log(1+x)
|
140
|
+
# in a way that is accurate for small <tt>x</tt>. It provides an alternative
|
141
141
|
# to the BSD math function log1p(x).
|
142
142
|
# ---
|
143
143
|
# * GSL::expm1(x)
|
144
144
|
#
|
145
|
-
# This method computes the value of exp(x)-1
|
146
|
-
# in a way that is accurate for small <tt>x</tt>. It provides an alternative
|
145
|
+
# This method computes the value of exp(x)-1
|
146
|
+
# in a way that is accurate for small <tt>x</tt>. It provides an alternative
|
147
147
|
# to the BSD math function expm1(x).
|
148
148
|
# ---
|
149
149
|
# * GSL::hypot(x, y)
|
150
150
|
#
|
151
|
-
# This method computes the value of sqrt{x^2 + y^2} in a way that
|
151
|
+
# This method computes the value of sqrt{x^2 + y^2} in a way that
|
152
152
|
# avoids overflow.
|
153
153
|
# ---
|
154
|
-
# * GSL::hypot3(x, y, z)
|
154
|
+
# * GSL::hypot3(x, y, z)
|
155
155
|
#
|
156
|
-
# Computes the value of sqrt{x^2 + y^2 + z^2} in a way that avoids overflow.
|
156
|
+
# Computes the value of sqrt{x^2 + y^2 + z^2} in a way that avoids overflow.
|
157
157
|
# ---
|
158
158
|
# * GSL::acosh(x)
|
159
159
|
#
|
160
|
-
# This method computes the value of arccosh(x).
|
160
|
+
# This method computes the value of arccosh(x).
|
161
161
|
# ---
|
162
162
|
# * GSL::asinh(x)
|
163
163
|
#
|
164
|
-
# This method computes the value of arcsinh(x).
|
164
|
+
# This method computes the value of arcsinh(x).
|
165
165
|
# ---
|
166
166
|
# * GSL::atanh(x)
|
167
167
|
#
|
168
|
-
# This method computes the value of arctanh(x).
|
168
|
+
# This method computes the value of arctanh(x).
|
169
169
|
#
|
170
170
|
# These methods above can take argument <tt>x</tt> of
|
171
171
|
# Integer, Float, Array, Vector or Matrix.
|
@@ -173,22 +173,22 @@
|
|
173
173
|
# ---
|
174
174
|
# * GSL::ldexp(x)
|
175
175
|
#
|
176
|
-
# This method computes the value of x * 2^e.
|
176
|
+
# This method computes the value of x * 2^e.
|
177
177
|
# ---
|
178
178
|
# * GSL::frexp(x)
|
179
179
|
#
|
180
|
-
# This method splits the number <tt>x</tt> into its normalized fraction
|
181
|
-
# f and exponent e, such that x = f * 2^e and 0.5 <= f < 1.
|
182
|
-
# The method returns f and the exponent e as an array, [f, e].
|
183
|
-
# If <tt>x</tt> is zero, both f and e are set to zero.
|
180
|
+
# This method splits the number <tt>x</tt> into its normalized fraction
|
181
|
+
# f and exponent e, such that x = f * 2^e and 0.5 <= f < 1.
|
182
|
+
# The method returns f and the exponent e as an array, [f, e].
|
183
|
+
# If <tt>x</tt> is zero, both f and e are set to zero.
|
184
184
|
#
|
185
|
-
# ==
|
185
|
+
# == Small Integer Powers
|
186
186
|
# ---
|
187
187
|
# * GSL::pow_int(x, n)
|
188
188
|
#
|
189
|
-
# This routine computes the power <tt>x^n</tt> for integer <tt>n</tt>.
|
190
|
-
# The power is computed efficiently -- for example, x^8 is computed as
|
191
|
-
# ((x^2)^2)^2, requiring only 3 multiplications.
|
189
|
+
# This routine computes the power <tt>x^n</tt> for integer <tt>n</tt>.
|
190
|
+
# The power is computed efficiently -- for example, x^8 is computed as
|
191
|
+
# ((x^2)^2)^2, requiring only 3 multiplications.
|
192
192
|
#
|
193
193
|
# ---
|
194
194
|
# * GSL::pow_2(x)
|
@@ -200,25 +200,25 @@
|
|
200
200
|
# * GSL::pow_8(x)
|
201
201
|
# * GSL::pow_9(x)
|
202
202
|
#
|
203
|
-
# These methods can be used to compute small integer powers x^2, x^3, etc.
|
203
|
+
# These methods can be used to compute small integer powers x^2, x^3, etc.
|
204
204
|
# efficiently.
|
205
205
|
#
|
206
|
-
# ==
|
206
|
+
# == Testing the Sign of Numbers
|
207
207
|
# ---
|
208
208
|
# * GSL::SIGN(x)
|
209
209
|
# * GSL::sign(x)
|
210
210
|
#
|
211
|
-
# Return the sign of <tt>x</tt>.
|
212
|
-
# It is defined as ((x) >= 0 ? 1 : -1).
|
213
|
-
# Note that with this definition the sign of zero is positive
|
211
|
+
# Return the sign of <tt>x</tt>.
|
212
|
+
# It is defined as ((x) >= 0 ? 1 : -1).
|
213
|
+
# Note that with this definition the sign of zero is positive
|
214
214
|
# (regardless of its IEEE sign bit).
|
215
215
|
#
|
216
|
-
# ==
|
216
|
+
# == Testing for Odd and Even Numbers
|
217
217
|
# ---
|
218
218
|
# * GSL::is_odd(n)
|
219
219
|
# * GSL::IS_ODD(n)
|
220
220
|
#
|
221
|
-
# Evaluate to 1 if <tt>n</tt> is odd and 0 if <tt>n</tt> is even.
|
221
|
+
# Evaluate to 1 if <tt>n</tt> is odd and 0 if <tt>n</tt> is even.
|
222
222
|
# The argument <tt>n</tt> must be of Fixnum type.
|
223
223
|
# ---
|
224
224
|
# * GSL::is_odd?(n)
|
@@ -229,7 +229,7 @@
|
|
229
229
|
# * GSL::is_even(n)
|
230
230
|
# * GSL::IS_EVEN(n)
|
231
231
|
#
|
232
|
-
# Evaluate to 1 if <tt>n</tt> is even and 0 if <tt>n</tt> is odd.
|
232
|
+
# Evaluate to 1 if <tt>n</tt> is even and 0 if <tt>n</tt> is odd.
|
233
233
|
# The argument <tt>n</tt> must be of Fixnum type.
|
234
234
|
# ---
|
235
235
|
# * GSL::is_even?(n)
|
@@ -237,25 +237,25 @@
|
|
237
237
|
#
|
238
238
|
# Return <tt>true</tt> if <tt>n</tt> is even and <tt>false</tt> if odd.
|
239
239
|
#
|
240
|
-
# ==
|
240
|
+
# == Maximum and Minimum functions
|
241
241
|
# ---
|
242
242
|
# * GSL::max(a, b)
|
243
243
|
# * GSL::MAX(a, b)
|
244
244
|
# * GSL::min(a, b)
|
245
245
|
# * GSL::MIN(a, b)
|
246
246
|
#
|
247
|
-
#
|
248
|
-
# ==
|
247
|
+
#
|
248
|
+
# == Approximate Comparison of Floating Point Numbers
|
249
249
|
# ---
|
250
250
|
# * GSL::fcmp(a, b, epsilon = 1e-10)
|
251
251
|
#
|
252
|
-
# This method determines whether <tt>x</tt> and <tt>y</tt> are approximately equal to a
|
252
|
+
# This method determines whether <tt>x</tt> and <tt>y</tt> are approximately equal to a
|
253
253
|
# relative accuracy <tt>epsilon</tt>.
|
254
254
|
# ---
|
255
255
|
# * GSL::equal?(a, b, epsilon = 1e-10)
|
256
256
|
#
|
257
257
|
#
|
258
|
-
# ==
|
258
|
+
# == Module Constants
|
259
259
|
# ---
|
260
260
|
# * GSL::VERSION
|
261
261
|
#
|
@@ -267,10 +267,10 @@
|
|
267
267
|
#
|
268
268
|
# Ruby/GSL version
|
269
269
|
#
|
270
|
-
# {prev}[link:
|
271
|
-
# {next}[link:
|
270
|
+
# {prev}[link:ehandling_rdoc.html]
|
271
|
+
# {next}[link:complex_rdoc.html]
|
272
272
|
#
|
273
|
-
# {Reference index}[link:
|
273
|
+
# {Reference index}[link:ref_rdoc.html]
|
274
274
|
# {top}[link:index.html]
|
275
275
|
#
|
276
276
|
#
|
data/rdoc/matrix.rdoc
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
#
|
2
2
|
# = Matrices
|
3
3
|
# Contents:
|
4
|
-
# 1. {Class methods}[link:
|
5
|
-
# 1. {Instance methods}[link:
|
6
|
-
# 1. {Accessing matrix elements}[link:
|
7
|
-
# 1. {Initializing matrix elements}[link:
|
8
|
-
# 1. {IO}[link:
|
9
|
-
# 1. {Matrix views}[link:
|
10
|
-
# 1. {Creating row and column views}[link:
|
11
|
-
# 1. {Iterators}[link:
|
12
|
-
# 1. {Copying matrices}[link:
|
13
|
-
# 1. {Copying rows and columns}[link:
|
14
|
-
# 1. {Exchanging rows and columns}[link:
|
15
|
-
# 1. {Matrix operations}[link:
|
16
|
-
# 1. {Finding maximum and minimum elements of matrices}[link:
|
17
|
-
# 1. {Matrix properties}[link:
|
18
|
-
# 1. {NArray}[link:
|
19
|
-
# 1. {Special matrices}[link:
|
20
|
-
#
|
21
|
-
# ==
|
4
|
+
# 1. {Class methods}[link:matrix_rdoc.html#label-Class+methods]
|
5
|
+
# 1. {Instance methods}[link:matrix_rdoc.html#label-Instance+Methods]
|
6
|
+
# 1. {Accessing matrix elements}[link:matrix_rdoc.html#label-Accessing+matrix+elements]
|
7
|
+
# 1. {Initializing matrix elements}[link:matrix_rdoc.html#label-Initializing+matrix+elements]
|
8
|
+
# 1. {IO}[link:matrix_rdoc.html#label-IO]
|
9
|
+
# 1. {Matrix views}[link:matrix_rdoc.html#label-Matrix+views]
|
10
|
+
# 1. {Creating row and column views}[link:matrix_rdoc.html#label-Creating+row+and+column+views]
|
11
|
+
# 1. {Iterators}[link:matrix_rdoc.html#label-Iterators]
|
12
|
+
# 1. {Copying matrices}[link:matrix_rdoc.html#label-Copying+matrices]
|
13
|
+
# 1. {Copying rows and columns}[link:matrix_rdoc.html#label-Copying+rows+and+columns]
|
14
|
+
# 1. {Exchanging rows and columns}[link:matrix_rdoc.html#label-Exchanging+rows+and+columns]
|
15
|
+
# 1. {Matrix operations}[link:matrix_rdoc.html#label-Matrix+operations]
|
16
|
+
# 1. {Finding maximum and minimum elements of matrices}[link:matrix_rdoc.html#label-Finding+maximum+and+minimum+elements+of+matrices]
|
17
|
+
# 1. {Matrix properties}[link:matrix_rdoc.html#label-Matrix+properties]
|
18
|
+
# 1. {NArray}[link:matrix_rdoc.html#label-NArray]
|
19
|
+
# 1. {Special matrices}[link:matrix_rdoc.html#label-Special+matrices]
|
20
|
+
#
|
21
|
+
# == Class methods
|
22
22
|
#
|
23
23
|
# ---
|
24
24
|
# * GSL::Matrix.alloc(n)
|
25
25
|
# * GSL::Matrix.alloc(size1, size2)
|
26
|
-
# * GSL::Matrix.alloc(array)
|
26
|
+
# * GSL::Matrix.alloc(array)
|
27
27
|
# * GSL::Matrix.alloc(arrays)
|
28
28
|
# * GSL::Matrix.alloc( ... )
|
29
29
|
# * GSL::Matrix[ ... ]
|
@@ -32,21 +32,21 @@
|
|
32
32
|
#
|
33
33
|
# 1. From arrays
|
34
34
|
# >> m = GSL::Matrix[[1, 2, 3], [4, 5, 6], [7, 8, 9]]
|
35
|
-
# => GSL::Matrix
|
36
|
-
# [ 1.000e+00 2.000e+00 3.000e+00
|
37
|
-
# 4.000e+00 5.000e+00 6.000e+00
|
35
|
+
# => GSL::Matrix
|
36
|
+
# [ 1.000e+00 2.000e+00 3.000e+00
|
37
|
+
# 4.000e+00 5.000e+00 6.000e+00
|
38
38
|
# 7.000e+00 8.000e+00 9.000e+00 ]
|
39
|
-
#
|
39
|
+
#
|
40
40
|
# 1. With an array and rows&cols,
|
41
41
|
# m = GSL::Matrix.alloc([1, 2, 3, 4, 5, 6, 7, 8, 9], 3, 3)
|
42
42
|
#
|
43
43
|
# 1. With Range objects,
|
44
44
|
# >> m = GSL::Matrix.alloc(1..3, 4..6, 7..9)
|
45
|
-
# [ 1.000e+00 2.000e+00 3.000e+00
|
46
|
-
# 4.000e+00 5.000e+00 6.000e+00
|
45
|
+
# [ 1.000e+00 2.000e+00 3.000e+00
|
46
|
+
# 4.000e+00 5.000e+00 6.000e+00
|
47
47
|
# 7.000e+00 8.000e+00 9.000e+00 ]
|
48
48
|
# >> m2 = GSL::Matrix[1..6, 2, 3]
|
49
|
-
# [ 1.000e+00 2.000e+00 3.000e+00
|
49
|
+
# [ 1.000e+00 2.000e+00 3.000e+00
|
50
50
|
# 4.000e+00 5.000e+00 6.000e+00 ]
|
51
51
|
#
|
52
52
|
# ---
|
@@ -56,14 +56,14 @@
|
|
56
56
|
# Examples:
|
57
57
|
# >> m = GSL::Matrix::Int.eye(3)
|
58
58
|
# => GSL::Matrix::Int
|
59
|
-
# [ 1 0 0
|
60
|
-
# 0 1 0
|
59
|
+
# [ 1 0 0
|
60
|
+
# 0 1 0
|
61
61
|
# 0 0 1 ]
|
62
62
|
# >> m = GSL::Matrix::Int.eye(2, 4)
|
63
63
|
# => GSL::Matrix::Int
|
64
|
-
# [ 1 0 0 0
|
64
|
+
# [ 1 0 0 0
|
65
65
|
# 0 1 0 0 ]
|
66
|
-
#
|
66
|
+
#
|
67
67
|
# ---
|
68
68
|
# * GSL::Matrix.identity(n)
|
69
69
|
# * GSL::Matrix.scalar(n)
|
@@ -71,7 +71,7 @@
|
|
71
71
|
# * GSL::Matrix.I(n)
|
72
72
|
#
|
73
73
|
# Create diagonal matrices of dimensions n*n, of values 1.0.
|
74
|
-
#
|
74
|
+
#
|
75
75
|
# ---
|
76
76
|
# * GSL::Matrix.diagonal(a, b, c, ...)
|
77
77
|
# * GSL::Matrix.diagonal(Ary)
|
@@ -83,14 +83,14 @@
|
|
83
83
|
# Example:
|
84
84
|
# >> GSL::Matrix::Int.diagonal(1..4)
|
85
85
|
# => GSL::Matrix::Int
|
86
|
-
# [ 1 0 0 0
|
87
|
-
# 0 2 0 0
|
88
|
-
# 0 0 3 0
|
86
|
+
# [ 1 0 0 0
|
87
|
+
# 0 2 0 0
|
88
|
+
# 0 0 3 0
|
89
89
|
# 0 0 0 4 ]
|
90
90
|
# >> GSL::Matrix::Int.diagonal(2, 5, 3)
|
91
91
|
# => GSL::Matrix::Int
|
92
|
-
# [ 2 0 0
|
93
|
-
# 0 5 0
|
92
|
+
# [ 2 0 0
|
93
|
+
# 0 5 0
|
94
94
|
# 0 0 3 ]
|
95
95
|
#
|
96
96
|
# ---
|
@@ -111,26 +111,26 @@
|
|
111
111
|
# Example:
|
112
112
|
#
|
113
113
|
# >> m = GSL::Matrix::Int.indgen(3, 5)
|
114
|
-
# => GSL::Matrix::Int
|
115
|
-
# [ 0 1 2 3 4
|
116
|
-
# 5 6 7 8 9
|
114
|
+
# => GSL::Matrix::Int
|
115
|
+
# [ 0 1 2 3 4
|
116
|
+
# 5 6 7 8 9
|
117
117
|
# 10 11 12 13 14 ]
|
118
118
|
# >> m = GSL::Matrix::Int.indgen(3, 5, 2)
|
119
|
-
# => GSL::Matrix::Int
|
120
|
-
# [ 2 3 4 5 6
|
121
|
-
# 7 8 9 10 11
|
119
|
+
# => GSL::Matrix::Int
|
120
|
+
# [ 2 3 4 5 6
|
121
|
+
# 7 8 9 10 11
|
122
122
|
# 12 13 14 15 16 ]
|
123
123
|
# >> m = GSL::Matrix.indgen(2, 3, 4.5, 6.7)
|
124
124
|
# => GSL::Matrix
|
125
|
-
# [ 4.500e+00 1.120e+01 1.790e+01
|
125
|
+
# [ 4.500e+00 1.120e+01 1.790e+01
|
126
126
|
# 2.460e+01 3.130e+01 3.800e+01 ]
|
127
127
|
#
|
128
|
-
# ===
|
128
|
+
# === NOTE:
|
129
129
|
# Matrix dimensions are limited within the range of Fixnum.
|
130
130
|
# For 32-bit CPU, the maximum of matrix dimension is 2^30 ~ 1e9.
|
131
131
|
#
|
132
|
-
# ==
|
133
|
-
# ===
|
132
|
+
# == Instance Methods
|
133
|
+
# === Accessing matrix elements
|
134
134
|
#
|
135
135
|
# ---
|
136
136
|
# * GSL::Matrix#size1
|
@@ -156,7 +156,7 @@
|
|
156
156
|
#
|
157
157
|
# ---
|
158
158
|
# * GSL::Matrix#set(args, val)
|
159
|
-
# * GSL::Matrix#[args]=val
|
159
|
+
# * \GSL::Matrix#[args]=val
|
160
160
|
#
|
161
161
|
# If <tt>args</tt> is empty and <tt>val</tt> is an Array (i.e. called with just a
|
162
162
|
# single Array argument), the Array's elements are taken as row contents.
|
@@ -173,7 +173,7 @@
|
|
173
173
|
# as indexes.
|
174
174
|
#
|
175
175
|
# If <tt>args</tt> are two <tt>Fixnums</tt>, <tt>i</tt> and <tt>j</tt>, this method
|
176
|
-
# sets the <tt>(i,j)</tt>-th element of the matrix <tt>self</tt> to <tt>val</tt>.
|
176
|
+
# sets the <tt>(i,j)</tt>-th element of the matrix <tt>self</tt> to <tt>val</tt>.
|
177
177
|
#
|
178
178
|
# If <tt>args</tt> is a single <tt>Fixnum</tt>, <tt>i</tt>, this method sets the
|
179
179
|
# element at row <tt>i</tt>/<tt>size2</tt>, column <tt>i</tt>%<tt>size2</tt> to
|
@@ -194,18 +194,18 @@
|
|
194
194
|
# NOTE: GSL does not provide a matrix copy function that properly copies data
|
195
195
|
# across overlapping memory regions, so watch out if assigning to part of a
|
196
196
|
# Matrix from another part of itself (see <tt>#set</tt> example of
|
197
|
-
# {GSL::Vector}[link:
|
197
|
+
# {GSL::Vector}[link:vector_rdoc.html]).
|
198
198
|
#
|
199
199
|
# ---
|
200
200
|
# * GSL::Matrix#get(args)
|
201
|
-
# * GSL::Matrix#[args]
|
201
|
+
# * \GSL::Matrix#[args]
|
202
202
|
#
|
203
203
|
# If <tt>args</tt> are two <tt>Fixnums</tt>, <tt>i</tt> and <tt>j</tt>, this method
|
204
|
-
# returns the <tt>(i,j)</tt>-th element of the matrix <tt>self</tt>.
|
204
|
+
# returns the <tt>(i,j)</tt>-th element of the matrix <tt>self</tt>.
|
205
205
|
#
|
206
206
|
# If <tt>args</tt> is a single <tt>Fixnum</tt>, <tt>i</tt>, this method returns the
|
207
207
|
# element at row <tt>i</tt>/<tt>size2</tt>, column <tt>i</tt>%<tt>size2</tt>.
|
208
|
-
#
|
208
|
+
#
|
209
209
|
# All other forms of <tt>args</tt> are treated as with <tt>Matrix#submatrix</tt>
|
210
210
|
# and a View object is returned.
|
211
211
|
#
|
@@ -226,8 +226,8 @@
|
|
226
226
|
# Examples:
|
227
227
|
# >> m = GSL::Matrix[1..9, 3, 3]
|
228
228
|
# => GSL::Matrix
|
229
|
-
# [ 1.000e+00 2.000e+00 3.000e+00
|
230
|
-
# 4.000e+00 5.000e+00 6.000e+00
|
229
|
+
# [ 1.000e+00 2.000e+00 3.000e+00
|
230
|
+
# 4.000e+00 5.000e+00 6.000e+00
|
231
231
|
# 7.000e+00 8.000e+00 9.000e+00 ]
|
232
232
|
# >> m[1, 2]
|
233
233
|
# => 6.0
|
@@ -235,23 +235,23 @@
|
|
235
235
|
# => 123
|
236
236
|
# >> m
|
237
237
|
# => GSL::Matrix
|
238
|
-
# [ 1.000e+00 2.000e+00 3.000e+00
|
239
|
-
# 4.000e+00 5.000e+00 1.230e+02
|
238
|
+
# [ 1.000e+00 2.000e+00 3.000e+00
|
239
|
+
# 4.000e+00 5.000e+00 1.230e+02
|
240
240
|
# 7.000e+00 8.000e+00 9.000e+00 ]
|
241
241
|
# >> m[1]
|
242
242
|
# => 2.0
|
243
243
|
# >> m.set([3, 5, 2], [4, 5, 3], [7, 1, 5])
|
244
244
|
# => GSL::Matrix
|
245
|
-
# [ 3.000e+00 5.000e+00 2.000e+00
|
246
|
-
# 4.000e+00 5.000e+00 3.000e+00
|
245
|
+
# [ 3.000e+00 5.000e+00 2.000e+00
|
246
|
+
# 4.000e+00 5.000e+00 3.000e+00
|
247
247
|
# 7.000e+00 1.000e+00 5.000e+00 ]
|
248
248
|
# >> m[1][1] # old/unsupported form
|
249
249
|
# NoMethodError: undefined method `[]' for 2.0:Float
|
250
250
|
# from (irb):8
|
251
251
|
# >> m = GSL::Matrix::Int[1..9, 3, 3]
|
252
252
|
# => GSL::Matrix::Int
|
253
|
-
# [ 1 2 3
|
254
|
-
# 4 5 6
|
253
|
+
# [ 1 2 3
|
254
|
+
# 4 5 6
|
255
255
|
# 7 8 9 ]
|
256
256
|
# >> m[1] # m[0,1]
|
257
257
|
# => 2
|
@@ -274,7 +274,7 @@
|
|
274
274
|
# >> GSL::Matrix.eye(3).to_a
|
275
275
|
# => [[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]
|
276
276
|
#
|
277
|
-
# ===
|
277
|
+
# === Initializing matrix elements
|
278
278
|
# ---
|
279
279
|
# * GSL::Matrix#set_all(x)
|
280
280
|
#
|
@@ -283,16 +283,16 @@
|
|
283
283
|
# ---
|
284
284
|
# * GSL::Matrix#set_zero
|
285
285
|
#
|
286
|
-
# This method sets all the elements of the matrix to zero.
|
286
|
+
# This method sets all the elements of the matrix to zero.
|
287
287
|
#
|
288
288
|
# ---
|
289
289
|
# * GSL::Matrix#set_identity
|
290
290
|
#
|
291
|
-
# This method sets the elements of the matrix to the corresponding
|
292
|
-
# elements of the identity matrix, i.e. a unit diagonal with all off-diagonal
|
293
|
-
# elements zero. This applies to both square and rectangular matrices.
|
291
|
+
# This method sets the elements of the matrix to the corresponding
|
292
|
+
# elements of the identity matrix, i.e. a unit diagonal with all off-diagonal
|
293
|
+
# elements zero. This applies to both square and rectangular matrices.
|
294
294
|
#
|
295
|
-
# ===
|
295
|
+
# === IO
|
296
296
|
# ---
|
297
297
|
# * GSL::Matrix#fwrite(io)
|
298
298
|
# * GSL::Matrix#fwrite(filename)
|
@@ -304,7 +304,7 @@
|
|
304
304
|
# * GSL::Matrix#fscanf(filename)
|
305
305
|
#
|
306
306
|
#
|
307
|
-
# ===
|
307
|
+
# === Matrix views
|
308
308
|
# The <tt>GSL::Matrix::View</tt> class is defined to be used as "references" to
|
309
309
|
# matrices. The <tt>Matrix::View</tt> class is a subclass of <tt>Matrix</tt>, and an
|
310
310
|
# instance of the <tt>View</tt> class created by slicing a <tt>Matrix</tt> object can
|
@@ -394,97 +394,97 @@
|
|
394
394
|
#
|
395
395
|
# Ex:
|
396
396
|
# >> v = Vector[1..9]
|
397
|
-
# => GSL::Vector
|
397
|
+
# => GSL::Vector
|
398
398
|
# [ 1.000e+00 2.000e+00 3.000e+00 4.000e+00 5.000e+00 6.000e+00 7.000e+00 8.000e+00 9.000e+00 ]
|
399
399
|
# >> m = v.matrix_view(3, 3)
|
400
|
-
# => GSL::Matrix::View
|
401
|
-
# [ 1.000e+00 2.000e+00 3.000e+00
|
402
|
-
# 4.000e+00 5.000e+00 6.000e+00
|
400
|
+
# => GSL::Matrix::View
|
401
|
+
# [ 1.000e+00 2.000e+00 3.000e+00
|
402
|
+
# 4.000e+00 5.000e+00 6.000e+00
|
403
403
|
# 7.000e+00 8.000e+00 9.000e+00 ]
|
404
404
|
# >> m[1][1] = 99.99
|
405
405
|
# => 99.99
|
406
406
|
# >> v
|
407
|
-
# => GSL::Vector
|
407
|
+
# => GSL::Vector
|
408
408
|
# [ 1.000e+00 2.000e+00 3.000e+00 4.000e+00 9.999e+01 6.000e+00 7.000e+00 8.000e+00 9.000e+00 ]
|
409
|
-
# >>
|
409
|
+
# >>
|
410
410
|
#
|
411
411
|
#
|
412
|
-
# ===
|
412
|
+
# === Creating row and column views
|
413
413
|
#
|
414
414
|
# ---
|
415
415
|
# * GSL::Matrix#row(i)
|
416
416
|
#
|
417
417
|
# These methods return <tt>i</tt>-th row of the matrix as a <tt>Vector::View</tt>
|
418
418
|
# object. Any modifications to the <tt>Vectror::View</tt> object returned by this method
|
419
|
-
# propagate to the original matrix.
|
420
|
-
#
|
419
|
+
# propagate to the original matrix.
|
420
|
+
#
|
421
421
|
# ---
|
422
422
|
# * GSL::Matrix#column(i)
|
423
|
-
# * GSL::Matrix#col(i)
|
423
|
+
# * GSL::Matrix#col(i)
|
424
424
|
#
|
425
425
|
# These methods return a vector view of the <tt>j</tt>-th column of the matrix.
|
426
426
|
#
|
427
427
|
# ---
|
428
428
|
# * GSL::Matrix#subrow(i, offset, n)
|
429
429
|
#
|
430
|
-
# Returns a vector view of the <tt>i</tt>-th row of the matrix <tt>self</tt>
|
431
|
-
# beginning at <tt>offset</tt> elements past the first column
|
430
|
+
# Returns a vector view of the <tt>i</tt>-th row of the matrix <tt>self</tt>
|
431
|
+
# beginning at <tt>offset</tt> elements past the first column
|
432
432
|
# and containing <tt>n</tt> elements. (>= GSL-1.10)
|
433
433
|
#
|
434
434
|
# ---
|
435
435
|
# * GSL::Matrix#subcolumn(j, offset, n)
|
436
436
|
#
|
437
|
-
# Returns a vector view of the <tt>j</tt>-th column of the matrix <tt>self</tt>
|
438
|
-
# beginning at <tt>offset</tt> elements past the first row
|
437
|
+
# Returns a vector view of the <tt>j</tt>-th column of the matrix <tt>self</tt>
|
438
|
+
# beginning at <tt>offset</tt> elements past the first row
|
439
439
|
# and containing <tt>n</tt> elements. (>= GSL-1.10)
|
440
440
|
#
|
441
441
|
# ---
|
442
442
|
# * GSL::Matrix#diag
|
443
|
-
# * GSL::Matrix#diagonal
|
443
|
+
# * GSL::Matrix#diagonal
|
444
444
|
#
|
445
445
|
# This method returns a <tt>Vector::View</tt> of the diagonal of the matrix.
|
446
|
-
# The matrix is not required to be square. For a rectangular matrix the
|
446
|
+
# The matrix is not required to be square. For a rectangular matrix the
|
447
447
|
# length of the diagonal is the same as the smaller dimension of the matrix.
|
448
448
|
#
|
449
449
|
#
|
450
450
|
# Ex:
|
451
451
|
# >> m = GSL::Matrix[1..9, 3, 3]
|
452
|
-
# => GSL::Matrix
|
453
|
-
# [ 1.000e+00 2.000e+00 3.000e+00
|
454
|
-
# 4.000e+00 5.000e+00 6.000e+00
|
452
|
+
# => GSL::Matrix
|
453
|
+
# [ 1.000e+00 2.000e+00 3.000e+00
|
454
|
+
# 4.000e+00 5.000e+00 6.000e+00
|
455
455
|
# 7.000e+00 8.000e+00 9.000e+00 ]
|
456
456
|
# >> m.row(1)
|
457
|
-
# => GSL::Vector::View
|
457
|
+
# => GSL::Vector::View
|
458
458
|
# [ 4.000e+00 5.000e+00 6.000e+00 ]
|
459
459
|
# >> m.col(2)
|
460
|
-
# => GSL::Vector::Col::View
|
461
|
-
# [ 3.000e+00
|
462
|
-
# 6.000e+00
|
460
|
+
# => GSL::Vector::Col::View
|
461
|
+
# [ 3.000e+00
|
462
|
+
# 6.000e+00
|
463
463
|
# 9.000e+00 ]
|
464
464
|
# >> m.col(2)[2] = 123
|
465
465
|
# => 123
|
466
466
|
# >> m
|
467
|
-
# => GSL::Matrix
|
468
|
-
# [ 1.000e+00 2.000e+00 3.000e+00
|
469
|
-
# 4.000e+00 5.000e+00 6.000e+00
|
467
|
+
# => GSL::Matrix
|
468
|
+
# [ 1.000e+00 2.000e+00 3.000e+00
|
469
|
+
# 4.000e+00 5.000e+00 6.000e+00
|
470
470
|
# 7.000e+00 8.000e+00 1.230e+02 ]
|
471
471
|
# >> m.diagonal
|
472
|
-
# => GSL::Vector::View:
|
472
|
+
# => GSL::Vector::View:
|
473
473
|
# [ 1.000e+00 5.000e+00 1.230e+02 ]
|
474
474
|
#
|
475
475
|
# ---
|
476
476
|
# * GSL::Matrix#subdiagonal(k)
|
477
477
|
#
|
478
|
-
# Returns a vector view view of the <tt>k</tt>-th subdiagonal
|
479
|
-
# of the matrix <tt>self</tt>.
|
480
|
-
# The matrix is not required to be square. The diagonal of the matrix
|
478
|
+
# Returns a vector view view of the <tt>k</tt>-th subdiagonal
|
479
|
+
# of the matrix <tt>self</tt>.
|
480
|
+
# The matrix is not required to be square. The diagonal of the matrix
|
481
481
|
# corresponds to k = 0.
|
482
482
|
#
|
483
483
|
# ---
|
484
484
|
# * GSL::Matrix#superdiagonal(k)
|
485
485
|
#
|
486
|
-
# Returns a vector view of the <tt>k</tt>-th superdiagonal of the matrix <tt>self</tt>.
|
487
|
-
# The matrix is not required to be square. The diagonal of the matrix
|
486
|
+
# Returns a vector view of the <tt>k</tt>-th superdiagonal of the matrix <tt>self</tt>.
|
487
|
+
# The matrix is not required to be square. The diagonal of the matrix
|
488
488
|
# corresponds to k = 0.
|
489
489
|
#
|
490
490
|
# ---
|
@@ -493,22 +493,22 @@
|
|
493
493
|
# Creates a <tt>GSL::Vector</tt> object "flattening" the rows of the matrix <tt>self</tt>.
|
494
494
|
#
|
495
495
|
# >> m = GSL::Matrix[1..6, 2, 3]
|
496
|
-
# => GSL::Matrix
|
497
|
-
# [ 1.000e+00 2.000e+00 3.000e+00
|
496
|
+
# => GSL::Matrix
|
497
|
+
# [ 1.000e+00 2.000e+00 3.000e+00
|
498
498
|
# 4.000e+00 5.000e+00 6.000e+00 ]
|
499
499
|
# >> m.to_v
|
500
|
-
# => GSL::Vector
|
500
|
+
# => GSL::Vector
|
501
501
|
# [ 1.000e+00 2.000e+00 3.000e+00 4.000e+00 5.000e+00 6.000e+00 ]
|
502
502
|
#
|
503
|
-
# ===
|
503
|
+
# === Iterators
|
504
504
|
# ---
|
505
505
|
# * GSL::Matrix#each_row
|
506
506
|
#
|
507
|
-
# Iterator for each of rows in the matrix <tt>self</tt>.
|
507
|
+
# Iterator for each of rows in the matrix <tt>self</tt>.
|
508
508
|
# ---
|
509
509
|
# * GSL::Matrix#each_col
|
510
510
|
#
|
511
|
-
# Iterator for each of columns in the matrix <tt>self</tt>.
|
511
|
+
# Iterator for each of columns in the matrix <tt>self</tt>.
|
512
512
|
#
|
513
513
|
# ---
|
514
514
|
# * GSL::Matrix#collect { |item| .. }
|
@@ -517,7 +517,7 @@
|
|
517
517
|
# * GSL::Matrix#map! { |item| .. }
|
518
518
|
#
|
519
519
|
#
|
520
|
-
# ===
|
520
|
+
# === Copying matrices
|
521
521
|
# ---
|
522
522
|
# * GSL::Matrix#clone
|
523
523
|
# * GSL::Matrix#duplicate
|
@@ -529,35 +529,35 @@
|
|
529
529
|
# * GSL::Matrix.swap(dest, src)
|
530
530
|
#
|
531
531
|
#
|
532
|
-
# ===
|
532
|
+
# === Copying rows and columns
|
533
533
|
#
|
534
534
|
# ---
|
535
535
|
# * GSL::Matrix#get_row(i)
|
536
536
|
#
|
537
|
-
# This method returns a new vector (not a view) which contains the elements
|
537
|
+
# This method returns a new vector (not a view) which contains the elements
|
538
538
|
# of the <tt>i</tt>-th row of the matrix <tt>self</tt>.
|
539
539
|
#
|
540
540
|
# ---
|
541
541
|
# * GSL::Matrix#get_col(j)
|
542
542
|
#
|
543
|
-
# This method returns a new vector (not a view) which contains the elements of the <tt>j</tt>-th
|
543
|
+
# This method returns a new vector (not a view) which contains the elements of the <tt>j</tt>-th
|
544
544
|
# column of the matrix <tt>self</tt>.
|
545
545
|
#
|
546
546
|
# ---
|
547
547
|
# * GSL::Matrix#set_row(i, v)
|
548
548
|
#
|
549
|
-
# This method copies the elements of the vector <tt>v</tt> into the <tt>i</tt>-th
|
550
|
-
# row of the matrix.
|
551
|
-
# The length of the vector must be the same as the length of the row.
|
549
|
+
# This method copies the elements of the vector <tt>v</tt> into the <tt>i</tt>-th
|
550
|
+
# row of the matrix.
|
551
|
+
# The length of the vector must be the same as the length of the row.
|
552
552
|
#
|
553
553
|
# ---
|
554
554
|
# * GSL::Matrix#set_col(j, v)
|
555
555
|
#
|
556
|
-
# This method copies the elements of the vector <tt>v</tt> into the <tt>j</tt>-th
|
557
|
-
# column of the matrix. The length of the vector must be the same as the length
|
558
|
-
# of the column.
|
556
|
+
# This method copies the elements of the vector <tt>v</tt> into the <tt>j</tt>-th
|
557
|
+
# column of the matrix. The length of the vector must be the same as the length
|
558
|
+
# of the column.
|
559
559
|
#
|
560
|
-
# ===
|
560
|
+
# === Exchanging rows and columns
|
561
561
|
# ---
|
562
562
|
# * GSL::Matrix#swap_rows!(i, j)
|
563
563
|
#
|
@@ -570,7 +570,7 @@
|
|
570
570
|
# ---
|
571
571
|
# * GSL::Matrix#swap_columns!(i, j)
|
572
572
|
#
|
573
|
-
# This method exchanges the <tt>i</tt>-th and <tt>j</tt>-th columns of the matrix <tt>in-place</tt>.
|
573
|
+
# This method exchanges the <tt>i</tt>-th and <tt>j</tt>-th columns of the matrix <tt>in-place</tt>.
|
574
574
|
# ---
|
575
575
|
# * GSL::Matrix#swap_columns(i, j)
|
576
576
|
#
|
@@ -592,9 +592,9 @@
|
|
592
592
|
# ---
|
593
593
|
# * GSL::Matrix#transpose!
|
594
594
|
#
|
595
|
-
# This method replaces the matrix by its transpose by copying the
|
595
|
+
# This method replaces the matrix by its transpose by copying the
|
596
596
|
# elements of the matrix <tt>in-place</tt>. The matrix must be square for this
|
597
|
-
# operation to be possible.
|
597
|
+
# operation to be possible.
|
598
598
|
#
|
599
599
|
# ---
|
600
600
|
# * GSL::Matrix#reverse_rows
|
@@ -602,14 +602,14 @@
|
|
602
602
|
#
|
603
603
|
# Example:
|
604
604
|
# >> m = GSL::Matrix::Int[1..9, 3, 3]
|
605
|
-
# => GSL::Matrix::Int
|
606
|
-
# [ 1 2 3
|
607
|
-
# 4 5 6
|
605
|
+
# => GSL::Matrix::Int
|
606
|
+
# [ 1 2 3
|
607
|
+
# 4 5 6
|
608
608
|
# 7 8 9 ]
|
609
609
|
# >> m.reverse_rows
|
610
|
-
# => GSL::Matrix::Int
|
611
|
-
# [ 7 8 9
|
612
|
-
# 4 5 6
|
610
|
+
# => GSL::Matrix::Int
|
611
|
+
# [ 7 8 9
|
612
|
+
# 4 5 6
|
613
613
|
# 1 2 3 ]
|
614
614
|
#
|
615
615
|
# ---
|
@@ -619,74 +619,74 @@
|
|
619
619
|
# Example:
|
620
620
|
# >> m = GSL::Matrix::Int[1..9, 3, 3]
|
621
621
|
# => GSL::Matrix::Int
|
622
|
-
# [ 1 2 3
|
623
|
-
# 4 5 6
|
622
|
+
# [ 1 2 3
|
623
|
+
# 4 5 6
|
624
624
|
# 7 8 9 ]
|
625
625
|
# >> m.reverse_rows.reverse_columns
|
626
|
-
# => GSL::Matrix::Int
|
627
|
-
# [ 9 8 7
|
628
|
-
# 6 5 4
|
626
|
+
# => GSL::Matrix::Int
|
627
|
+
# [ 9 8 7
|
628
|
+
# 6 5 4
|
629
629
|
# 3 2 1 ]
|
630
630
|
#
|
631
631
|
# ---
|
632
632
|
# * GSL::Matrix#rot90(n = 1)
|
633
633
|
#
|
634
|
-
# Return a copy of <tt>self</tt> with the elements rotated
|
635
|
-
# counterclockwise in 90-degree increments. The argument <tt>n</tt> is
|
636
|
-
# optional, and specifies how many 90-degree rotations are to be applied
|
637
|
-
# (the default value is 1).
|
634
|
+
# Return a copy of <tt>self</tt> with the elements rotated
|
635
|
+
# counterclockwise in 90-degree increments. The argument <tt>n</tt> is
|
636
|
+
# optional, and specifies how many 90-degree rotations are to be applied
|
637
|
+
# (the default value is 1).
|
638
638
|
# Negative values of <tt>n</tt> rotate the matrix in a clockwise direction.
|
639
639
|
#
|
640
640
|
# Examples:
|
641
641
|
# >> m = GSL::Matrix::Int[1..6, 2, 3]
|
642
642
|
# => GSL::Matrix::Int
|
643
|
-
# [ 1 2 3
|
643
|
+
# [ 1 2 3
|
644
644
|
# 4 5 6 ]
|
645
645
|
# >> m.rot90
|
646
646
|
# => GSL::Matrix::Int
|
647
|
-
# [ 3 6
|
648
|
-
# 2 5
|
647
|
+
# [ 3 6
|
648
|
+
# 2 5
|
649
649
|
# 1 4 ]
|
650
650
|
# >> m.rot90(2)
|
651
651
|
# => GSL::Matrix::Int
|
652
|
-
# [ 6 5 4
|
652
|
+
# [ 6 5 4
|
653
653
|
# 3 2 1 ]
|
654
654
|
# >> m.rot90(3)
|
655
655
|
# => GSL::Matrix::Int
|
656
|
-
# [ 4 1
|
657
|
-
# 5 2
|
656
|
+
# [ 4 1
|
657
|
+
# 5 2
|
658
658
|
# 6 3 ]
|
659
659
|
# >> m.rot90(-1)
|
660
660
|
# => GSL::Matrix::Int
|
661
|
-
# [ 4 1
|
662
|
-
# 5 2
|
661
|
+
# [ 4 1
|
662
|
+
# 5 2
|
663
663
|
# 6 3 ]
|
664
664
|
#
|
665
665
|
# ---
|
666
666
|
# * GSL::Matrix#upper
|
667
667
|
#
|
668
|
-
# This creates a matrix copying the upper half part of the matrix
|
668
|
+
# This creates a matrix copying the upper half part of the matrix
|
669
669
|
# <tt>self</tt>, including the diagonal elements.
|
670
670
|
# ---
|
671
671
|
# * GSL::Matrix#lower
|
672
672
|
#
|
673
|
-
# This creates a matrix copying the lower half part of the matrix
|
673
|
+
# This creates a matrix copying the lower half part of the matrix
|
674
674
|
# <tt>self</tt>, including the diagonal elements.
|
675
675
|
#
|
676
676
|
# >> m = GSL::Matrix[1..9, 3, 3]
|
677
677
|
# => GSL::Matrix
|
678
|
-
# [ 1.000e+00 2.000e+00 3.000e+00
|
679
|
-
# 4.000e+00 5.000e+00 6.000e+00
|
678
|
+
# [ 1.000e+00 2.000e+00 3.000e+00
|
679
|
+
# 4.000e+00 5.000e+00 6.000e+00
|
680
680
|
# 7.000e+00 8.000e+00 9.000e+00 ]
|
681
681
|
# >> m.upper
|
682
|
-
# => GSL::Matrix
|
683
|
-
# [ 1.000e+00 2.000e+00 3.000e+00
|
684
|
-
# 0.000e+00 5.000e+00 6.000e+00
|
682
|
+
# => GSL::Matrix
|
683
|
+
# [ 1.000e+00 2.000e+00 3.000e+00
|
684
|
+
# 0.000e+00 5.000e+00 6.000e+00
|
685
685
|
# 0.000e+00 0.000e+00 9.000e+00 ]
|
686
686
|
# >> m.lower
|
687
|
-
# => GSL::Matrix
|
688
|
-
# [ 1.000e+00 0.000e+00 0.000e+00
|
689
|
-
# 4.000e+00 5.000e+00 0.000e+00
|
687
|
+
# => GSL::Matrix
|
688
|
+
# [ 1.000e+00 0.000e+00 0.000e+00
|
689
|
+
# 4.000e+00 5.000e+00 0.000e+00
|
690
690
|
# 7.000e+00 8.000e+00 9.000e+00 ]
|
691
691
|
#
|
692
692
|
# ---
|
@@ -699,49 +699,49 @@
|
|
699
699
|
# => true
|
700
700
|
# >> a = GSL::Matrix::Int[1..4, 2, 2]
|
701
701
|
# => GSL::Matrix::Int
|
702
|
-
# [ 1 2
|
702
|
+
# [ 1 2
|
703
703
|
# 3 4 ]
|
704
704
|
# >> b = GSL::Matrix::Int[5..10, 2, 3]
|
705
705
|
# => GSL::Matrix::Int
|
706
|
-
# [ 5 6 7
|
706
|
+
# [ 5 6 7
|
707
707
|
# 8 9 10 ]
|
708
708
|
# >> a.horzcat(b)
|
709
709
|
# => GSL::Matrix::Int
|
710
|
-
# [ 1 2 5 6 7
|
710
|
+
# [ 1 2 5 6 7
|
711
711
|
# 3 4 8 9 10 ]
|
712
712
|
#
|
713
713
|
# ---
|
714
714
|
# * GSL::Matrix#vertcat(other)
|
715
715
|
#
|
716
716
|
# Returns the vertical concatenation of <tt>self</tt> and <tt>other</tt>.
|
717
|
-
#
|
717
|
+
#
|
718
718
|
# Ex:
|
719
719
|
# >> a = GSL::Matrix::Int[1..4, 2, 2]
|
720
720
|
# => GSL::Matrix::Int
|
721
|
-
# [ 1 2
|
721
|
+
# [ 1 2
|
722
722
|
# 3 4 ]
|
723
723
|
# >> b = GSL::Matrix::Int[5..10, 3, 2]
|
724
724
|
# => GSL::Matrix::Int
|
725
|
-
# [ 5 6
|
726
|
-
# 7 8
|
725
|
+
# [ 5 6
|
726
|
+
# 7 8
|
727
727
|
# 9 10 ]
|
728
728
|
# >> a.vertcat(b)
|
729
729
|
# => GSL::Matrix::Int
|
730
|
-
# [ 1 2
|
731
|
-
# 3 4
|
732
|
-
# 5 6
|
733
|
-
# 7 8
|
730
|
+
# [ 1 2
|
731
|
+
# 3 4
|
732
|
+
# 5 6
|
733
|
+
# 7 8
|
734
734
|
# 9 10 ]
|
735
735
|
#
|
736
|
-
# ===
|
736
|
+
# === Matrix operations
|
737
737
|
#
|
738
738
|
# ---
|
739
739
|
# * GSL::Matrix#add(b)
|
740
740
|
# * GSL::Matrix#+(b)
|
741
741
|
#
|
742
|
-
# This method adds the elements of matrix <tt>b</tt>
|
743
|
-
# to the elements of the matrix.
|
744
|
-
# The two matrices must have the same dimensions.
|
742
|
+
# This method adds the elements of matrix <tt>b</tt>
|
743
|
+
# to the elements of the matrix.
|
744
|
+
# The two matrices must have the same dimensions.
|
745
745
|
#
|
746
746
|
# If <tt>b</tt> is a scalar, these methods add it to all the elements
|
747
747
|
# of the matrix <tt>self</tt> (equivalent to the method <tt>add_constant</tt>).
|
@@ -750,29 +750,29 @@
|
|
750
750
|
# * GSL::Matrix#sub(b)
|
751
751
|
# * GSL::Matrix#-(b)
|
752
752
|
#
|
753
|
-
# This method subtracts the elements of matrix <tt>b</tt>
|
754
|
-
# from the elements of the
|
755
|
-
# matrix. The two matrices must have the same dimensions.
|
753
|
+
# This method subtracts the elements of matrix <tt>b</tt>
|
754
|
+
# from the elements of the
|
755
|
+
# matrix. The two matrices must have the same dimensions.
|
756
756
|
#
|
757
757
|
# ---
|
758
758
|
# * GSL::Matrix#mul_elements(b)
|
759
759
|
#
|
760
|
-
# This method multiplies the elements of the matrix by the elements of
|
761
|
-
# matrix <tt>b</tt>. The two matrices must have the same dimensions.
|
762
|
-
# If <tt>b</tt> is a scalar, the method <tt>scale</tt> (see below)
|
760
|
+
# This method multiplies the elements of the matrix by the elements of
|
761
|
+
# matrix <tt>b</tt>. The two matrices must have the same dimensions.
|
762
|
+
# If <tt>b</tt> is a scalar, the method <tt>scale</tt> (see below)
|
763
763
|
# is called.
|
764
764
|
#
|
765
765
|
# ---
|
766
766
|
# * GSL::Matrix#div_elements(b)
|
767
767
|
#
|
768
768
|
#
|
769
|
-
# This method divides the elements of the matrix by the elements of
|
770
|
-
# matrix <tt>b</tt>. The two matrices must have the same dimensions.
|
769
|
+
# This method divides the elements of the matrix by the elements of
|
770
|
+
# matrix <tt>b</tt>. The two matrices must have the same dimensions.
|
771
771
|
#
|
772
772
|
# ---
|
773
773
|
# * GSL::Matrix#scale(x)
|
774
774
|
#
|
775
|
-
# This method multiplies the elements of the matrix by the constant
|
775
|
+
# This method multiplies the elements of the matrix by the constant
|
776
776
|
# factor <tt>x</tt>.
|
777
777
|
#
|
778
778
|
# ---
|
@@ -783,32 +783,32 @@
|
|
783
783
|
# ---
|
784
784
|
# * GSL::Matrix#*(b)
|
785
785
|
#
|
786
|
-
# Matrix multiplication.
|
786
|
+
# Matrix multiplication.
|
787
787
|
#
|
788
788
|
# Ex:
|
789
789
|
#
|
790
790
|
# >> a = GSL::Matrix[1..4, 2, 2]
|
791
|
-
# => GSL::Matrix
|
792
|
-
# [ 1.000e+00 2.000e+00
|
791
|
+
# => GSL::Matrix
|
792
|
+
# [ 1.000e+00 2.000e+00
|
793
793
|
# 3.000e+00 4.000e+00 ]
|
794
794
|
# >> b = GSL::Matrix[5..8, 2, 2]
|
795
|
-
# => GSL::Matrix
|
796
|
-
# [ 5.000e+00 6.000e+00
|
795
|
+
# => GSL::Matrix
|
796
|
+
# [ 5.000e+00 6.000e+00
|
797
797
|
# 7.000e+00 8.000e+00 ]
|
798
798
|
# >> a*b
|
799
|
-
# => GSL::Matrix
|
800
|
-
# [ 1.900e+01 2.200e+01
|
799
|
+
# => GSL::Matrix
|
800
|
+
# [ 1.900e+01 2.200e+01
|
801
801
|
# 4.300e+01 5.000e+01 ]
|
802
802
|
# >> a*2
|
803
|
-
# => GSL::Matrix
|
804
|
-
# [ 2.000e+00 4.000e+00
|
803
|
+
# => GSL::Matrix
|
804
|
+
# [ 2.000e+00 4.000e+00
|
805
805
|
# 6.000e+00 8.000e+00 ]
|
806
806
|
# >> c = Vector[1, 2]
|
807
|
-
# => GSL::Vector
|
807
|
+
# => GSL::Vector
|
808
808
|
# [ 1.000e+00 2.000e+00 ]
|
809
809
|
# >> a*c.col
|
810
|
-
# => GSL::Vector::Col
|
811
|
-
# [ 5.000e+00
|
810
|
+
# => GSL::Vector::Col
|
811
|
+
# [ 5.000e+00
|
812
812
|
# 1.100e+01 ]
|
813
813
|
#
|
814
814
|
# ---
|
@@ -819,26 +819,26 @@
|
|
819
819
|
# If a <tt>Vector::Col</tt> is given, this method solves the linear system
|
820
820
|
# by using LU decomposition.
|
821
821
|
#
|
822
|
-
# Ex:
|
822
|
+
# Ex:
|
823
823
|
# >> m = GSL::Matrix[1..4, 2, 2]
|
824
|
-
# => GSL::Matrix
|
825
|
-
# [ 1.000e+00 2.000e+00
|
824
|
+
# => GSL::Matrix
|
825
|
+
# [ 1.000e+00 2.000e+00
|
826
826
|
# 3.000e+00 4.000e+00 ]
|
827
827
|
# >> m/3
|
828
|
-
# => GSL::Matrix
|
828
|
+
# => GSL::Matrix
|
829
829
|
# [ 3.333e-01 6.667e-01 <--- 1/3, 2/3
|
830
830
|
# 1.000e+00 1.333e+00 ] <--- 3/3, 4/3
|
831
831
|
# >> b = Vector[5, 6].col
|
832
|
-
# => GSL::Vector::Col
|
833
|
-
# [ 5.000e+00
|
832
|
+
# => GSL::Vector::Col
|
833
|
+
# [ 5.000e+00
|
834
834
|
# 6.000e+00 ]
|
835
835
|
# >> x = m/b <--- Solve m (x,y) = b
|
836
|
-
# => GSL::Vector::Col
|
836
|
+
# => GSL::Vector::Col
|
837
837
|
# [ -4.000e+00 <--- x = -4
|
838
|
-
# 4.500e+00 ] <--- y = 4.5
|
838
|
+
# 4.500e+00 ] <--- y = 4.5
|
839
839
|
# >> m*x
|
840
840
|
# => GSL::Vector::Col
|
841
|
-
# [ 5.000e+00
|
841
|
+
# [ 5.000e+00
|
842
842
|
# 6.000e+00 ]
|
843
843
|
#
|
844
844
|
# ---
|
@@ -846,7 +846,7 @@
|
|
846
846
|
#
|
847
847
|
# Computes matrix power of <tt>b</tt>.
|
848
848
|
#
|
849
|
-
# ===
|
849
|
+
# === Finding maximum and minimum elements of matrices
|
850
850
|
#
|
851
851
|
# ---
|
852
852
|
# * GSL::Matrix#max
|
@@ -855,73 +855,73 @@
|
|
855
855
|
# These methods return the max/min value in the matrix.
|
856
856
|
#
|
857
857
|
# ---
|
858
|
-
# * GSL::Matrix#minmax
|
858
|
+
# * GSL::Matrix#minmax
|
859
859
|
#
|
860
|
-
# This method returns a two elements array [min, max],
|
860
|
+
# This method returns a two elements array [min, max],
|
861
861
|
# which contains the minimum
|
862
862
|
# and the maximum values in the matrix.
|
863
863
|
#
|
864
864
|
# ---
|
865
|
-
# * GSL::Matrix#max_index
|
866
|
-
# * GSL::Matrix#min_index
|
865
|
+
# * GSL::Matrix#max_index
|
866
|
+
# * GSL::Matrix#min_index
|
867
867
|
#
|
868
868
|
# These methods return the index of the max/min value in the matrix.
|
869
869
|
#
|
870
870
|
# ---
|
871
|
-
# * GSL::Matrix#minmax_index
|
871
|
+
# * GSL::Matrix#minmax_index
|
872
872
|
#
|
873
|
-
# This method returns a two elements array [imin, imax],
|
873
|
+
# This method returns a two elements array [imin, imax],
|
874
874
|
# which contains the indices
|
875
875
|
# of the minimum and the maximum value in the matrix.
|
876
876
|
#
|
877
|
-
# ===
|
877
|
+
# === Matrix properties
|
878
878
|
# ---
|
879
879
|
# * GSL::Matrix#isnull
|
880
880
|
#
|
881
|
-
# This returns 1 if all the elements of the matrix <tt>self</tt> are zero,
|
881
|
+
# This returns 1 if all the elements of the matrix <tt>self</tt> are zero,
|
882
882
|
# and 0 otherwise.
|
883
883
|
#
|
884
884
|
# ---
|
885
885
|
# * GSL::Matrix#isnull?
|
886
886
|
#
|
887
|
-
# This returns <tt>true</tt> if all the elements of the matrix <tt>self</tt>
|
887
|
+
# This returns <tt>true</tt> if all the elements of the matrix <tt>self</tt>
|
888
888
|
# are zero, and <tt>false</tt> otherwise.
|
889
889
|
#
|
890
890
|
# ---
|
891
891
|
# * GSL::Matrix#ispos
|
892
892
|
# * GSL::Matrix#ispos?
|
893
893
|
#
|
894
|
-
# (GSL-1.9 or later) Return 1 (true) if all the elements of the matrix <tt>self</tt> are strictly positive, and 0 (false) otherwise.
|
894
|
+
# (GSL-1.9 or later) Return 1 (true) if all the elements of the matrix <tt>self</tt> are strictly positive, and 0 (false) otherwise.
|
895
895
|
#
|
896
896
|
# ---
|
897
897
|
# * GSL::Matrix#isneg
|
898
898
|
# * GSL::Matrix#isneg?
|
899
899
|
#
|
900
|
-
# (GSL-1.9 or later) Return 1 (true) if all the elements of the matrix <tt>self</tt> are strictly negative, and 0 (false) otherwise.
|
900
|
+
# (GSL-1.9 or later) Return 1 (true) if all the elements of the matrix <tt>self</tt> are strictly negative, and 0 (false) otherwise.
|
901
901
|
#
|
902
902
|
# ---
|
903
903
|
# * GSL::Matrix#isnonneg
|
904
904
|
# * GSL::Matrix#isnonneg?
|
905
905
|
#
|
906
|
-
# (GSL-1.10 or later) Return 1 (true) if all the elements of the matrix <tt>self</tt> are non-negative , and 0 (false) otherwise.
|
906
|
+
# (GSL-1.10 or later) Return 1 (true) if all the elements of the matrix <tt>self</tt> are non-negative , and 0 (false) otherwise.
|
907
907
|
#
|
908
908
|
# ---
|
909
909
|
# * GSL::Matrix#any
|
910
910
|
#
|
911
|
-
# Returns a Vector of ones and zeros with each element indicating
|
912
|
-
# whether any of the elements of the corresponding column of the
|
911
|
+
# Returns a Vector of ones and zeros with each element indicating
|
912
|
+
# whether any of the elements of the corresponding column of the
|
913
913
|
# matrix are nonzero.
|
914
914
|
#
|
915
915
|
# ---
|
916
916
|
# * GSL::Matrix#all
|
917
917
|
#
|
918
|
-
# Behaves like the method <tt>any</tt>, except that it returns 1 only if
|
918
|
+
# Behaves like the method <tt>any</tt>, except that it returns 1 only if
|
919
919
|
# all the elements of the matrix.
|
920
920
|
#
|
921
921
|
# ---
|
922
922
|
# * GSL:Matrix#trace
|
923
923
|
#
|
924
|
-
# This returns trace of the matrix <tt>self</tt>, the sum of the diagonal
|
924
|
+
# This returns trace of the matrix <tt>self</tt>, the sum of the diagonal
|
925
925
|
# elements.
|
926
926
|
#
|
927
927
|
# ---
|
@@ -944,13 +944,13 @@
|
|
944
944
|
# Example:
|
945
945
|
# >> m = GSL::Matrix::Int[-5..4, 3, 3]
|
946
946
|
# => GSL::Matrix::Int
|
947
|
-
# [ -5 -4 -3
|
948
|
-
# -2 -1 0
|
947
|
+
# [ -5 -4 -3
|
948
|
+
# -2 -1 0
|
949
949
|
# 1 2 3 ]
|
950
950
|
# >> m.abs
|
951
951
|
# => GSL::Matrix::Int
|
952
|
-
# [ 5 4 3
|
953
|
-
# 2 1 0
|
952
|
+
# [ 5 4 3
|
953
|
+
# 2 1 0
|
954
954
|
# 1 2 3 ]
|
955
955
|
#
|
956
956
|
# ---
|
@@ -958,15 +958,15 @@
|
|
958
958
|
# * GSL::Matrix#==(other, eps = 1e-10)
|
959
959
|
#
|
960
960
|
# Returns <tt>true</tt> if the matrices have same size and elements
|
961
|
-
# equal to absolute accurary <tt>eps</tt> for all the indices,
|
961
|
+
# equal to absolute accurary <tt>eps</tt> for all the indices,
|
962
962
|
# and <tt>false</tt> otherwise.
|
963
963
|
#
|
964
|
-
# ==
|
964
|
+
# == NArray
|
965
965
|
#
|
966
966
|
# ---
|
967
967
|
# * GSL::Matrix#to_na
|
968
968
|
#
|
969
|
-
# The Matrix object <tt>self</tt> is converted into an <tt>NMatrix</tt> object.
|
969
|
+
# The Matrix object <tt>self</tt> is converted into an <tt>NMatrix</tt> object.
|
970
970
|
# The matrix data are copied to newly allocated memory.
|
971
971
|
#
|
972
972
|
# ---
|
@@ -979,13 +979,13 @@
|
|
979
979
|
# * NArray#to_gm_view
|
980
980
|
# * NArray#to_gslm_view
|
981
981
|
#
|
982
|
-
# A <tt>GSL::Matrix::View</tt> object is created from the NArray object <tt>na</tt>.
|
983
|
-
# The data of <tt>na</tt> are
|
984
|
-
# not copied, thus any modifications to the View object affect on the original
|
985
|
-
# NArray object <tt>na</tt>.
|
982
|
+
# A <tt>GSL::Matrix::View</tt> object is created from the NArray object <tt>na</tt>.
|
983
|
+
# The data of <tt>na</tt> are
|
984
|
+
# not copied, thus any modifications to the View object affect on the original
|
985
|
+
# NArray object <tt>na</tt>.
|
986
986
|
# The View object can be used as a reference to the NMatrix object.
|
987
987
|
#
|
988
|
-
# ==
|
988
|
+
# == Special matrices
|
989
989
|
# ---
|
990
990
|
# * GSL::Matrix.hirbert(n)
|
991
991
|
#
|
@@ -999,34 +999,34 @@
|
|
999
999
|
#
|
1000
1000
|
# Ex:
|
1001
1001
|
# >> m = GSL::Matrix.hilbert(4)
|
1002
|
-
# => GSL::Matrix
|
1003
|
-
# [ 1.000e+00 5.000e-01 3.333e-01 2.500e-01
|
1004
|
-
# 5.000e-01 3.333e-01 2.500e-01 2.000e-01
|
1005
|
-
# 3.333e-01 2.500e-01 2.000e-01 1.667e-01
|
1002
|
+
# => GSL::Matrix
|
1003
|
+
# [ 1.000e+00 5.000e-01 3.333e-01 2.500e-01
|
1004
|
+
# 5.000e-01 3.333e-01 2.500e-01 2.000e-01
|
1005
|
+
# 3.333e-01 2.500e-01 2.000e-01 1.667e-01
|
1006
1006
|
# 2.500e-01 2.000e-01 1.667e-01 1.429e-01 ]
|
1007
1007
|
# >> invm = GSL::Matrix.invhilbert(4)
|
1008
|
-
# => GSL::Matrix
|
1009
|
-
# [ 1.600e+01 -1.200e+02 2.400e+02 -1.400e+02
|
1010
|
-
# -1.200e+02 1.200e+03 -2.700e+03 1.680e+03
|
1011
|
-
# 2.400e+02 -2.700e+03 6.480e+03 -4.200e+03
|
1008
|
+
# => GSL::Matrix
|
1009
|
+
# [ 1.600e+01 -1.200e+02 2.400e+02 -1.400e+02
|
1010
|
+
# -1.200e+02 1.200e+03 -2.700e+03 1.680e+03
|
1011
|
+
# 2.400e+02 -2.700e+03 6.480e+03 -4.200e+03
|
1012
1012
|
# -1.400e+02 1.680e+03 -4.200e+03 2.800e+03 ]
|
1013
1013
|
# >> invm2 = m.inv
|
1014
|
-
# => GSL::Matrix
|
1015
|
-
# [ 1.600e+01 -1.200e+02 2.400e+02 -1.400e+02
|
1016
|
-
# -1.200e+02 1.200e+03 -2.700e+03 1.680e+03
|
1017
|
-
# 2.400e+02 -2.700e+03 6.480e+03 -4.200e+03
|
1014
|
+
# => GSL::Matrix
|
1015
|
+
# [ 1.600e+01 -1.200e+02 2.400e+02 -1.400e+02
|
1016
|
+
# -1.200e+02 1.200e+03 -2.700e+03 1.680e+03
|
1017
|
+
# 2.400e+02 -2.700e+03 6.480e+03 -4.200e+03
|
1018
1018
|
# -1.400e+02 1.680e+03 -4.200e+03 2.800e+03 ]
|
1019
1019
|
# >> m*invm
|
1020
|
-
# => GSL::Matrix
|
1021
|
-
# [ 1.000e+00 5.684e-14 -2.274e-13 1.137e-13
|
1022
|
-
# 1.998e-15 1.000e+00 -4.663e-14 3.109e-14
|
1023
|
-
# 3.664e-15 -7.239e-14 1.000e+00 -1.017e-13
|
1020
|
+
# => GSL::Matrix
|
1021
|
+
# [ 1.000e+00 5.684e-14 -2.274e-13 1.137e-13
|
1022
|
+
# 1.998e-15 1.000e+00 -4.663e-14 3.109e-14
|
1023
|
+
# 3.664e-15 -7.239e-14 1.000e+00 -1.017e-13
|
1024
1024
|
# -2.442e-15 1.510e-14 -8.038e-14 1.000e+00 ]
|
1025
1025
|
# >> m*invm2
|
1026
|
-
# => GSL::Matrix
|
1027
|
-
# [ 1.000e+00 0.000e+00 0.000e+00 0.000e+00
|
1028
|
-
# -1.554e-15 1.000e+00 -2.389e-14 8.349e-15
|
1029
|
-
# 1.295e-15 3.405e-15 1.000e+00 -6.957e-15
|
1026
|
+
# => GSL::Matrix
|
1027
|
+
# [ 1.000e+00 0.000e+00 0.000e+00 0.000e+00
|
1028
|
+
# -1.554e-15 1.000e+00 -2.389e-14 8.349e-15
|
1029
|
+
# 1.295e-15 3.405e-15 1.000e+00 -6.957e-15
|
1030
1030
|
# 1.110e-15 1.916e-14 1.707e-14 1.000e+00 ]
|
1031
1031
|
#
|
1032
1032
|
# ---
|
@@ -1035,23 +1035,23 @@
|
|
1035
1035
|
# Returns the Pascal matrix of order <tt>n</tt>, created from Pascal's triangle.
|
1036
1036
|
#
|
1037
1037
|
# >> GSL::Matrix::Int.pascal(10)
|
1038
|
-
# => GSL::Matrix::Int
|
1039
|
-
# [ 1 1 1 1 1 1 1 1 1 1
|
1040
|
-
# 1 2 3 4 5 6 7 8 9 10
|
1041
|
-
# 1 3 6 10 15 21 28 36 45 55
|
1042
|
-
# 1 4 10 20 35 56 84 120 165 220
|
1043
|
-
# 1 5 15 35 70 126 210 330 495 715
|
1044
|
-
# 1 6 21 56 126 252 462 792 1287 2002
|
1045
|
-
# 1 7 28 84 210 462 924 1716 3003 5005
|
1046
|
-
# 1 8 36 120 330 792 1716 3432 6435 11440
|
1047
|
-
# 1 9 45 165 495 1287 3003 6435 12870 24310
|
1038
|
+
# => GSL::Matrix::Int
|
1039
|
+
# [ 1 1 1 1 1 1 1 1 1 1
|
1040
|
+
# 1 2 3 4 5 6 7 8 9 10
|
1041
|
+
# 1 3 6 10 15 21 28 36 45 55
|
1042
|
+
# 1 4 10 20 35 56 84 120 165 220
|
1043
|
+
# 1 5 15 35 70 126 210 330 495 715
|
1044
|
+
# 1 6 21 56 126 252 462 792 1287 2002
|
1045
|
+
# 1 7 28 84 210 462 924 1716 3003 5005
|
1046
|
+
# 1 8 36 120 330 792 1716 3432 6435 11440
|
1047
|
+
# 1 9 45 165 495 1287 3003 6435 12870 24310
|
1048
1048
|
# 1 10 55 220 715 2002 5005 11440 24310 48620 ]
|
1049
1049
|
#
|
1050
1050
|
# ---
|
1051
1051
|
# * GSL::Matrix.vandermonde(v)
|
1052
1052
|
#
|
1053
1053
|
# Creates a Vendermonde matrix from a vector or an array <tt>v</tt>.
|
1054
|
-
#
|
1054
|
+
#
|
1055
1055
|
# >> GSL::Matrix.vander([1, 2, 3, 4])
|
1056
1056
|
# => GSL::Matrix
|
1057
1057
|
# [ 1.000e+00 1.000e+00 1.000e+00 1.000e+00
|
@@ -1063,31 +1063,31 @@
|
|
1063
1063
|
# * GSL::Matrix.toeplitz(v)
|
1064
1064
|
#
|
1065
1065
|
# Creates a Toeplitz matrix from a vector or an array <tt>v</tt>.
|
1066
|
-
#
|
1066
|
+
#
|
1067
1067
|
# >> GSL::Matrix::Int.toeplitz([1, 2, 3, 4, 5])
|
1068
|
-
# => GSL::Matrix::Int
|
1069
|
-
# [ 1 2 3 4 5
|
1070
|
-
# 2 1 2 3 4
|
1071
|
-
# 3 2 1 2 3
|
1072
|
-
# 4 3 2 1 2
|
1068
|
+
# => GSL::Matrix::Int
|
1069
|
+
# [ 1 2 3 4 5
|
1070
|
+
# 2 1 2 3 4
|
1071
|
+
# 3 2 1 2 3
|
1072
|
+
# 4 3 2 1 2
|
1073
1073
|
# 5 4 3 2 1 ]
|
1074
1074
|
#
|
1075
1075
|
# ---
|
1076
1076
|
# * GSL::Matrix.circulant(v)
|
1077
1077
|
#
|
1078
1078
|
# Creates a circulant matrix from a vector or an array <tt>v</tt>.
|
1079
|
-
#
|
1079
|
+
#
|
1080
1080
|
# >> GSL::Matrix::Int.circulant([1, 2, 3, 4])
|
1081
|
-
# => GSL::Matrix::Int
|
1082
|
-
# [ 4 1 2 3
|
1083
|
-
# 3 4 1 2
|
1084
|
-
# 2 3 4 1
|
1081
|
+
# => GSL::Matrix::Int
|
1082
|
+
# [ 4 1 2 3
|
1083
|
+
# 3 4 1 2
|
1084
|
+
# 2 3 4 1
|
1085
1085
|
# 1 2 3 4 ]
|
1086
1086
|
#
|
1087
|
-
# {prev}[link:
|
1088
|
-
# {next}[link:
|
1087
|
+
# {prev}[link:vector_rdoc.html]
|
1088
|
+
# {next}[link:perm_rdoc.html]
|
1089
1089
|
#
|
1090
|
-
# {Reference index}[link:
|
1090
|
+
# {Reference index}[link:ref_rdoc.html]
|
1091
1091
|
# {top}[link:index.html]
|
1092
|
-
#
|
1092
|
+
#
|
1093
1093
|
#
|