2
$Id: omv.pas,v 1.1 2000/07/13 06:34:15 michael Exp $
3
This file is part of the Numlib package.
4
Copyright (c) 1986-2000 by
5
Kees van Ginneken, Wil Kortsmit and Loek van Reij of the
6
Computational centre of the Eindhoven University of Technology
8
FPC port Code by Marco van de Voort (marco@freepascal.org)
9
documentation by Michael van Canneyt (Michael@freepascal.org)
11
This unit contains some basic matrix operations.
13
See the file COPYING.FPC, included in this distribution,
14
for details about the copyright.
16
This program is distributed in the hope that it will be useful,
17
but WITHOUT ANY WARRANTY; without even the implied warranty of
18
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20
**********************************************************************}
29
{Calculates inproduct of vectors a and b which have N elements. The first
30
element is passed in a and b}
31
Function omvinp(Var a, b: ArbFloat; n: ArbInt): ArbFloat;
33
{Multiplication of two matrices C=AxB }
34
Procedure omvmmm(Var a: ArbFloat; m, n, rwa: ArbInt;
35
Var b: ArbFloat; k, rwb: ArbInt;
36
Var c: ArbFloat; rwc: ArbInt);
38
{Multiplication of a matrix(A) with a vector(B), C=A x B}
39
Procedure omvmmv(Var a: ArbFloat; m, n, rwidth: ArbInt; Var b, c: ArbFloat);
41
{Calculate 1-Norm of matrix A}
42
Function omvn1m(Var a: ArbFloat; m, n, rwidth: ArbInt): ArbFloat;
44
{Calculate 1-Norm of vector A}
45
Function omvn1v(Var a: ArbFloat; n: ArbInt): ArbFloat;
47
{Calculate 2-Norm of vector A}
48
Function omvn2v(Var a: ArbFloat; n: ArbInt): ArbFloat;
50
{Calculate Frobenius-Norm of mxn matrix A}
51
Function omvnfm(Var a: ArbFloat; m, n, rwidth: ArbInt): ArbFloat;
53
{Calculates maximum (infinite) norm of mxn matrix a}
54
Function omvnmm(Var a: ArbFloat; m, n, rwidth: ArbInt): ArbFloat;
56
{Calculates maximum (infinite) norm of n-Vector }
57
Function omvnmv(Var a: ArbFloat; n: ArbInt): ArbFloat;
59
{Transponate mxn matrix A (which was declared rwa bytes wide), put
60
it to C (rwc was declared elements wide)}
61
Procedure omvtrm(Var a: ArbFloat; m, n, rwa: ArbInt; Var c: ArbFloat;
66
Function omvinp(Var a, b: ArbFloat; n: ArbInt): ArbFloat;
68
Var pa, pb : ^arfloat1;
84
Procedure omvmmm(Var a: ArbFloat; m, n, rwa: ArbInt;
85
Var b: ArbFloat; k, rwb: ArbInt;
86
Var c: ArbFloat; rwc: ArbInt);
88
Var pa, pb, pc : ^arfloat1;
89
i, j, l, inda, indc : ArbInt;
92
If (m<1) Or (n<1) Or (k<1) Then
105
s := s+pa^[inda+l]*pb^[(l-1)*rwb+j];
111
Procedure omvmmv(Var a: ArbFloat; m, n, rwidth: ArbInt; Var b, c: ArbFloat);
113
Var pa, pb, pc : ^arfloat1;
116
If (m<1) Or (n<1) Then
124
pc^[i] := omvinp(pa^[ind+1], pb^[1], n);
129
Function omvn1m(Var a: ArbFloat; m, n, rwidth: ArbInt): ArbFloat;
133
norm, normc : ArbFloat;
136
If (m<1) Or (n<1) Then
144
normc := normc+abs(pa^[j+(i-1)*rwidth]);
151
Function omvn1v(Var a: ArbFloat; n: ArbInt): ArbFloat;
163
norm := norm+abs(pa^[i]);
167
Function omvn2v(Var a: ArbFloat; n: ArbInt): ArbFloat;
179
norm := norm+sqr(pa^[i]);
183
Function omvnfm(Var a: ArbFloat; m, n, rwidth: ArbInt): ArbFloat;
190
If (m<1) Or (n<1) Then
198
norm := norm+sqr(pa^[j+k]);
204
Function omvnmm(Var a: ArbFloat; m, n, rwidth: ArbInt): ArbFloat;
208
normr, norm : ArbFloat;
211
If (m<1) Or (n<1) Then
218
normr := omvn1v(pa^[1+k], n);
226
Function omvnmv(Var a: ArbFloat; n: ArbInt): ArbFloat;
246
Procedure omvtrm(Var a: ArbFloat; m, n, rwa: ArbInt;
247
Var c: ArbFloat; rwc: ArbInt);
249
Var pa, pc : ^arfloat1;
253
If (m<1) Or (n<1) Then
261
pc^[(j-1)*rwc+i] := pa^[ind+j];
269
Revision 1.1 2000/07/13 06:34:15 michael
272
Revision 1.2 2000/01/25 20:21:42 marco
273
* small updates, crlf fix, and RTE 207 problem
275
Revision 1.1 2000/01/24 22:08:58 marco