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/interp.rdoc
CHANGED
@@ -1,44 +1,44 @@
|
|
1
1
|
#
|
2
2
|
# = Interpolation
|
3
|
-
# This chapter describes functions for performing interpolation.
|
4
|
-
# The library provides a variety of interpolation methods, including
|
5
|
-
# Cubic splines and Akima splines. The interpolation types are interchangeable,
|
6
|
-
# allowing different methods to be used without recompiling. Interpolations can
|
7
|
-
# be defined for both normal and periodic boundary conditions. Additional
|
8
|
-
# functions are available for computing derivatives and integrals of
|
9
|
-
# interpolating functions.
|
10
|
-
#
|
11
|
-
# 1. {Interpolation classes}[link:
|
12
|
-
# 1. {Initializing interpolation objects}[link:
|
13
|
-
# 1. {Index Look-up and Acceleration}[link:
|
14
|
-
# 1. {Evaluation of Interpolating Functions}[link:
|
15
|
-
# 1. {Higher level interface: GSL::Spline class}[link:
|
16
|
-
# 1. {Class initialization}[link:
|
17
|
-
# 1. {Evaluation}[link:
|
18
|
-
# 1. {Finding and acceleration}[link:
|
19
|
-
#
|
20
|
-
# ==
|
3
|
+
# This chapter describes functions for performing interpolation.
|
4
|
+
# The library provides a variety of interpolation methods, including
|
5
|
+
# Cubic splines and Akima splines. The interpolation types are interchangeable,
|
6
|
+
# allowing different methods to be used without recompiling. Interpolations can
|
7
|
+
# be defined for both normal and periodic boundary conditions. Additional
|
8
|
+
# functions are available for computing derivatives and integrals of
|
9
|
+
# interpolating functions.
|
10
|
+
#
|
11
|
+
# 1. {Interpolation classes}[link:interp_rdoc.html#label-Interpolation+Classes]
|
12
|
+
# 1. {Initializing interpolation objects}[link:interp_rdoc.html#label-Initializing+interpolation+objects]
|
13
|
+
# 1. {Index Look-up and Acceleration}[link:interp_rdoc.html#label-Index+Look-up+and+Acceleration]
|
14
|
+
# 1. {Evaluation of Interpolating Functions}[link:interp_rdoc.html#label-Evaluation+of+Interpolating+Functions]
|
15
|
+
# 1. {Higher level interface: GSL::Spline class}[link:interp_rdoc.html#label-Higher+level+interface]
|
16
|
+
# 1. {Class initialization}[link:interp_rdoc.html#label-Class+initialization]
|
17
|
+
# 1. {Evaluation}[link:interp_rdoc.html#label-Evaluation]
|
18
|
+
# 1. {Finding and acceleration}[link:interp_rdoc.html#label-Finding+and+acceleration]
|
19
|
+
#
|
20
|
+
# == Interpolation Classes
|
21
21
|
# * GSL
|
22
22
|
# * Interp (class)
|
23
23
|
# * Accel (class)
|
24
24
|
# * Spline (class)
|
25
|
-
#
|
26
|
-
# ==
|
25
|
+
#
|
26
|
+
# == Initializing interpolation objects
|
27
27
|
#
|
28
28
|
# ---
|
29
29
|
# * GSL::Interp.alloc(T, n)
|
30
30
|
# * GSL::Interp.alloc(T, x, y)
|
31
31
|
# * GSL::Interp.alloc(x, y)
|
32
32
|
#
|
33
|
-
# These methods create an interpolation object of type <tt>T</tt> for <tt>n</tt>
|
33
|
+
# These methods create an interpolation object of type <tt>T</tt> for <tt>n</tt>
|
34
34
|
# data-points.
|
35
35
|
#
|
36
|
-
# The library provides six types, which are specifiled by an identifier of a
|
36
|
+
# The library provides six types, which are specifiled by an identifier of a
|
37
37
|
# constant or a string:
|
38
38
|
#
|
39
39
|
# * Interp::LINEAR or "linear"
|
40
40
|
#
|
41
|
-
# Linear interpolation. This interpolation method does not require any additional memory.
|
41
|
+
# Linear interpolation. This interpolation method does not require any additional memory.
|
42
42
|
# * Interp::POLYNOMIAL or "polynomial"
|
43
43
|
#
|
44
44
|
# Polynomial interpolation. This method should only be used for interpolating small numbers of points because polynomial interpolation introduces large oscillations, even for well-behaved datasets. The number of terms in the interpolating polynomial is equal to the number of points.
|
@@ -49,24 +49,24 @@
|
|
49
49
|
# * Interp::CSPLINE_PERIODIC or "gsl_cspline_periodic" or "cspline_periodic"
|
50
50
|
#
|
51
51
|
# Cubic spline with periodic boundary conditions
|
52
|
-
# * Interp::AKIMA or "akima"
|
52
|
+
# * Interp::AKIMA or "akima"
|
53
53
|
#
|
54
54
|
# Non-rounded Akima spline with natural boundary conditions. This method uses the non-rounded corner algorithm of Wodicka.
|
55
|
-
# * Interp::AKIMA_PERIODIC or "akima_periodic"
|
55
|
+
# * Interp::AKIMA_PERIODIC or "akima_periodic"
|
56
56
|
#
|
57
57
|
# Non-rounded Akima spline with periodic boundary conditions. This method uses the non-rounded corner algorithm of Wodicka.
|
58
|
-
#
|
58
|
+
#
|
59
59
|
# * ex: For cubic spline for 10 points,
|
60
60
|
# sp = Interp.alloc("cspline", 10)
|
61
61
|
#
|
62
62
|
# ---
|
63
63
|
# * GSL::Interp#init(xa, ya)
|
64
64
|
#
|
65
|
-
# This method initializes the interpolation object interp for the data
|
66
|
-
# <tt>(xa,ya)</tt> where <tt>xa</tt> and <tt>ya</tt> are vectors.
|
67
|
-
# The interpolation object (<tt>GSL::Interp</tt>) does not save the data
|
68
|
-
# vectors <tt>xa, ya</tt> and only stores the static state computed from the data.
|
69
|
-
# The <tt>xa</tt> vector is always assumed to be strictly ordered; the behavior
|
65
|
+
# This method initializes the interpolation object interp for the data
|
66
|
+
# <tt>(xa,ya)</tt> where <tt>xa</tt> and <tt>ya</tt> are vectors.
|
67
|
+
# The interpolation object (<tt>GSL::Interp</tt>) does not save the data
|
68
|
+
# vectors <tt>xa, ya</tt> and only stores the static state computed from the data.
|
69
|
+
# The <tt>xa</tt> vector is always assumed to be strictly ordered; the behavior
|
70
70
|
# for other arrangements is not defined.
|
71
71
|
#
|
72
72
|
#
|
@@ -80,27 +80,27 @@
|
|
80
80
|
# ---
|
81
81
|
# * GSL::Interp#min_size
|
82
82
|
#
|
83
|
-
# This returns the minimum number of points required by the interpolation
|
84
|
-
# type of <tt>self</tt>. For example, Akima spline interpolation requires
|
83
|
+
# This returns the minimum number of points required by the interpolation
|
84
|
+
# type of <tt>self</tt>. For example, Akima spline interpolation requires
|
85
85
|
# a minimum of 5 points.
|
86
86
|
#
|
87
|
-
# ==
|
87
|
+
# == Index Look-up and Acceleration
|
88
88
|
# ---
|
89
89
|
# * GSL::Interp.bsearch(xa, x, index_lo, index_hi)
|
90
90
|
#
|
91
|
-
# This returns the index i of the vector <tt>xa</tt> such that
|
92
|
-
# <tt>xa[i] <= x < x[i+1]</tt>. The index is searched for in the range
|
91
|
+
# This returns the index i of the vector <tt>xa</tt> such that
|
92
|
+
# <tt>xa[i] <= x < x[i+1]</tt>. The index is searched for in the range
|
93
93
|
# <tt>[index_lo,index_hi]</tt>.
|
94
94
|
#
|
95
95
|
#
|
96
96
|
# ---
|
97
97
|
# * GSL::Interp#accel
|
98
98
|
#
|
99
|
-
# In C level, the library requires a <tt>gsl_interp_accel</tt> object,
|
100
|
-
# but it is hidden in Ruby/GSL. It is automatically allocated
|
101
|
-
# when a <tt>GSL::Interp</tt> object is created, stored in it,
|
102
|
-
# and destroyed when the <tt>Interp</tt> object
|
103
|
-
# is cleaned by the Ruby GC.
|
99
|
+
# In C level, the library requires a <tt>gsl_interp_accel</tt> object,
|
100
|
+
# but it is hidden in Ruby/GSL. It is automatically allocated
|
101
|
+
# when a <tt>GSL::Interp</tt> object is created, stored in it,
|
102
|
+
# and destroyed when the <tt>Interp</tt> object
|
103
|
+
# is cleaned by the Ruby GC.
|
104
104
|
# This method is used to access to the <tt>Interp::Accel</tt> object
|
105
105
|
# stored in <tt>self</tt>.
|
106
106
|
#
|
@@ -109,54 +109,54 @@
|
|
109
109
|
# * GSL::Interp#accel_find(xa, x)
|
110
110
|
# * GSL::Interp::Accel#find(xa, x)
|
111
111
|
#
|
112
|
-
# This method performs a lookup action on the data array <tt>xa</tt>.
|
113
|
-
# This is how lookups are performed during evaluation
|
114
|
-
# of an interpolation. The function returns an index <tt>i</tt> such that
|
112
|
+
# This method performs a lookup action on the data array <tt>xa</tt>.
|
113
|
+
# This is how lookups are performed during evaluation
|
114
|
+
# of an interpolation. The function returns an index <tt>i</tt> such that
|
115
115
|
# <tt>xa[i] <= x < xa[i+1]</tt>.
|
116
116
|
#
|
117
117
|
#
|
118
|
-
# ==
|
118
|
+
# == Evaluation of Interpolating Functions
|
119
119
|
#
|
120
120
|
# ---
|
121
121
|
# * GSL::Interp#eval(xa, ya, x)
|
122
122
|
# * GSL::Interp#eval_e(xa, ya, x)
|
123
123
|
#
|
124
|
-
# These methods return the interpolated value for a given point <tt>x</tt>,
|
124
|
+
# These methods return the interpolated value for a given point <tt>x</tt>,
|
125
125
|
# using the interpolation object <tt>self</tt>, data vectors <tt>xa</tt> and <tt>ya</tt>.
|
126
126
|
# The data <tt>x</tt> can be a <tt>Numeric, Vector, Matrix</tt> or an <tt>NArray</tt>.
|
127
127
|
# ---
|
128
128
|
# * GSL::Interp#eval_deriv(xa, ya, x)
|
129
129
|
# * GSL::Interp#eval_deriv_e(xa, ya, x)
|
130
130
|
#
|
131
|
-
# These methods return the derivative of an interpolated function for a
|
132
|
-
# given point <tt>x</tt>, using the interpolation object <tt>self</tt>,
|
131
|
+
# These methods return the derivative of an interpolated function for a
|
132
|
+
# given point <tt>x</tt>, using the interpolation object <tt>self</tt>,
|
133
133
|
# data vectors <tt>xa</tt> and <tt>ya</tt>.
|
134
134
|
#
|
135
135
|
# ---
|
136
136
|
# * GSL::Interp#eval_deriv2(xa, ya, x)
|
137
137
|
# * GSL::Interp#eval_deriv2_e(xa, ya, x)
|
138
138
|
#
|
139
|
-
# These methods return the second derivative of an interpolated function
|
140
|
-
# for a given point <tt>x</tt>, using the interpolation object <tt>self</tt>,
|
139
|
+
# These methods return the second derivative of an interpolated function
|
140
|
+
# for a given point <tt>x</tt>, using the interpolation object <tt>self</tt>,
|
141
141
|
# data vectors <tt>xa</tt> and <tt>ya</tt>.
|
142
142
|
#
|
143
143
|
# ---
|
144
144
|
# * GSL::Interp#eval_integ(xa, ya, a, b)
|
145
145
|
# * GSL::Interp#eval_integ_e(xa, ya, a, b)
|
146
146
|
#
|
147
|
-
# These methods return the numerical integral result of an interpolated
|
148
|
-
# function over the range <tt>[a, b]</tt>, using the interpolation object <tt>self</tt>,
|
147
|
+
# These methods return the numerical integral result of an interpolated
|
148
|
+
# function over the range <tt>[a, b]</tt>, using the interpolation object <tt>self</tt>,
|
149
149
|
# data vectors <tt>xa</tt> and <tt>ya</tt>.
|
150
150
|
#
|
151
|
-
# ==
|
152
|
-
# ===
|
151
|
+
# == Higher level interface
|
152
|
+
# === Class initialization
|
153
153
|
#
|
154
154
|
# ---
|
155
155
|
# * GSL::Spline.alloc(T, n)
|
156
156
|
# * GSL::Spline.alloc(T, x, y)
|
157
157
|
# * GSL::Spline.alloc(x, y, T)
|
158
158
|
#
|
159
|
-
# This creates a <tt>GSL::Spline</tt> object of type <tt>T</tt> for <tt>n</tt>
|
159
|
+
# This creates a <tt>GSL::Spline</tt> object of type <tt>T</tt> for <tt>n</tt>
|
160
160
|
# data-points. The type <tt>T</tt> is the same as <tt>GSL::Interp</tt> class.
|
161
161
|
#
|
162
162
|
# These two are equivalent.
|
@@ -170,8 +170,8 @@
|
|
170
170
|
# ---
|
171
171
|
# * GSL::Spline#init(xa, ya)
|
172
172
|
#
|
173
|
-
# This initializes a <tt>GSL::Spline</tt> object <tt>self</tt> for the data
|
174
|
-
# (<tt>xa, ya</tt>) where <tt>xa</tt> and <tt>ya</tt> are Ruby arrays of equal sizes
|
173
|
+
# This initializes a <tt>GSL::Spline</tt> object <tt>self</tt> for the data
|
174
|
+
# (<tt>xa, ya</tt>) where <tt>xa</tt> and <tt>ya</tt> are Ruby arrays of equal sizes
|
175
175
|
# or <tt>GSL::Vector</tt>.
|
176
176
|
#
|
177
177
|
# ---
|
@@ -179,7 +179,7 @@
|
|
179
179
|
#
|
180
180
|
# This returns the name of the spline type used by <tt>self</tt>.
|
181
181
|
#
|
182
|
-
# ===
|
182
|
+
# === Evaluation
|
183
183
|
# ---
|
184
184
|
# * GSL::Spline#eval(x)
|
185
185
|
#
|
@@ -188,10 +188,10 @@
|
|
188
188
|
#
|
189
189
|
# NOTE: In a GSL-C program, a <tt>gsl_interp_accel</tt> object is required to use
|
190
190
|
# the function <tt>gsl_spline_eval</tt>.
|
191
|
-
# In Ruby/GSL, the <tt>gsl_interp_accel</tt> is hidden, it is automatically
|
192
|
-
# allocated when a <tt>GSL::Spline</tt> object is created,
|
193
|
-
# and also destroyed when the <tt>Spline</tt> object
|
194
|
-
# is cleaned by the Ruby GC. The accel object can be accessed via the method
|
191
|
+
# In Ruby/GSL, the <tt>gsl_interp_accel</tt> is hidden, it is automatically
|
192
|
+
# allocated when a <tt>GSL::Spline</tt> object is created,
|
193
|
+
# and also destroyed when the <tt>Spline</tt> object
|
194
|
+
# is cleaned by the Ruby GC. The accel object can be accessed via the method
|
195
195
|
# <tt>GSL::Spline#accel</tt>.
|
196
196
|
#
|
197
197
|
# ---
|
@@ -209,23 +209,23 @@
|
|
209
209
|
#
|
210
210
|
# Returns the numerical integral over the range [<tt>a, b</tt>].
|
211
211
|
#
|
212
|
-
# ===
|
212
|
+
# === Finding and acceleration
|
213
213
|
# ---
|
214
214
|
# * GSL::Spline#find(xa, x)
|
215
215
|
# * GSL::Spline#accel_find(xa, x)
|
216
216
|
#
|
217
|
-
# This method performs a lookup action on the data array <tt>xa</tt>.
|
218
|
-
# This is how lookups are performed during evaluation
|
219
|
-
# of an interpolation. The function returns an index <tt>i</tt> such that
|
217
|
+
# This method performs a lookup action on the data array <tt>xa</tt>.
|
218
|
+
# This is how lookups are performed during evaluation
|
219
|
+
# of an interpolation. The function returns an index <tt>i</tt> such that
|
220
220
|
# <tt>xa[i] <= x < xa[i+1]</tt>.
|
221
221
|
#
|
222
222
|
# See also the GSL manual and the examples in <tt>examples/</tt>
|
223
223
|
#
|
224
|
-
# {prev}[link:
|
225
|
-
# {next}[link:
|
224
|
+
# {prev}[link:odeiv_rdoc.html]
|
225
|
+
# {next}[link:diff_rdoc.html]
|
226
226
|
#
|
227
|
-
# {Reference index}[link:
|
227
|
+
# {Reference index}[link:ref_rdoc.html]
|
228
228
|
# {top}[link:index.html]
|
229
229
|
#
|
230
230
|
#
|
231
|
-
#
|
231
|
+
#
|
data/rdoc/intro.rdoc
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
#
|
2
2
|
# = Introduction
|
3
3
|
#
|
4
|
-
# The GNU Scientific Library ({GSL}[
|
4
|
+
# The GNU Scientific Library ({GSL}[https://gnu.org/software/gsl/])
|
5
5
|
# is a collection of routines for numerical computing.
|
6
6
|
# The routines have been written from scratch in C, and present a modern Applications
|
7
7
|
# Programming Interface (API) for C programmers, allowing wrappers to be
|
8
8
|
# written for very high level languages. The source code is distributed
|
9
9
|
# under the GNU General Public License.
|
10
10
|
#
|
11
|
-
# {Ruby/GSL}[
|
11
|
+
# {Ruby/GSL}[https://blackwinter.github.com/rb-gsl] is a Ruby
|
12
12
|
# extension for GSL. This provides higher-level interfaces to the GSL functions.
|
13
13
|
#
|
14
|
-
# ==
|
14
|
+
# == Requirements
|
15
15
|
# * GSL (1.4 or later recommended)
|
16
16
|
# * ANSI C compiler
|
17
17
|
# * Ruby (1.8 or later recommended)
|
18
18
|
#
|
19
|
-
# ==
|
19
|
+
# == Installation
|
20
20
|
# See {here}[link:index.html].
|
21
21
|
#
|
22
|
-
# {next}[link:
|
22
|
+
# {next}[link:use_rdoc.html]
|
23
23
|
#
|
24
|
-
# {Reference index}[link:
|
24
|
+
# {Reference index}[link:ref_rdoc.html]
|
25
25
|
# {top}[link:index.html]
|
26
26
|
#
|
27
27
|
#
|
data/rdoc/linalg.rdoc
CHANGED
@@ -2,23 +2,23 @@
|
|
2
2
|
# = Linear Algebra
|
3
3
|
#
|
4
4
|
# Contents:
|
5
|
-
# 1. {LU Decomposition}[link:
|
6
|
-
# 1. {QR Decomposition}[link:
|
7
|
-
# 1. {QR Decomposition with Column Pivoting}[link:
|
8
|
-
# 1. {Singular Value Decomposition}[link:
|
9
|
-
# 1. {Cholesky Decomposition}[link:
|
10
|
-
# 1. {Tridiagonal Decomposition of Real Symmetric Matrices}[link:
|
11
|
-
# 1. {Tridiagonal Decomposition of Hermitian Matrices}[link:
|
12
|
-
# 1. {Hessenberg Decomposition of Real Matrices}[link:
|
13
|
-
# 1. {Hessenberg-Triangular Decomposition of Real Matrices}[link:
|
14
|
-
# 1. {Bidiagonalization}[link:
|
15
|
-
# 1. {Householder Transformations}[link:
|
16
|
-
# 1. {Householder solver for linear systems}[link:
|
17
|
-
# 1. {Tridiagonal Systems}[link:
|
18
|
-
# 1. {Balancing}[link:
|
19
|
-
# 1. {NArray}[link:
|
20
|
-
#
|
21
|
-
# ==
|
5
|
+
# 1. {LU Decomposition}[link:linalg_rdoc.html#label-LU+Decomposition]
|
6
|
+
# 1. {QR Decomposition}[link:linalg_rdoc.html#label-QR+decomposition]
|
7
|
+
# 1. {QR Decomposition with Column Pivoting}[link:linalg_rdoc.html#label-QR+Decomposition+with+Column+Pivoting]
|
8
|
+
# 1. {Singular Value Decomposition}[link:linalg_rdoc.html#label-Singular+Value+Decomposition]
|
9
|
+
# 1. {Cholesky Decomposition}[link:linalg_rdoc.html#label-Cholesky+Decomposition]
|
10
|
+
# 1. {Tridiagonal Decomposition of Real Symmetric Matrices}[link:linalg_rdoc.html#label-Tridiagonal+Decomposition+of+Real+Symmetric+Matrices]
|
11
|
+
# 1. {Tridiagonal Decomposition of Hermitian Matrices}[link:linalg_rdoc.html#label-Tridiagonal+Decomposition+of+Hermitian+Matrices]
|
12
|
+
# 1. {Hessenberg Decomposition of Real Matrices}[link:linalg_rdoc.html#label-Hessenberg+Decomposition+of+Real+Matrices]
|
13
|
+
# 1. {Hessenberg-Triangular Decomposition of Real Matrices}[link:linalg_rdoc.html#label-Hessenberg-Triangular+Decomposition+of+Real+Matrices]
|
14
|
+
# 1. {Bidiagonalization}[link:linalg_rdoc.html#label-Bidiagonalization]
|
15
|
+
# 1. {Householder Transformations}[link:linalg_rdoc.html#label-Householder+Transformations]
|
16
|
+
# 1. {Householder solver for linear systems}[link:linalg_rdoc.html#label-Householder+solver+for+linear+systems]
|
17
|
+
# 1. {Tridiagonal Systems}[link:linalg_rdoc.html#label-Tridiagonal+Systems]
|
18
|
+
# 1. {Balancing}[link:linalg_rdoc.html#label-Balancing]
|
19
|
+
# 1. {NArray}[link:linalg_rdoc.html#label-NArray]
|
20
|
+
#
|
21
|
+
# == LU Decomposition
|
22
22
|
# ---
|
23
23
|
# * GSL::Linalg::LU.decomp(A)
|
24
24
|
# * GSL::Matrix#LU_decomp
|
@@ -31,9 +31,9 @@
|
|
31
31
|
# 1. Singleton method of the <tt>GSL::Linalg::LU</tt> module
|
32
32
|
#
|
33
33
|
# >> m = Matrix[1..9, 3, 3]
|
34
|
-
# => GSL::Matrix:
|
35
|
-
# [ 1.000e+00 2.000e+00 3.000e+00
|
36
|
-
# 4.000e+00 5.000e+00 6.000e+00
|
34
|
+
# => GSL::Matrix:
|
35
|
+
# [ 1.000e+00 2.000e+00 3.000e+00
|
36
|
+
# 4.000e+00 5.000e+00 6.000e+00
|
37
37
|
# 7.000e+00 8.000e+00 9.000e+00 ]
|
38
38
|
# >> lu, perm, sign = Linalg::LU.decomp(m)
|
39
39
|
#
|
@@ -47,7 +47,7 @@
|
|
47
47
|
# * GSL::Matrix#LU_solve(b)
|
48
48
|
# * GSL::Linalg::LUMatrix#solve(perm, b)
|
49
49
|
#
|
50
|
-
# The following is an example to solve a linear system
|
50
|
+
# The following is an example to solve a linear system
|
51
51
|
#
|
52
52
|
# A x = b, b = [1, 2, 3, 4]
|
53
53
|
#
|
@@ -57,20 +57,20 @@
|
|
57
57
|
#
|
58
58
|
# A = Matrix[[0.18, 0.60, 0.57, 0.96], [0.41, 0.24, 0.99, 0.58],
|
59
59
|
# [0.14, 0.30, 0.97, 0.66], [0.51, 0.13, 0.19, 0.85]]
|
60
|
-
# lu, perm, sign = A.LU_decomp
|
60
|
+
# lu, perm, sign = A.LU_decomp
|
61
61
|
# b = Vector[1, 2, 3, 4]
|
62
|
-
# x = Linalg::LU.solve(lu, perm, b)
|
62
|
+
# x = Linalg::LU.solve(lu, perm, b)
|
63
63
|
#
|
64
64
|
# 1. Instance method of <tt>GSL::Linalg::LUMatrix</tt> class
|
65
65
|
#
|
66
66
|
# lu, perm, sign = A.LU_decomp # lu is an instance of Linalg::LUMatrix class
|
67
67
|
# b = Vector[1, 2, 3, 4]
|
68
|
-
# x = lu.solve(perm, b)
|
68
|
+
# x = lu.solve(perm, b)
|
69
69
|
#
|
70
70
|
# 1. Solve directly
|
71
71
|
#
|
72
72
|
# x = Linalg::LU.solve(A, b) # LU decomposition is calculated internally (A is not modified)
|
73
|
-
#
|
73
|
+
#
|
74
74
|
# ---
|
75
75
|
# * GSL::Linalg::LU.svx(A, b)
|
76
76
|
# * GSL::Linalg::LU.svx(lu, perm, b)
|
@@ -83,7 +83,7 @@
|
|
83
83
|
# ---
|
84
84
|
# * GSL::Linalg::LU.refine(A, lu, perm, b, x)
|
85
85
|
#
|
86
|
-
# This method applys an iterative improvement to <tt>x</tt>,
|
86
|
+
# This method applys an iterative improvement to <tt>x</tt>,
|
87
87
|
# the solution of <tt>A x = b</tt>, using the LU decomposition of <tt>A</tt>.
|
88
88
|
#
|
89
89
|
# ---
|
@@ -102,9 +102,9 @@
|
|
102
102
|
#
|
103
103
|
# These methods return the determinant of the matrix.
|
104
104
|
#
|
105
|
-
# === {
|
105
|
+
# === {Complex LU decomposition}[link:linalg_complex_rdoc.html]
|
106
106
|
#
|
107
|
-
# ==
|
107
|
+
# == QR decomposition
|
108
108
|
#
|
109
109
|
# ---
|
110
110
|
# * GSL::Linalg::QR_decomp(A)
|
@@ -142,7 +142,7 @@
|
|
142
142
|
# * Ex4:
|
143
143
|
# qr, tau = m.QR_decomp
|
144
144
|
# x = qr.solve(tau, b)
|
145
|
-
#
|
145
|
+
#
|
146
146
|
# ---
|
147
147
|
# * GSL::Linalg::QR.svx(A, x)
|
148
148
|
# * GSL::Linalg::QR.svx(QR, tau, x)
|
@@ -161,26 +161,26 @@
|
|
161
161
|
#
|
162
162
|
# Ex:
|
163
163
|
# >> m = Matrix[1..9, 3, 3]
|
164
|
-
# => GSL::Matrix:
|
165
|
-
# [ 1.000e+00 2.000e+00 3.000e+00
|
166
|
-
# 4.000e+00 5.000e+00 6.000e+00
|
164
|
+
# => GSL::Matrix:
|
165
|
+
# [ 1.000e+00 2.000e+00 3.000e+00
|
166
|
+
# 4.000e+00 5.000e+00 6.000e+00
|
167
167
|
# 7.000e+00 8.000e+00 9.000e+00 ]
|
168
168
|
# >> qr, tau = m.QR_decomp
|
169
|
-
# >> q, r = qr.unpack(tau)
|
169
|
+
# >> q, r = qr.unpack(tau)
|
170
170
|
# >> q*r # Reconstruct the metrix m
|
171
|
-
# => GSL::Matrix:
|
172
|
-
# [ 1.000e+00 2.000e+00 3.000e+00
|
173
|
-
# 4.000e+00 5.000e+00 6.000e+00
|
171
|
+
# => GSL::Matrix:
|
172
|
+
# [ 1.000e+00 2.000e+00 3.000e+00
|
173
|
+
# 4.000e+00 5.000e+00 6.000e+00
|
174
174
|
# 7.000e+00 8.000e+00 9.000e+00 ]
|
175
175
|
#
|
176
176
|
# ---
|
177
177
|
# * GSL::Linalg::QR.QRsolve(Q, R, tau)
|
178
178
|
#
|
179
|
-
# This method solves the system <tt>R x = Q^T b</tt> for <tt>x</tt>.
|
180
|
-
# It can be used when the QR decomposition of a matrix is available
|
179
|
+
# This method solves the system <tt>R x = Q^T b</tt> for <tt>x</tt>.
|
180
|
+
# It can be used when the QR decomposition of a matrix is available
|
181
181
|
# in unpacked form as <tt>Q,R</tt>.
|
182
182
|
#
|
183
|
-
# ==
|
183
|
+
# == QR Decomposition with Column Pivoting
|
184
184
|
# ---
|
185
185
|
# * GSL::Linalg::QRPT.decomp(A)
|
186
186
|
# * GSL::Matrix#QRPT_decomp
|
@@ -214,7 +214,7 @@
|
|
214
214
|
# * GSL::Matrix#QRPT_solve(A, b)
|
215
215
|
# * GSL::Linalg::QRPQMatrix#solve(qr, tau, perm, b)
|
216
216
|
#
|
217
|
-
# These methods solve the system <tt>A x = b</tt> using the QRP^T decomposition of
|
217
|
+
# These methods solve the system <tt>A x = b</tt> using the QRP^T decomposition of
|
218
218
|
# <tt>A</tt> into <tt>QR, tau, perm</tt>. The solution <tt>x</tt> is returned as a Vector.
|
219
219
|
#
|
220
220
|
# * Ex1:
|
@@ -234,15 +234,15 @@
|
|
234
234
|
# * GSL::Linalg::QRPT.svx(qr, tau, perm, b)
|
235
235
|
# * GSL::Matrix#QRPT_svx(A, b)
|
236
236
|
#
|
237
|
-
# These methods solve the system <tt>A x = b</tt> using the QRP^T decomposition of
|
237
|
+
# These methods solve the system <tt>A x = b</tt> using the QRP^T decomposition of
|
238
238
|
# <tt>A</tt> into <tt>QR, tau, perm</tt>. The input <tt>b</tt> is overwritten by the solution
|
239
239
|
# <tt>x</tt>.
|
240
240
|
#
|
241
241
|
# ---
|
242
242
|
# * GSL::Linalg::QRPT.QRsolve(q, r, tau, perm, b)
|
243
243
|
#
|
244
|
-
# This method solves the system <tt>R P^T x = Q^T b</tt> for x.
|
245
|
-
# It can be used when the QR decomposition of a matrix is available in
|
244
|
+
# This method solves the system <tt>R P^T x = Q^T b</tt> for x.
|
245
|
+
# It can be used when the QR decomposition of a matrix is available in
|
246
246
|
# unpacked form as <tt>q, r</tt> obtained by the method <tt>decomp2</tt>.
|
247
247
|
#
|
248
248
|
# * Ex:
|
@@ -257,51 +257,51 @@
|
|
257
257
|
# * GSL::Linalg::QRPTMatrix#Rsvx(perm, b)
|
258
258
|
#
|
259
259
|
#
|
260
|
-
# ==
|
260
|
+
# == Singular Value Decomposition
|
261
261
|
# ---
|
262
262
|
# * GSL::Linalg::SV.decomp(A[, work])
|
263
|
-
# * GSL::Matrix#SV_decomp([work])
|
263
|
+
# * \GSL::Matrix#SV_decomp([work])
|
264
264
|
#
|
265
|
-
# These methods factorize the M-by-N matrix <tt>A</tt> into the singular value
|
265
|
+
# These methods factorize the M-by-N matrix <tt>A</tt> into the singular value
|
266
266
|
# decomposition <tt>A = U S V^T</tt> using the Golub-Reinsch SVD algorithm,
|
267
267
|
# and return an array <tt>[U, V, S]</tt>.
|
268
268
|
#
|
269
|
-
# Ex:
|
269
|
+
# Ex:
|
270
270
|
# >> m = Matrix[[3, 5, 2], [5, 1, 4], [7, 6, 3]]
|
271
|
-
# => GSL::Matrix:
|
272
|
-
# [ 3.000e+00 5.000e+00 2.000e+00
|
273
|
-
# 5.000e+00 1.000e+00 4.000e+00
|
271
|
+
# => GSL::Matrix:
|
272
|
+
# [ 3.000e+00 5.000e+00 2.000e+00
|
273
|
+
# 5.000e+00 1.000e+00 4.000e+00
|
274
274
|
# 7.000e+00 6.000e+00 3.000e+00 ]
|
275
275
|
# >> u, v, s = m.SV_decomp # u, v: Matrix, s: Vector (singular values)
|
276
276
|
# >> u*u.trans # u is orthnormal
|
277
|
-
# => GSL::Matrix:
|
278
|
-
# [ 1.000e+00 2.452e-17 -4.083e-16
|
279
|
-
# 2.452e-17 1.000e+00 -3.245e-16
|
277
|
+
# => GSL::Matrix:
|
278
|
+
# [ 1.000e+00 2.452e-17 -4.083e-16
|
279
|
+
# 2.452e-17 1.000e+00 -3.245e-16
|
280
280
|
# -4.083e-16 -3.245e-16 1.000e+00 ]
|
281
281
|
# >> v*v.trans # v is also orthnormal
|
282
|
-
# => GSL::Matrix:
|
283
|
-
# [ 1.000e+00 3.555e-17 -1.867e-16
|
284
|
-
# 3.555e-17 1.000e+00 -1.403e-16
|
282
|
+
# => GSL::Matrix:
|
283
|
+
# [ 1.000e+00 3.555e-17 -1.867e-16
|
284
|
+
# 3.555e-17 1.000e+00 -1.403e-16
|
285
285
|
# -1.867e-16 -1.403e-16 1.000e+00 ]
|
286
286
|
# >> u*Matrix.diagonal(s)*v.trans # Reconstruct the matrix
|
287
|
-
# => GSL::Matrix:
|
288
|
-
# [ 3.000e+00 5.000e+00 2.000e+00
|
289
|
-
# 5.000e+00 1.000e+00 4.000e+00
|
287
|
+
# => GSL::Matrix:
|
288
|
+
# [ 3.000e+00 5.000e+00 2.000e+00
|
289
|
+
# 5.000e+00 1.000e+00 4.000e+00
|
290
290
|
# 7.000e+00 6.000e+00 3.000e+00 ]
|
291
291
|
#
|
292
292
|
# ---
|
293
293
|
# * GSL::Linalg::SV.decomp_mod(A)
|
294
294
|
# * GSL::Matrix#SV_decomp_mod
|
295
295
|
#
|
296
|
-
# These compute the SVD using the modified Golub-Reinsch algorithm,
|
296
|
+
# These compute the SVD using the modified Golub-Reinsch algorithm,
|
297
297
|
# which is faster for M>>N.
|
298
298
|
#
|
299
299
|
# ---
|
300
300
|
# * GSL::Linalg::SV.decomp_jacobi(A)
|
301
301
|
# * GSL::Matrix#SV_decomp_jacobi
|
302
302
|
#
|
303
|
-
# These compute the SVD using one-sided Jacobi orthogonalization.
|
304
|
-
# The Jacobi method can compute singular values to higher relative accuracy
|
303
|
+
# These compute the SVD using one-sided Jacobi orthogonalization.
|
304
|
+
# The Jacobi method can compute singular values to higher relative accuracy
|
305
305
|
# than Golub-Reinsch algorithms.
|
306
306
|
#
|
307
307
|
# ---
|
@@ -309,7 +309,7 @@
|
|
309
309
|
# * GSL::Linalg::SV.solve(U, V, S, b)
|
310
310
|
# * GSL::Matrix#SV_solve(b)
|
311
311
|
#
|
312
|
-
# These methods solve the system <tt>A x = b</tt> using the singular value
|
312
|
+
# These methods solve the system <tt>A x = b</tt> using the singular value
|
313
313
|
# decomposition <tt>U, S, V</tt> of <tt>A</tt>.
|
314
314
|
#
|
315
315
|
# * Ex1:
|
@@ -322,39 +322,39 @@
|
|
322
322
|
# * Ex3:
|
323
323
|
# x = m.SV_solve(b)
|
324
324
|
#
|
325
|
-
# ==
|
326
|
-
# A symmetric, positive definite square matrix <tt>A</tt> has a Cholesky decomposition
|
327
|
-
# into a product of a lower triangular matrix L and its transpose L^T,
|
328
|
-
# as <tt>A = L L^T</tt>. This is sometimes referred to as taking the square-root of a
|
329
|
-
# matrix. The Cholesky decomposition can only be carried out when all the eigenvalues
|
330
|
-
# of the matrix are positive. This decomposition can be used to convert the linear
|
331
|
-
# system <tt>A x = b</tt> into a pair of triangular systems (<tt>L y = b, L^T x = y</tt>),
|
325
|
+
# == Cholesky Decomposition
|
326
|
+
# A symmetric, positive definite square matrix <tt>A</tt> has a Cholesky decomposition
|
327
|
+
# into a product of a lower triangular matrix L and its transpose L^T,
|
328
|
+
# as <tt>A = L L^T</tt>. This is sometimes referred to as taking the square-root of a
|
329
|
+
# matrix. The Cholesky decomposition can only be carried out when all the eigenvalues
|
330
|
+
# of the matrix are positive. This decomposition can be used to convert the linear
|
331
|
+
# system <tt>A x = b</tt> into a pair of triangular systems (<tt>L y = b, L^T x = y</tt>),
|
332
332
|
# which can be solved by forward and back-substitution.
|
333
333
|
#
|
334
334
|
# ---
|
335
335
|
# * GSL::Linalg::Cholesky.decomp(A)
|
336
336
|
#
|
337
|
-
# This method factorizes the positive-definite square matrix <tt>A</tt>
|
338
|
-
# into the Cholesky decomposition <tt>A = L L^T</tt>.
|
339
|
-
# The upper triangular part of the matrix returned contains L^T, the diagonal terms
|
340
|
-
# being identical for both L and L^T. If the matrix is not positive-definite
|
337
|
+
# This method factorizes the positive-definite square matrix <tt>A</tt>
|
338
|
+
# into the Cholesky decomposition <tt>A = L L^T</tt>.
|
339
|
+
# The upper triangular part of the matrix returned contains L^T, the diagonal terms
|
340
|
+
# being identical for both L and L^T. If the matrix is not positive-definite
|
341
341
|
# then the decomposition will fail.
|
342
342
|
#
|
343
|
-
# Ex:
|
343
|
+
# Ex:
|
344
344
|
# >> m = Matrix.pascal(3)
|
345
345
|
# => GSL::Matrix
|
346
|
-
# [ 1.000e+00 1.000e+00 1.000e+00
|
347
|
-
# 1.000e+00 2.000e+00 3.000e+00
|
346
|
+
# [ 1.000e+00 1.000e+00 1.000e+00
|
347
|
+
# 1.000e+00 2.000e+00 3.000e+00
|
348
348
|
# 1.000e+00 3.000e+00 6.000e+00 ]
|
349
349
|
# >> c = Linalg::Cholesky.decomp(m)
|
350
350
|
# => GSL::Linalg::Cholesky::CholeskyMatrix
|
351
|
-
# [ 1.000e+00 1.000e+00 1.000e+00
|
352
|
-
# 1.000e+00 1.000e+00 2.000e+00
|
351
|
+
# [ 1.000e+00 1.000e+00 1.000e+00
|
352
|
+
# 1.000e+00 1.000e+00 2.000e+00
|
353
353
|
# 1.000e+00 2.000e+00 1.000e+00 ]
|
354
354
|
# >> l = c.lower
|
355
355
|
# => GSL::Matrix
|
356
|
-
# [ 1.000e+00 0.000e+00 0.000e+00
|
357
|
-
# 1.000e+00 1.000e+00 0.000e+00
|
356
|
+
# [ 1.000e+00 0.000e+00 0.000e+00
|
357
|
+
# 1.000e+00 1.000e+00 0.000e+00
|
358
358
|
# 1.000e+00 2.000e+00 1.000e+00 ]
|
359
359
|
# >> (l*l.trans) == m
|
360
360
|
# => true
|
@@ -363,122 +363,122 @@
|
|
363
363
|
# * GSL::Linalg::Cholesky.solve(cholesky, b)
|
364
364
|
# * GSL::Linalg::Cholesky.svx(cholesky, x)
|
365
365
|
#
|
366
|
-
# These methods solve the system <tt>A x = b</tt> using the Cholesky decomposition
|
366
|
+
# These methods solve the system <tt>A x = b</tt> using the Cholesky decomposition
|
367
367
|
# of <tt>A</tt> into the matrix <tt>cholesky</tt> given by <tt>GSL::Linalg::Cholesky.decomp</tt>.
|
368
368
|
#
|
369
|
-
# === {
|
369
|
+
# === {Complex Cholesky decomposition}[link:cholesky_complex_rdoc.html]
|
370
370
|
#
|
371
|
-
# ==
|
371
|
+
# == Tridiagonal Decomposition of Real Symmetric Matrices
|
372
372
|
# ---
|
373
373
|
# * GSL::Linalg::Symmtd::decomp(A)
|
374
374
|
#
|
375
|
-
# Factorizes the symmetric square matrix <tt>A</tt> into the symmetric
|
375
|
+
# Factorizes the symmetric square matrix <tt>A</tt> into the symmetric
|
376
376
|
# tridiagonal decomposition Q T Q^T, and returns the results
|
377
|
-
# <tt>(A', tau)</tt>. On output the diagonal and subdiagonal part of the
|
378
|
-
# matrix <tt>A'</tt> contain the tridiagonal matrix <tt>T</tt>.
|
379
|
-
# The remaining lower triangular part of the matrix <tt>A'</tt> contains
|
380
|
-
# the Householder vectors which, together with the Householder
|
381
|
-
# coefficients <tt>tau</tt>, encode the orthogonal matrix <tt>Q</tt>.
|
382
|
-
# This storage scheme is the same as used by LAPACK.
|
383
|
-
# The upper triangular part of <tt>A</tt> is not referenced.
|
377
|
+
# <tt>(A', tau)</tt>. On output the diagonal and subdiagonal part of the
|
378
|
+
# matrix <tt>A'</tt> contain the tridiagonal matrix <tt>T</tt>.
|
379
|
+
# The remaining lower triangular part of the matrix <tt>A'</tt> contains
|
380
|
+
# the Householder vectors which, together with the Householder
|
381
|
+
# coefficients <tt>tau</tt>, encode the orthogonal matrix <tt>Q</tt>.
|
382
|
+
# This storage scheme is the same as used by LAPACK.
|
383
|
+
# The upper triangular part of <tt>A</tt> is not referenced.
|
384
384
|
# ---
|
385
385
|
# * GSL::Linalg::Symmtd::unpack(A', tau)
|
386
386
|
#
|
387
|
-
# Unpacks the encoded symmetric tridiagonal decomposition <tt>(A', tau)</tt>
|
388
|
-
# obtained from <tt>GSL::Linalg::Symmtd::decomp</tt> into the orthogonal
|
389
|
-
# matrix <tt>Q</tt>, the vector of diagonal elements <tt>diag</tt>
|
390
|
-
# and the vector of subdiagonal elements <tt>subdiag</tt>.
|
387
|
+
# Unpacks the encoded symmetric tridiagonal decomposition <tt>(A', tau)</tt>
|
388
|
+
# obtained from <tt>GSL::Linalg::Symmtd::decomp</tt> into the orthogonal
|
389
|
+
# matrix <tt>Q</tt>, the vector of diagonal elements <tt>diag</tt>
|
390
|
+
# and the vector of subdiagonal elements <tt>subdiag</tt>.
|
391
391
|
# ---
|
392
392
|
# * GSL::Linalg::Symmtd::unpack_T(A', tau)
|
393
393
|
#
|
394
|
-
# Unpacks the diagonal and subdiagonal of the encoded symmetric tridiagonal
|
395
|
-
# decomposition <tt>(A', tau)</tt> obtained from
|
396
|
-
# <tt>GSL::Linalg::Symmtd::decomp</tt> into the vectors
|
397
|
-
# <tt>diag</tt> and <tt>subdiag</tt>.
|
394
|
+
# Unpacks the diagonal and subdiagonal of the encoded symmetric tridiagonal
|
395
|
+
# decomposition <tt>(A', tau)</tt> obtained from
|
396
|
+
# <tt>GSL::Linalg::Symmtd::decomp</tt> into the vectors
|
397
|
+
# <tt>diag</tt> and <tt>subdiag</tt>.
|
398
398
|
#
|
399
|
-
# ==
|
399
|
+
# == Tridiagonal Decomposition of Hermitian Matrices
|
400
400
|
# ---
|
401
401
|
# * GSL::Linalg::Hermtd::decomp(A)
|
402
402
|
#
|
403
|
-
# Factorizes the hermitian matrix <tt>A</tt> into the symmetric tridiagonal
|
404
|
-
# decomposition U T U^T, and returns the result as <tt>(A', tau)</tt>.
|
403
|
+
# Factorizes the hermitian matrix <tt>A</tt> into the symmetric tridiagonal
|
404
|
+
# decomposition U T U^T, and returns the result as <tt>(A', tau)</tt>.
|
405
405
|
# On output the real parts of the diagonal and subdiagonal part of the
|
406
|
-
# matrix <tt>A'</tt> contain the tridiagonal matrix <tt>T</tt>.
|
407
|
-
# The remaining lower triangular part of the matrix <tt>A'</tt> contains
|
408
|
-
# the Householder vectors which, together with the Householder
|
409
|
-
# coefficients <tt>tau</tt>, encode the orthogonal matrix <tt>Q</tt>.
|
410
|
-
# This storage scheme is the same as used by LAPACK.
|
411
|
-
# The upper triangular part of <tt>A</tt> and imaginary parts of the diagonal
|
412
|
-
# are not referenced.
|
406
|
+
# matrix <tt>A'</tt> contain the tridiagonal matrix <tt>T</tt>.
|
407
|
+
# The remaining lower triangular part of the matrix <tt>A'</tt> contains
|
408
|
+
# the Householder vectors which, together with the Householder
|
409
|
+
# coefficients <tt>tau</tt>, encode the orthogonal matrix <tt>Q</tt>.
|
410
|
+
# This storage scheme is the same as used by LAPACK.
|
411
|
+
# The upper triangular part of <tt>A</tt> and imaginary parts of the diagonal
|
412
|
+
# are not referenced.
|
413
413
|
#
|
414
414
|
# ---
|
415
415
|
# * GSL::Linalg::Hermtd::unpack(A', tau)
|
416
416
|
#
|
417
|
-
# Unpacks the encoded tridiagonal decomposition <tt>(A', tau)</tt>
|
418
|
-
# obtained from <tt>GSL::Linalg::Hermtd::decomp</tt> into the unitary matrix
|
419
|
-
# <tt>U</tt>, the real vector of diagonal elements <tt>diag</tt> and
|
420
|
-
# the real vector of subdiagonal elements <tt>subdiag</tt>.
|
417
|
+
# Unpacks the encoded tridiagonal decomposition <tt>(A', tau)</tt>
|
418
|
+
# obtained from <tt>GSL::Linalg::Hermtd::decomp</tt> into the unitary matrix
|
419
|
+
# <tt>U</tt>, the real vector of diagonal elements <tt>diag</tt> and
|
420
|
+
# the real vector of subdiagonal elements <tt>subdiag</tt>.
|
421
421
|
#
|
422
422
|
# ---
|
423
423
|
# * GSL::Linalg::Hermtd::unpack_T(A', tau)
|
424
424
|
#
|
425
|
-
# Unpacks the diagonal and subdiagonal of the encoded tridiagonal
|
426
|
-
# decomposition <tt>(A, tau)</tt> obtained from the
|
427
|
-
# <tt>GSL::Linalg::Hermtd::decomp</tt>
|
428
|
-
# into the real vectors <tt>diag</tt> and <tt>subdiag</tt>.
|
425
|
+
# Unpacks the diagonal and subdiagonal of the encoded tridiagonal
|
426
|
+
# decomposition <tt>(A, tau)</tt> obtained from the
|
427
|
+
# <tt>GSL::Linalg::Hermtd::decomp</tt>
|
428
|
+
# into the real vectors <tt>diag</tt> and <tt>subdiag</tt>.
|
429
429
|
#
|
430
|
-
# ==
|
430
|
+
# == Hessenberg Decomposition of Real Matrices
|
431
431
|
# ---
|
432
432
|
# * GSL::Linalg::Hessenberg::decomp(A)
|
433
433
|
# * GSL::Linalg::hessenberg_decomp(A)
|
434
434
|
#
|
435
|
-
# Computes the Hessenberg decomposition of the matrix <tt>A</tt>
|
435
|
+
# Computes the Hessenberg decomposition of the matrix <tt>A</tt>
|
436
436
|
# by applying the similarity transformation <tt>H = U^T A U</tt>, and returns
|
437
|
-
# the result as <tt>(A', tau</tt>. On output, <tt>H</tt> is stored in the upper
|
438
|
-
# portion of <tt>A'</tt>. The information required to construct the matrix
|
439
|
-
# <tt>U</tt> is stored in the lower triangular portion of <tt>A'</tt>.
|
440
|
-
# <tt>U</tt> is a product of N - 2 Householder matrices.
|
441
|
-
# The Householder vectors are stored in the lower portion of <tt>A'</tt>
|
442
|
-
# (below the subdiagonal) and the Householder coefficients are stored
|
437
|
+
# the result as <tt>(A', tau</tt>. On output, <tt>H</tt> is stored in the upper
|
438
|
+
# portion of <tt>A'</tt>. The information required to construct the matrix
|
439
|
+
# <tt>U</tt> is stored in the lower triangular portion of <tt>A'</tt>.
|
440
|
+
# <tt>U</tt> is a product of N - 2 Householder matrices.
|
441
|
+
# The Householder vectors are stored in the lower portion of <tt>A'</tt>
|
442
|
+
# (below the subdiagonal) and the Householder coefficients are stored
|
443
443
|
# in the vector <tt>tau</tt>.
|
444
444
|
#
|
445
445
|
# ---
|
446
446
|
# * GSL::Linalg::Hessenberg::unpack(A', tau)
|
447
447
|
# * GSL::Linalg::hessenberg_unpack(A', tau)
|
448
448
|
#
|
449
|
-
# Constructs the orthogonal matrix <tt>U</tt> and returns it
|
450
|
-
# from the information stored in the Hessenberg matrix <tt>A'</tt>
|
451
|
-
# along with the vector <tt>tau</tt>. <tt>A'</tt> and <tt>tau</tt>
|
449
|
+
# Constructs the orthogonal matrix <tt>U</tt> and returns it
|
450
|
+
# from the information stored in the Hessenberg matrix <tt>A'</tt>
|
451
|
+
# along with the vector <tt>tau</tt>. <tt>A'</tt> and <tt>tau</tt>
|
452
452
|
# are outputs from <tt>GSL::Linalg::Hessenberg::decomp</tt>.
|
453
453
|
#
|
454
454
|
# ---
|
455
455
|
# * GSL::Linalg::Hessenberg::unpack_accum(A', tau, V = I)
|
456
456
|
# * GSL::Linalg::hessenberg_unpack_accum(A', tau, V = I)
|
457
457
|
#
|
458
|
-
# This method is similar to <tt>GSL::Linalg::Hessenberg::unpack</tt>,
|
459
|
-
# except it accumulates the matrix <tt>U</tt> into <tt>V</tt>, so that
|
460
|
-
# <tt>V' = VU</tt>, and returns <tt>V</tt>. Setting V to the identity matrix
|
461
|
-
# provides the same result <tt>GSL::Linalg::Hessenberg::unpack</tt>.
|
458
|
+
# This method is similar to <tt>GSL::Linalg::Hessenberg::unpack</tt>,
|
459
|
+
# except it accumulates the matrix <tt>U</tt> into <tt>V</tt>, so that
|
460
|
+
# <tt>V' = VU</tt>, and returns <tt>V</tt>. Setting V to the identity matrix
|
461
|
+
# provides the same result <tt>GSL::Linalg::Hessenberg::unpack</tt>.
|
462
462
|
#
|
463
463
|
# ---
|
464
464
|
# * GSL::Linalg::Hessenberg::set_zero(A')
|
465
465
|
# * GSL::Linalg::hessenberg_set_zero(A')
|
466
466
|
#
|
467
|
-
# Sets the lower triangular portion of <tt>A'</tt>, below the subdiagonal,
|
468
|
-
# to zero.
|
469
|
-
# It is useful for clearing out the Householder vectors after calling
|
467
|
+
# Sets the lower triangular portion of <tt>A'</tt>, below the subdiagonal,
|
468
|
+
# to zero.
|
469
|
+
# It is useful for clearing out the Householder vectors after calling
|
470
470
|
# <tt>GSL::Linalg::Hessenberg::decomp</tt>.
|
471
471
|
#
|
472
|
-
# ==
|
472
|
+
# == Hessenberg-Triangular Decomposition of Real Matrices
|
473
473
|
# ---
|
474
474
|
# * GSL::Linalg::hesstri_decomp(A, B)
|
475
475
|
# * GSL::Linalg::hesstri_decomp(A, B, work)
|
476
476
|
# * GSL::Linalg::hesstri_decomp(A, B, U, V)
|
477
477
|
# * GSL::Linalg::hesstri_decomp(A, B, U, V, work)
|
478
478
|
#
|
479
|
-
# Compute the Hessenberg-Triangular decomposition of the matrix pair
|
479
|
+
# Compute the Hessenberg-Triangular decomposition of the matrix pair
|
480
480
|
# <tt>(A, B)</tt>, and return <tt>(H, R</tt>.
|
481
|
-
# If U and V are provided (they may be null), the similarity
|
481
|
+
# If U and V are provided (they may be null), the similarity
|
482
482
|
# transformations are stored in them. <tt>work</tt> is an additional workspace
|
483
483
|
# of length <tt>N</tt>.
|
484
484
|
#
|
@@ -488,14 +488,14 @@
|
|
488
488
|
# * GSL::Linalg::hesstri_decomp!(A, B, U, V)
|
489
489
|
# * GSL::Linalg::hesstri_decomp!(A, B, U, V, work)
|
490
490
|
#
|
491
|
-
# Compute the Hessenberg-Triangular decomposition of the matrix pair
|
492
|
-
# <tt>(A, B)</tt>. On output, <tt>H</tt> is stored in <tt>A</tt>,
|
491
|
+
# Compute the Hessenberg-Triangular decomposition of the matrix pair
|
492
|
+
# <tt>(A, B)</tt>. On output, <tt>H</tt> is stored in <tt>A</tt>,
|
493
493
|
# and <tt>R</tt> is stored in <tt>B</tt>.
|
494
|
-
# If U and V are provided (they may be null), the similarity
|
494
|
+
# If U and V are provided (they may be null), the similarity
|
495
495
|
# transformations are stored in them. <tt>work</tt> is an additional workspace
|
496
496
|
# of length <tt>N</tt>.
|
497
497
|
#
|
498
|
-
# ==
|
498
|
+
# == Bidiagonalization
|
499
499
|
# ---
|
500
500
|
# * GSL::Linalg::Bidiag::decomp!(A)
|
501
501
|
# * GSL::Linalg::bidiag_decomp!(A)
|
@@ -512,71 +512,71 @@
|
|
512
512
|
# * GSL::Linalg::bidiag_unpack_B
|
513
513
|
#
|
514
514
|
#
|
515
|
-
# ==
|
515
|
+
# == Householder Transformations
|
516
516
|
# ---
|
517
517
|
# * GSL::Linalg::Householder::transform(v)
|
518
518
|
# * GSL::Linalg::HH::transform(v)
|
519
519
|
# * GSL::Vector#householder_transform
|
520
520
|
#
|
521
|
-
# These methods prepare a Householder transformation P = I - tau v v^T
|
522
|
-
# which can be used to zero all the elements of the input vector except the first.
|
523
|
-
# On output the transformation is stored in the vector <tt>v</tt>
|
521
|
+
# These methods prepare a Householder transformation P = I - tau v v^T
|
522
|
+
# which can be used to zero all the elements of the input vector except the first.
|
523
|
+
# On output the transformation is stored in the vector <tt>v</tt>
|
524
524
|
# and the scalar tau is returned.
|
525
525
|
#
|
526
526
|
# ---
|
527
527
|
# * GSL::Linalg::Householder::hm(tau, v, A)
|
528
528
|
# * GSL::Linalg::HH::hm(tau, v, A)
|
529
529
|
#
|
530
|
-
# These methods apply the Householder matrix P defined by the scalar
|
531
|
-
# <tt>tau</tt> and the vector <tt>v</tt> to the left-hand side of the matrix <tt>A</tt>.
|
530
|
+
# These methods apply the Householder matrix P defined by the scalar
|
531
|
+
# <tt>tau</tt> and the vector <tt>v</tt> to the left-hand side of the matrix <tt>A</tt>.
|
532
532
|
# On output the result P A is stored in <tt>A</tt>.
|
533
533
|
#
|
534
534
|
# ---
|
535
535
|
# * GSL::Linalg::Householder::mh(tau, v, A)
|
536
536
|
# * GSL::Linalg::HH::mh(tau, v, A)
|
537
537
|
#
|
538
|
-
# These methods apply the Householder matrix P defined by the scalar <tt>tau</tt>
|
539
|
-
# and the vector <tt>v</tt> to the right-hand side of the matrix <tt>A</tt>.
|
538
|
+
# These methods apply the Householder matrix P defined by the scalar <tt>tau</tt>
|
539
|
+
# and the vector <tt>v</tt> to the right-hand side of the matrix <tt>A</tt>.
|
540
540
|
# On output the result A P is stored in <tt>A</tt>.
|
541
541
|
#
|
542
542
|
# ---
|
543
543
|
# * GSL::Linalg::Householder::hv(tau, v, w)
|
544
544
|
# * GSL::Linalg::HH::hv(tau, v, w)
|
545
545
|
#
|
546
|
-
# These methods apply the Householder transformation P defined by the scalar
|
547
|
-
# <tt>tau</tt> and the vector <tt>v</tt> to the vector <tt>w</tt>.
|
546
|
+
# These methods apply the Householder transformation P defined by the scalar
|
547
|
+
# <tt>tau</tt> and the vector <tt>v</tt> to the vector <tt>w</tt>.
|
548
548
|
# On output the result P w is stored in <tt>w</tt>.
|
549
549
|
#
|
550
|
-
# ==
|
550
|
+
# == Householder solver for linear systems
|
551
551
|
# ---
|
552
552
|
# * GSL::Linalg::HH.solve(A, b)
|
553
553
|
# * GSL::Matrix#HH_solve(b)
|
554
554
|
#
|
555
|
-
# These methods solve the system <tt>A x = b</tt> directly using Householder
|
555
|
+
# These methods solve the system <tt>A x = b</tt> directly using Householder
|
556
556
|
# transformations. The matrix <tt>A</tt> is not modified.
|
557
557
|
# ---
|
558
558
|
# * GSL::Linalg::HH.solve!(A, b)
|
559
559
|
# * GSL::Matrix#HH_solve!(b)
|
560
560
|
#
|
561
|
-
# These methods solve the system <tt>A x = b</tt> directly using Householder
|
562
|
-
# transformations. The matrix <tt>A</tt> is destroyed by the
|
561
|
+
# These methods solve the system <tt>A x = b</tt> directly using Householder
|
562
|
+
# transformations. The matrix <tt>A</tt> is destroyed by the
|
563
563
|
# Householder transformations.
|
564
564
|
#
|
565
565
|
# ---
|
566
566
|
# * GSL::Linalg::HH.svx(A, b)
|
567
567
|
# * GSL::Matrix#HH_svx(b)
|
568
568
|
#
|
569
|
-
# These methods solve the system <tt>A x = b</tt> in-place directly using Householder
|
569
|
+
# These methods solve the system <tt>A x = b</tt> in-place directly using Householder
|
570
570
|
# transformations. The input vector <tt>b</tt> is replaced by the solution.
|
571
571
|
#
|
572
|
-
# ==
|
572
|
+
# == Tridiagonal Systems
|
573
573
|
# ---
|
574
574
|
# * GSL::Linglg::solve_tridiag(diag, e, f, b)
|
575
575
|
# * GSL::Linglg::Tridiag::solve(diag, e, f, b)
|
576
576
|
#
|
577
|
-
# These methods solve the general N-by-N system A x = b where <tt>A</tt>
|
578
|
-
# is tridiagonal ( N >= 2). The super-diagonal and sub-diagonal vectors <tt>e</tt>
|
579
|
-
# and <tt>f</tt> must be one element shorter than the diagonal vector <tt>diag</tt>.
|
577
|
+
# These methods solve the general N-by-N system A x = b where <tt>A</tt>
|
578
|
+
# is tridiagonal ( N >= 2). The super-diagonal and sub-diagonal vectors <tt>e</tt>
|
579
|
+
# and <tt>f</tt> must be one element shorter than the diagonal vector <tt>diag</tt>.
|
580
580
|
# The form of <tt>A</tt> for the 4-by-4 case is shown below,
|
581
581
|
# A = ( d_0 e_0 0 0 )
|
582
582
|
# ( f_0 d_1 e_1 0 )
|
@@ -587,9 +587,9 @@
|
|
587
587
|
# * GSL::Linglg::solve_symm_tridiag(diag, e, b)
|
588
588
|
# * GSL::Linglg::Tridiag::solve_symm(diag, e, b)
|
589
589
|
#
|
590
|
-
# These methods solve the general N-by-N system A x = b where <tt>A</tt> is
|
591
|
-
# symmetric tridiagonal ( N >= 2). The off-diagonal vector <tt>e</tt> must
|
592
|
-
# be one element shorter than the diagonal vector <tt>diag</tt>.
|
590
|
+
# These methods solve the general N-by-N system A x = b where <tt>A</tt> is
|
591
|
+
# symmetric tridiagonal ( N >= 2). The off-diagonal vector <tt>e</tt> must
|
592
|
+
# be one element shorter than the diagonal vector <tt>diag</tt>.
|
593
593
|
# The form of <tt>A</tt> for the 4-by-4 case is shown below,
|
594
594
|
# A = ( d_0 e_0 0 0 )
|
595
595
|
# ( e_0 d_1 e_1 0 )
|
@@ -600,9 +600,9 @@
|
|
600
600
|
# * GSL::Linglg::solve_cyc_tridiag(diag, e, f, b)
|
601
601
|
# * GSL::Linglg::Tridiag::solve_cyc(diag, e, f, b)
|
602
602
|
#
|
603
|
-
# These methods solve the general N-by-N system A x = b where <tt>A</tt> is
|
604
|
-
# cyclic tridiagonal ( N >= 3). The cyclic super-diagonal and sub-diagonal
|
605
|
-
# vectors <tt>e</tt> and <tt>f</tt> must have the same number of elements as the
|
603
|
+
# These methods solve the general N-by-N system A x = b where <tt>A</tt> is
|
604
|
+
# cyclic tridiagonal ( N >= 3). The cyclic super-diagonal and sub-diagonal
|
605
|
+
# vectors <tt>e</tt> and <tt>f</tt> must have the same number of elements as the
|
606
606
|
# diagonal vector <tt>diag</tt>. The form of <tt>A</tt> for the 4-by-4 case is shown below,
|
607
607
|
# A = ( d_0 e_0 0 f_3 )
|
608
608
|
# ( f_0 d_1 e_1 0 )
|
@@ -613,40 +613,40 @@
|
|
613
613
|
# * GSL::Linglg::solve_symm_cyc_tridiag(diag, e, b)
|
614
614
|
# * GSL::Linglg::Tridiag::solve_symm_cyc(diag, e, b)
|
615
615
|
#
|
616
|
-
# These methods solve the general N-by-N system A x = b where <tt>A</tt>
|
617
|
-
# is symmetric cyclic tridiagonal ( N >= 3). The cyclic off-diagonal vector <tt>e</tt>
|
618
|
-
# must have the same number of elements as the diagonal vector <tt>diag</tt>.
|
616
|
+
# These methods solve the general N-by-N system A x = b where <tt>A</tt>
|
617
|
+
# is symmetric cyclic tridiagonal ( N >= 3). The cyclic off-diagonal vector <tt>e</tt>
|
618
|
+
# must have the same number of elements as the diagonal vector <tt>diag</tt>.
|
619
619
|
# The form of <tt>A</tt> for the 4-by-4 case is shown below,
|
620
620
|
# A = ( d_0 e_0 0 e_3 )
|
621
621
|
# ( e_0 d_1 e_1 0 )
|
622
622
|
# ( 0 e_1 d_2 e_2 )
|
623
623
|
# ( e_3 0 e_2 d_3 )
|
624
624
|
#
|
625
|
-
# ==
|
626
|
-
# The process of balancing a matrix applies similarity transformations to
|
627
|
-
# make the rows and columns have comparable norms. This is useful,
|
628
|
-
# for example, to reduce roundoff errors in the solution of eigenvalue problems.
|
629
|
-
# Balancing a matrix <tt>A</tt> consists of replacing <tt>A</tt> with a similar matrix
|
630
|
-
# where <tt>D</tt> is a diagonal matrix whose entries are powers of the floating
|
631
|
-
# point radix.
|
625
|
+
# == Balancing
|
626
|
+
# The process of balancing a matrix applies similarity transformations to
|
627
|
+
# make the rows and columns have comparable norms. This is useful,
|
628
|
+
# for example, to reduce roundoff errors in the solution of eigenvalue problems.
|
629
|
+
# Balancing a matrix <tt>A</tt> consists of replacing <tt>A</tt> with a similar matrix
|
630
|
+
# where <tt>D</tt> is a diagonal matrix whose entries are powers of the floating
|
631
|
+
# point radix.
|
632
632
|
#
|
633
633
|
# ---
|
634
634
|
# * GSL::Linalg::balance(A)
|
635
635
|
# * GSL::Linalg::balance(A, D)
|
636
636
|
#
|
637
|
-
# Calculates the balanced counterpart of <tt>A</tt> and the diagonal elements
|
637
|
+
# Calculates the balanced counterpart of <tt>A</tt> and the diagonal elements
|
638
638
|
# of the similarity transformation. The result is returned as <tt>(A', D)</tt>.
|
639
639
|
#
|
640
640
|
# ---
|
641
641
|
# * GSL::Linalg::balance!(A)
|
642
642
|
# * GSL::Linalg::balance!(A, D)
|
643
643
|
#
|
644
|
-
# Replaces the matrix <tt>A</tt> with its balanced counterpart and
|
645
|
-
# stores the diagonal elements of the similarity transformation into
|
646
|
-
# the vector <tt>D</tt>.
|
644
|
+
# Replaces the matrix <tt>A</tt> with its balanced counterpart and
|
645
|
+
# stores the diagonal elements of the similarity transformation into
|
646
|
+
# the vector <tt>D</tt>.
|
647
647
|
#
|
648
648
|
#
|
649
|
-
# ==
|
649
|
+
# == NArray
|
650
650
|
# The following Linalg methods can handle NArray objects:
|
651
651
|
# * GSL::Linalg::
|
652
652
|
# * LU::
|
@@ -658,7 +658,7 @@
|
|
658
658
|
# * LU.invert(lu, perm)
|
659
659
|
# * QR::
|
660
660
|
# * QR.decomp(m)
|
661
|
-
# * QR.solve(qr, tau, b)
|
661
|
+
# * QR.solve(qr, tau, b)
|
662
662
|
# * QR.svx(qr, tau, bx)
|
663
663
|
# * SV::
|
664
664
|
# * SV.decomp(m)
|
@@ -672,10 +672,10 @@
|
|
672
672
|
# * HH.solve(m, b)
|
673
673
|
# * HH.svx(m, bx)
|
674
674
|
#
|
675
|
-
# {prev}[link:
|
676
|
-
# {next}[link:
|
675
|
+
# {prev}[link:blas_rdoc.html]
|
676
|
+
# {next}[link:eigen_rdoc.html]
|
677
677
|
#
|
678
|
-
# {Reference index}[link:
|
678
|
+
# {Reference index}[link:ref_rdoc.html]
|
679
679
|
# {top}[link:index.html]
|
680
680
|
#
|
681
681
|
#
|