blob: b041a98c66133708a688318d61580eaf24c2dfeb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
-- File: GaussLeastSquare.cdl
-- Created: Mon May 13 16:24:37 1991
-- Author: Laurent PAINNOT
-- <lpa@topsn3>
---Copyright: Matra Datavision 1991, 1992
class GaussLeastSquare from math
---Purpose:
-- This class implements the least square solution of a set of
-- n linear equations of m unknowns (n >= m) using the gauss LU
-- decomposition algorithm.
-- This algorithm is more likely subject to numerical instability
-- than math_SVD.
uses Matrix from math,
Vector from math,
IntegerVector from math,
OStream from Standard
raises NotDone from StdFail,
DimensionError from Standard
is
Create(A: Matrix; MinPivot: Real = 1.0e-20)
---Purpose: Given an input n X m matrix A with n >= m this constructor
-- performs the LU decomposition with partial pivoting
-- (interchange of rows) of the matrix AA = A.Transposed() * A;
-- This LU decomposition is stored internally and may be used
-- to do subsequent calculation.
-- If the largest pivot found is less than MinPivot the matrix <A>
-- is considered as singular.
returns GaussLeastSquare;
IsDone(me)
---Purpose: Returns true if the computations are successful, otherwise returns false.e
---C++: inline
returns Boolean
is static;
Solve(me; B: in Vector; X: out Vector)
---Purpose: Given the input Vector <B> this routine solves the set
-- of linear equations A . X = B.
-- Exception NotDone is raised if the decomposition of A was
-- not done successfully.
-- Exception DimensionError is raised if the range of B Inv is
-- not equal to the rowrange of A.
-- Exception DimensionError is raised if the range of X Inv is
-- not equal to the colrange of A.
raises NotDone,
DimensionError
is static;
Dump(me; o: in out OStream)
---Purpose: Prints on the stream o information on the current state
-- of the object.
-- Is used to redefine the operator <<.
is static;
fields
Done: Boolean;
Singular: Boolean is protected;
LU: Matrix is protected;
A2 : Matrix is protected;
Index: IntegerVector is protected;
D: Real is protected;
end GaussLeastSquare;
|