home *** CD-ROM | disk | FTP | other *** search
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: LaTeX Document
(document/latex).
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| dexvert
| LaTeX Document (document/latex)
| magic
| Supported |
1%
| dexvert
| Corel 10 Texture (image/corel10Texture)
| ext
| Unsupported |
1%
| dexvert
| Croteam texture file (image/croteamTextureFile)
| ext
| Unsupported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| LaTeX document text
| default
| |
99%
| file
| LaTeX document, ASCII text, with CRLF line terminators
| default
| |
100%
| checkBytes
| Printable ASCII
| default
| |
100%
| perlTextCheck
| Likely Text (Perl)
| default
| |
100%
| siegfried
| fmt/281 LaTeX (Subdocument)
| default
| |
100%
| detectItEasy
| Format: plain text[CRLF]
| default (weak)
|
|
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 5c 63 68 61 70 74 65 72 | 7b 4d 61 74 72 69 78 20 |\chapter|{Matrix |
|00000010| 46 75 6e 63 74 69 6f 6e | 73 7d 0d 0a 0d 0a 54 68 |Function|s}....Th|
|00000020| 65 72 65 20 61 72 65 20 | 73 65 76 65 72 61 6c 20 |ere are |several |
|00000030| 66 75 6e 63 74 69 6f 6e | 73 5c 69 6e 64 65 78 7b |function|s\index{|
|00000040| 66 75 6e 63 74 69 6f 6e | 73 20 7d 20 70 72 6f 76 |function|s } prov|
|00000050| 69 64 65 64 20 66 6f 72 | 20 74 68 65 0d 0a 72 65 |ided for| the..re|
|00000060| 71 75 69 72 65 6d 65 6e | 74 73 20 6f 66 20 6d 61 |quiremen|ts of ma|
|00000070| 74 72 69 78 20 61 6c 67 | 65 62 72 61 2e 20 54 68 |trix alg|ebra. Th|
|00000080| 65 20 73 6f 75 72 63 65 | 20 63 6f 64 65 20 69 73 |e source| code is|
|00000090| 20 70 72 6f 76 69 64 65 | 64 20 73 6f 0d 0a 79 6f | provide|d so..yo|
|000000a0| 75 20 63 61 6e 20 65 78 | 70 61 6e 64 20 74 68 69 |u can ex|pand thi|
|000000b0| 73 20 73 65 63 74 69 6f | 6e 20 77 69 74 68 20 79 |s sectio|n with y|
|000000c0| 6f 75 72 20 6f 77 6e 20 | 73 6f 75 72 63 65 20 63 |our own |source c|
|000000d0| 6f 64 65 2e 20 54 68 65 | 72 65 20 61 72 65 0d 0a |ode. The|re are..|
|000000e0| 6d 61 6e 79 20 70 6f 70 | 75 6c 61 72 20 73 6f 75 |many pop|ular sou|
|000000f0| 72 63 65 73 20 6f 66 20 | 6d 61 74 68 65 6d 61 74 |rces of |mathemat|
|00000100| 69 63 61 6c 20 73 6f 66 | 74 77 61 72 65 20 69 6e |ical sof|tware in|
|00000110| 20 43 20 77 68 69 63 68 | 20 63 61 6e 20 62 65 0d | C which| can be.|
|00000120| 0a 74 72 61 6e 73 6c 61 | 74 65 64 20 74 6f 20 43 |.transla|ted to C|
|00000130| 2b 2b 2e 20 48 65 72 65 | 20 69 73 20 61 20 6c 69 |++. Here| is a li|
|00000140| 73 74 20 6f 66 20 61 75 | 74 68 6f 72 73 20 49 20 |st of au|thors I |
|00000150| 6c 69 6b 65 20 74 6f 20 | 75 73 65 20 66 6f 72 0d |like to |use for.|
|00000160| 0a 63 6f 64 65 20 69 6e | 20 43 3a 20 48 6f 6c 75 |.code in| C: Holu|
|00000170| 62 5c 63 69 74 65 7b 48 | 6f 3a 64 64 7d 2c 20 42 |b\cite{H|o:dd}, B|
|00000180| 61 6b 65 72 5c 63 69 74 | 65 7b 42 6b 3a 63 74 7d |aker\cit|e{Bk:ct}|
|00000190| 5c 63 69 74 65 7b 42 6b | 3a 6d 74 7d 2c 0d 0a 4b |\cite{Bk|:mt},..K|
|000001a0| 61 73 73 61 62 5c 63 69 | 74 65 7b 4b 61 3a 74 63 |assab\ci|te{Ka:tc|
|000001b0| 7d 2c 20 61 6e 64 20 50 | 72 65 73 73 5c 63 69 74 |}, and P|ress\cit|
|000001c0| 65 7b 50 72 3a 6e 72 63 | 7d 2e 20 54 68 65 73 65 |e{Pr:nrc|}. These|
|000001d0| 20 73 6f 75 72 63 65 73 | 20 72 61 6e 67 65 0d 0a | sources| range..|
|000001e0| 66 72 6f 6d 20 65 61 73 | 79 20 74 6f 20 68 61 72 |from eas|y to har|
|000001f0| 64 2e 20 4d 6f 73 74 20 | 6f 66 20 74 68 65 20 66 |d. Most |of the f|
|00000200| 75 6e 63 74 69 6f 6e 73 | 20 62 65 6c 6f 77 20 61 |unctions| below a|
|00000210| 72 65 20 74 72 61 6e 73 | 6c 61 74 69 6f 6e 73 20 |re trans|lations |
|00000220| 6f 66 20 43 2c 0d 0a 41 | 4c 47 4f 4c 2c 20 50 61 |of C,..A|LGOL, Pa|
|00000230| 73 63 61 6c 20 6f 72 20 | 46 4f 52 54 52 41 4e 20 |scal or |FORTRAN |
|00000240| 70 72 6f 67 72 61 6d 73 | 20 49 20 68 61 76 65 20 |programs| I have |
|00000250| 69 6e 20 6d 79 20 6c 69 | 62 72 61 72 79 2e 20 49 |in my li|brary. I|
|00000260| 20 68 61 76 65 20 61 6c | 73 6f 0d 0a 70 72 6f 64 | have al|so..prod|
|00000270| 75 63 65 64 20 73 6f 6d | 65 20 73 69 6d 70 6c 65 |uced som|e simple|
|00000280| 20 66 75 6e 63 74 69 6f | 6e 73 20 66 6f 75 6e 64 | functio|ns found|
|00000290| 20 69 6e 20 6d 6f 73 74 | 20 6d 61 74 72 69 78 20 | in most| matrix |
|000002a0| 70 61 63 6b 61 67 65 73 | 2e 20 4d 6f 73 74 20 6f |packages|. Most o|
|000002b0| 66 0d 0a 74 68 65 20 72 | 6f 75 74 69 6e 65 73 20 |f..the r|outines |
|000002c0| 61 72 65 20 63 6f 6e 74 | 61 69 6e 65 64 20 69 6e |are cont|ained in|
|000002d0| 20 56 49 52 54 4f 50 2e | 43 50 50 2c 20 61 6e 64 | VIRTOP.|CPP, and|
|000002e0| 20 77 6f 72 6b 20 74 68 | 65 20 73 61 6d 65 20 77 | work th|e same w|
|000002f0| 61 79 0d 0a 75 6e 64 65 | 72 20 74 68 65 20 69 6e |ay..unde|r the in|
|00000300| 2d 2d 72 61 6d 20 61 6e | 64 20 76 69 72 74 75 61 |--ram an|d virtua|
|00000310| 6c 20 6d 65 6d 6f 72 79 | 20 6d 6f 64 65 6c 73 2e |l memory| models.|
|00000320| 0d 0a 0d 0a 0d 0a 5c 73 | 65 63 74 69 6f 6e 7b 54 |......\s|ection{T|
|00000330| 68 65 20 46 75 6e 63 74 | 69 6f 6e 73 7d 0d 0a 54 |he Funct|ions}..T|
|00000340| 68 65 72 65 20 61 72 65 | 20 66 69 76 65 20 63 6c |here are| five cl|
|00000350| 61 73 73 65 73 20 6f 66 | 20 66 75 6e 63 74 69 6f |asses of| functio|
|00000360| 6e 73 20 69 6e 20 74 68 | 69 73 20 70 61 63 6b 61 |ns in th|is packa|
|00000370| 67 65 3a 0d 0a 64 69 73 | 70 6c 61 79 20 63 6f 6e |ge:..dis|play con|
|00000380| 74 72 6f 6c 2c 20 49 4f | 2c 20 73 75 62 73 65 74 |trol, IO|, subset|
|00000390| 74 69 6e 67 20 61 6e 64 | 20 63 6f 6e 63 61 74 65 |ting and| concate|
|000003a0| 6e 61 74 69 6f 6e 2c 0d | 0a 65 6c 65 6d 65 6e 74 |nation,.|.element|
|000003b0| 77 69 73 65 20 6f 70 65 | 72 61 74 69 6f 6e 73 2c |wise ope|rations,|
|000003c0| 20 61 6e 64 20 6d 61 74 | 68 20 66 75 6e 63 74 69 | and mat|h functi|
|000003d0| 6f 6e 73 2e 20 54 68 65 | 69 72 0d 0a 70 72 6f 74 |ons. The|ir..prot|
|000003e0| 6f 74 79 70 65 73 20 61 | 72 65 20 63 6f 6e 74 61 |otypes a|re conta|
|000003f0| 69 6e 65 64 20 62 65 6c | 6f 77 3a 20 0d 0a 5c 62 |ined bel|ow: ..\b|
|00000400| 65 67 69 6e 7b 76 65 72 | 62 61 74 69 6d 7d 0d 0a |egin{ver|batim}..|
|00000410| 0d 0a 74 79 70 65 64 65 | 66 20 65 6e 75 6d 20 62 |..typede|f enum b|
|00000420| 6f 6f 6c 65 61 6e 20 7b | 20 46 46 41 4c 53 45 2c |oolean {| FFALSE,|
|00000430| 20 54 54 52 55 45 20 7d | 20 62 6f 6f 6c 65 61 6e | TTRUE }| boolean|
|00000440| 3b 0d 0a 0d 0a 69 6e 74 | 20 53 65 74 77 69 64 28 |;....int| Setwid(|
|00000450| 20 69 6e 74 20 77 20 29 | 3b 20 20 20 20 20 20 20 | int w )|; |
|00000460| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 2f | | /|
|00000470| 2f 20 73 65 74 20 64 69 | 73 70 6c 61 79 20 77 69 |/ set di|splay wi|
|00000480| 64 74 68 0d 0a 69 6e 74 | 20 53 65 74 64 65 63 28 |dth..int| Setdec(|
|00000490| 20 69 6e 74 20 64 20 29 | 3b 20 20 20 20 20 20 20 | int d )|; |
|000004a0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 2f | | /|
|000004b0| 2f 20 73 65 74 20 64 65 | 63 69 6d 61 6c 73 0d 0a |/ set de|cimals..|
|000004c0| 69 6e 74 20 47 65 74 77 | 69 64 28 20 76 6f 69 64 |int Getw|id( void|
|000004d0| 20 20 29 3b 20 20 20 20 | 20 20 20 20 20 20 20 20 | ); | |
|000004e0| 20 20 20 20 20 20 20 20 | 20 20 2f 2f 20 72 65 70 | | // rep|
|000004f0| 6f 72 74 20 64 69 73 70 | 6c 61 79 20 77 69 64 74 |ort disp|lay widt|
|00000500| 68 0d 0a 69 6e 74 20 47 | 65 74 64 65 63 28 20 76 |h..int G|etdec( v|
|00000510| 6f 69 64 20 20 29 3b 20 | 20 20 20 20 20 20 20 20 |oid ); | |
|00000520| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 2f 2f 20 | | // |
|00000530| 72 65 70 6f 72 74 20 64 | 65 63 69 6d 61 6c 73 0d |report d|ecimals.|
|00000540| 0a 0d 0a 2f 2f 2f 2f 2f | 2f 2f 2f 2f 2f 2f 2f 2f |.../////|////////|
|00000550| 2f 2f 2f 2f 2f 2f 2f 2f | 2f 2f 2f 2f 2f 20 69 6f |////////|///// io|
|00000560| 0d 0a 0d 0a 56 4d 61 74 | 72 69 78 26 20 52 65 61 |....VMat|rix& Rea|
|00000570| 64 61 28 20 63 68 61 72 | 20 2a 66 69 64 29 3b 20 |da( char| *fid); |
|00000580| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 2f 2f | | //|
|00000590| 20 72 65 61 64 20 61 73 | 63 69 69 20 66 69 6c 65 | read as|cii file|
|000005a0| 0d 0a 56 4d 61 74 72 69 | 78 26 20 52 65 61 64 62 |..VMatri|x& Readb|
|000005b0| 28 20 63 68 61 72 20 2a | 66 69 64 29 3b 20 20 20 |( char *|fid); |
|000005c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 2f 2f 20 72 | | // r|
|000005d0| 65 61 64 20 62 69 6e 61 | 72 79 20 66 69 6c 65 0d |ead bina|ry file.|
|000005e0| 0a 76 6f 69 64 20 57 72 | 69 74 65 61 28 20 63 68 |.void Wr|itea( ch|
|000005f0| 61 72 20 2a 66 69 64 2c | 20 56 4d 61 74 72 69 78 |ar *fid,| VMatrix|
|00000600| 20 26 6d 61 74 29 3b 20 | 20 20 20 2f 2f 20 77 72 | &mat); | // wr|
|00000610| 69 74 65 20 61 73 63 69 | 69 20 66 69 6c 65 0d 0a |ite asci|i file..|
|00000620| 2f 2f 76 6f 69 64 20 56 | 4d 61 74 72 69 78 3a 3a |//void V|Matrix::|
|00000630| 57 72 69 74 65 62 28 20 | 63 68 61 72 20 2a 66 69 |Writeb( |char *fi|
|00000640| 64 2c 20 56 4d 61 74 72 | 69 78 20 26 6d 61 74 29 |d, VMatr|ix &mat)|
|00000650| 20 20 20 2f 2f 20 77 72 | 69 74 65 20 62 69 6e 61 | // wr|ite bina|
|00000660| 72 79 20 66 69 6c 65 0d | 0a 0d 0a 2f 2f 2f 2f 2f |ry file.|.../////|
|00000670| 2f 2f 2f 2f 2f 2f 2f 20 | 73 6f 72 74 69 6e 67 20 |/////// |sorting |
|00000680| 61 6e 64 20 73 75 62 73 | 65 74 74 69 6e 67 0d 0a |and subs|etting..|
|00000690| 0d 0a 56 4d 61 74 72 69 | 78 26 20 4d 53 6f 72 74 |..VMatri|x& MSort|
|000006a0| 28 20 56 4d 61 74 72 69 | 78 20 26 61 2c 20 69 6e |( VMatri|x &a, in|
|000006b0| 74 20 63 6f 6c 2c 20 69 | 6e 74 20 6f 72 64 65 72 |t col, i|nt order|
|000006c0| 3d 30 29 3b 0d 0a 56 4d | 61 74 72 69 78 26 20 53 |=0);..VM|atrix& S|
|000006d0| 75 62 6d 61 74 28 20 56 | 4d 61 74 72 69 78 20 26 |ubmat( V|Matrix &|
|000006e0| 61 2c 20 69 6e 74 20 72 | 2c 20 69 6e 74 20 63 2c |a, int r|, int c,|
|000006f0| 20 69 6e 74 20 6c 72 3d | 31 2c 20 69 6e 74 20 6c | int lr=|1, int l|
|00000700| 63 3d 31 29 3b 0d 0a 56 | 4d 61 74 72 69 78 26 20 |c=1);..V|Matrix& |
|00000710| 43 68 28 20 56 4d 61 74 | 72 69 78 20 26 61 2c 20 |Ch( VMat|rix &a, |
|00000720| 56 4d 61 74 72 69 78 20 | 26 62 20 29 3b 0d 0a 56 |VMatrix |&b );..V|
|00000730| 4d 61 74 72 69 78 26 20 | 43 76 28 20 56 4d 61 74 |Matrix& |Cv( VMat|
|00000740| 72 69 78 20 26 61 2c 20 | 56 4d 61 74 72 69 78 20 |rix &a, |VMatrix |
|00000750| 26 62 20 29 3b 0d 0a 0d | 0a 2f 2f 2f 2f 2f 2f 2f |&b );...|.///////|
|00000760| 2f 2f 2f 2f 2f 2f 2f 2f | 20 53 70 65 63 69 61 6c |////////| Special|
|00000770| 6c 79 20 70 61 74 74 65 | 72 6e 65 64 20 6d 61 74 |ly patte|rned mat|
|00000780| 72 69 63 65 73 0d 0a 0d | 0a 56 4d 61 74 72 69 78 |rices...|.VMatrix|
|00000790| 26 20 54 72 61 6e 28 56 | 4d 61 74 72 69 78 20 26 |& Tran(V|Matrix &|
|000007a0| 52 4f 70 20 29 3b 0d 0a | 56 4d 61 74 72 69 78 26 |ROp );..|VMatrix&|
|000007b0| 20 4d 65 78 70 28 56 4d | 61 74 72 69 78 20 26 52 | Mexp(VM|atrix &R|
|000007c0| 4f 70 20 29 3b 0d 0a 56 | 4d 61 74 72 69 78 26 20 |Op );..V|Matrix& |
|000007d0| 4d 61 62 73 28 56 4d 61 | 74 72 69 78 20 26 52 4f |Mabs(VMa|trix &RO|
|000007e0| 70 20 29 3b 0d 0a 56 4d | 61 74 72 69 78 26 20 4d |p );..VM|atrix& M|
|000007f0| 6c 6f 67 28 56 4d 61 74 | 72 69 78 20 26 52 4f 70 |log(VMat|rix &ROp|
|00000800| 20 29 3b 0d 0a 56 4d 61 | 74 72 69 78 26 20 4d 73 | );..VMa|trix& Ms|
|00000810| 71 72 74 28 56 4d 61 74 | 72 69 78 20 26 52 4f 70 |qrt(VMat|rix &ROp|
|00000820| 20 29 3b 0d 0a 64 6f 75 | 62 6c 65 20 54 72 61 63 | );..dou|ble Trac|
|00000830| 65 28 56 4d 61 74 72 69 | 78 20 26 52 4f 70 20 29 |e(VMatri|x &ROp )|
|00000840| 3b 0d 0a 56 4d 61 74 72 | 69 78 26 20 49 64 65 6e |;..VMatr|ix& Iden|
|00000850| 74 28 69 6e 74 20 6e 20 | 29 3b 0d 0a 56 4d 61 74 |t(int n |);..VMat|
|00000860| 72 69 78 26 20 48 65 6c | 6d 28 20 69 6e 74 20 6e |rix& Hel|m( int n|
|00000870| 20 29 3b 0d 0a 56 4d 61 | 74 72 69 78 26 20 46 69 | );..VMa|trix& Fi|
|00000880| 6c 6c 28 69 6e 74 20 72 | 2c 20 69 6e 74 20 63 2c |ll(int r|, int c,|
|00000890| 20 64 6f 75 62 6c 65 20 | 64 20 29 3b 0d 0a 56 4d | double |d );..VM|
|000008a0| 61 74 72 69 78 26 20 49 | 6e 64 65 78 28 20 69 6e |atrix& I|ndex( in|
|000008b0| 74 20 6c 6f 77 65 72 2c | 20 69 6e 74 20 75 70 70 |t lower,| int upp|
|000008c0| 65 72 2c 20 69 6e 74 20 | 73 74 65 70 20 3d 20 31 |er, int |step = 1|
|000008d0| 29 3b 0d 0a 0d 0a 2f 2f | 2f 2f 2f 2f 2f 2f 2f 2f |);....//|////////|
|000008e0| 2f 2f 2f 2f 2f 2f 20 49 | 6e 76 65 72 73 69 6f 6e |////// I|nversion|
|000008f0| 73 20 61 6e 64 20 64 65 | 63 6f 6d 70 6f 73 69 74 |s and de|composit|
|00000900| 69 6f 6e 73 0d 0a 0d 0a | 56 4d 61 74 72 69 78 26 |ions....|VMatrix&|
|00000910| 20 53 77 65 65 70 28 20 | 69 6e 74 20 6b 31 2c 20 | Sweep( |int k1, |
|00000920| 69 6e 74 20 6b 32 2c 20 | 56 4d 61 74 72 69 78 26 |int k2, |VMatrix&|
|00000930| 20 52 4f 70 29 3b 20 2f | 2a 20 73 77 65 65 70 20 | ROp); /|* sweep |
|00000940| 6f 75 74 20 61 20 72 6f | 77 20 2a 2f 0d 0a 56 4d |out a ro|w */..VM|
|00000950| 61 74 72 69 78 26 20 49 | 6e 76 28 20 56 4d 61 74 |atrix& I|nv( VMat|
|00000960| 72 69 78 20 26 52 4f 70 | 20 29 3b 20 2f 2a 6d 61 |rix &ROp| ); /*ma|
|00000970| 74 72 69 78 20 69 6e 76 | 65 72 73 69 6f 6e 20 75 |trix inv|ersion u|
|00000980| 73 69 6e 67 20 73 77 65 | 65 70 20 2a 2f 0d 0a 56 |sing swe|ep */..V|
|00000990| 4d 61 74 72 69 78 26 20 | 4b 72 6f 6e 28 20 56 4d |Matrix& |Kron( VM|
|000009a0| 61 74 72 69 78 20 26 61 | 2c 20 56 4d 61 74 72 69 |atrix &a|, VMatri|
|000009b0| 78 20 26 62 20 29 3b 0d | 0a 64 6f 75 62 6c 65 20 |x &b );.|.double |
|000009c0| 44 65 74 28 20 56 4d 61 | 74 72 69 78 20 26 52 4f |Det( VMa|trix &RO|
|000009d0| 70 20 29 3b 0d 0a 56 4d | 61 74 72 69 78 26 20 43 |p );..VM|atrix& C|
|000009e0| 68 6f 6c 65 73 6b 79 28 | 56 4d 61 74 72 69 78 26 |holesky(|VMatrix&|
|000009f0| 20 52 4f 70 29 3b 0d 0a | 76 6f 69 64 20 51 52 28 | ROp);..|void QR(|
|00000a00| 20 56 4d 61 74 72 69 78 | 26 20 52 4f 70 2c 20 56 | VMatrix|& ROp, V|
|00000a10| 4d 61 74 72 69 78 26 20 | 51 2c 20 56 4d 61 74 72 |Matrix& |Q, VMatr|
|00000a20| 69 78 26 20 52 2c 20 62 | 6f 6f 6c 65 61 6e 20 6d |ix& R, b|oolean m|
|00000a30| 61 6b 65 71 20 3d 20 54 | 54 52 55 45 29 3b 0d 0a |akeq = T|TRUE);..|
|00000a40| 69 6e 74 20 53 76 64 28 | 20 56 4d 61 74 72 69 78 |int Svd(| VMatrix|
|00000a50| 20 26 41 2c 20 56 4d 61 | 74 72 69 78 20 26 55 2c | &A, VMa|trix &U,|
|00000a60| 20 56 4d 61 74 72 69 78 | 20 26 53 2c 20 56 4d 61 | VMatrix| &S, VMa|
|00000a70| 74 72 69 78 20 26 56 2c | 0d 0a 20 20 20 20 20 20 |trix &V,|.. |
|00000a80| 20 20 20 20 62 6f 6f 6c | 65 61 6e 20 6d 61 6b 65 | bool|ean make|
|00000a90| 75 20 3d 20 54 54 52 55 | 45 2c 20 62 6f 6f 6c 65 |u = TTRU|E, boole|
|00000aa0| 61 6e 20 6d 61 6b 65 76 | 20 3d 20 54 54 52 55 45 |an makev| = TTRUE|
|00000ab0| 29 3b 0d 0a 56 4d 61 74 | 72 69 78 26 20 47 69 6e |);..VMat|rix& Gin|
|00000ac0| 76 28 20 56 4d 61 74 72 | 69 78 26 20 52 4f 70 20 |v( VMatr|ix& ROp |
|00000ad0| 29 3b 0d 0a 56 4d 61 74 | 72 69 78 26 20 46 66 74 |);..VMat|rix& Fft|
|00000ae0| 28 20 56 4d 61 74 72 69 | 78 20 26 52 4f 70 2c 20 |( VMatri|x &ROp, |
|00000af0| 62 6f 6f 6c 65 61 6e 20 | 49 4e 5a 45 45 20 3d 20 |boolean |INZEE = |
|00000b00| 54 54 52 55 45 29 3b 0d | 0a 0d 0a 2f 2f 2f 2f 2f |TTRUE);.|.../////|
|00000b10| 2f 2f 2f 2f 2f 2f 2f 2f | 2f 2f 20 52 65 73 68 61 |////////|// Resha|
|00000b20| 70 69 6e 67 20 66 75 6e | 63 74 69 6f 6e 73 0d 0a |ping fun|ctions..|
|00000b30| 0d 0a 56 4d 61 74 72 69 | 78 26 20 56 65 63 28 20 |..VMatri|x& Vec( |
|00000b40| 56 4d 61 74 72 69 78 26 | 20 52 4f 70 20 29 3b 20 |VMatrix&| ROp ); |
|00000b50| 20 20 20 20 20 2f 2f 20 | 73 65 6e 64 20 6d 61 74 | // |send mat|
|00000b60| 72 69 78 20 74 6f 20 76 | 65 63 74 6f 72 0d 0a 20 |rix to v|ector.. |
|00000b70| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000b80| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000b90| 20 20 2f 2f 20 73 74 61 | 63 6b 20 63 6f 6c 75 6d | // sta|ck colum|
|00000ba0| 6e 73 20 69 6e 74 6f 20 | 61 6e 20 28 72 2a 63 29 |ns into |an (r*c)|
|00000bb0| 78 31 0d 0a 56 4d 61 74 | 72 69 78 26 20 56 65 63 |x1..VMat|rix& Vec|
|00000bc0| 64 69 61 67 28 20 56 4d | 61 74 72 69 78 26 20 52 |diag( VM|atrix& R|
|00000bd0| 4f 70 20 29 3b 20 20 2f | 2f 20 65 78 74 72 61 63 |Op ); /|/ extrac|
|00000be0| 74 20 64 69 61 67 6f 6e | 61 6c 20 69 6e 74 6f 20 |t diagon|al into |
|00000bf0| 61 20 76 65 63 74 6f 72 | 0d 0a 56 4d 61 74 72 69 |a vector|..VMatri|
|00000c00| 78 26 20 44 69 61 67 28 | 20 56 4d 61 74 72 69 78 |x& Diag(| VMatrix|
|00000c10| 26 20 52 4f 70 20 29 3b | 20 20 20 20 20 2f 2f 20 |& ROp );| // |
|00000c20| 63 72 65 61 74 65 20 61 | 20 64 69 61 67 6f 6e 61 |create a| diagona|
|00000c30| 6c 20 6d 61 74 72 69 78 | 20 66 72 6f 6d 20 0d 0a |l matrix| from ..|
|00000c40| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000c50| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000c60| 20 20 20 2f 2f 20 73 71 | 75 61 72 65 20 6d 61 74 | // sq|uare mat|
|00000c70| 72 69 78 20 6f 72 20 63 | 6f 6c 75 6d 6e 20 76 65 |rix or c|olumn ve|
|00000c80| 63 74 6f 72 0d 0a 56 4d | 61 74 72 69 78 26 20 53 |ctor..VM|atrix& S|
|00000c90| 68 61 70 65 28 20 56 4d | 61 74 72 69 78 26 20 52 |hape( VM|atrix& R|
|00000ca0| 4f 70 2c 20 69 6e 74 20 | 6e 72 6f 77 73 20 3d 20 |Op, int |nrows = |
|00000cb0| 31 20 29 3b 20 20 20 20 | 20 20 20 2f 2f 20 72 65 |1 ); | // re|
|00000cc0| 73 68 61 70 65 20 69 6e | 74 6f 20 6e 72 6f 77 73 |shape in|to nrows|
|00000cd0| 0d 0a 0d 0a 2f 2f 2f 2f | 2f 2f 2f 2f 2f 2f 2f 2f |....////|////////|
|00000ce0| 2f 2f 2f 2f 2f 20 61 63 | 63 75 6d 75 6c 61 74 69 |///// ac|cumulati|
|00000cf0| 6f 6e 20 0d 0a 0d 0a 74 | 79 70 65 64 65 66 20 65 |on ....t|ypedef e|
|00000d00| 6e 75 6d 20 6d 61 72 67 | 69 6e 73 20 7b 20 41 4c |num marg|ins { AL|
|00000d10| 4c 2c 20 52 4f 57 53 2c | 20 43 4f 4c 55 4d 4e 53 |L, ROWS,| COLUMNS|
|00000d20| 20 7d 20 6d 61 72 67 69 | 6e 73 3b 20 2f 2f 20 73 | } margi|ns; // s|
|00000d30| 75 6d 6d 61 74 69 6f 6e | 20 6d 61 72 67 69 6e 73 |ummation| margins|
|00000d40| 0d 0a 0d 0a 56 4d 61 74 | 72 69 78 26 20 53 75 6d |....VMat|rix& Sum|
|00000d50| 28 20 56 4d 61 74 72 69 | 78 26 20 52 4f 70 2c 20 |( VMatri|x& ROp, |
|00000d60| 6d 61 72 67 69 6e 73 20 | 6d 61 72 67 20 3d 20 41 |margins |marg = A|
|00000d70| 4c 4c 20 29 3b 20 20 20 | 20 2f 2f 20 73 75 6d 73 |LL ); | // sums|
|00000d80| 20 6f 76 65 72 20 6d 61 | 72 67 69 6e 73 0d 0a 56 | over ma|rgins..V|
|00000d90| 4d 61 74 72 69 78 26 20 | 53 75 6d 73 71 28 20 56 |Matrix& |Sumsq( V|
|00000da0| 4d 61 74 72 69 78 26 20 | 52 4f 70 2c 20 6d 61 72 |Matrix& |ROp, mar|
|00000db0| 67 69 6e 73 20 6d 61 72 | 67 20 3d 20 41 4c 4c 20 |gins mar|g = ALL |
|00000dc0| 29 3b 20 20 2f 2f 20 73 | 75 6d 20 6f 66 20 73 71 |); // s|um of sq|
|00000dd0| 75 61 72 65 73 0d 0a 56 | 4d 61 74 72 69 78 26 20 |uares..V|Matrix& |
|00000de0| 43 75 73 75 6d 28 20 56 | 4d 61 74 72 69 78 26 20 |Cusum( V|Matrix& |
|00000df0| 52 4f 70 29 3b 20 20 20 | 20 20 20 20 20 20 20 20 |ROp); | |
|00000e00| 20 20 20 20 20 20 20 20 | 20 20 20 20 2f 2f 20 61 | | // a|
|00000e10| 63 63 75 6d 75 6c 61 74 | 65 20 61 6c 6f 6e 67 20 |ccumulat|e along |
|00000e20| 72 6f 77 73 0d 0a 0d 0a | 2f 2f 2f 2f 2f 2f 2f 2f |rows....|////////|
|00000e30| 2f 2f 2f 2f 2f 2f 2f 2f | 2f 20 6d 61 78 20 61 6e |////////|/ max an|
|00000e40| 64 20 6d 69 6e 0d 0a 0d | 0a 56 4d 61 74 72 69 78 |d min...|.VMatrix|
|00000e50| 26 20 4d 6d 61 78 28 20 | 56 4d 61 74 72 69 78 26 |& Mmax( |VMatrix&|
|00000e60| 20 52 4f 70 2c 20 6d 61 | 72 67 69 6e 73 20 6d 61 | ROp, ma|rgins ma|
|00000e70| 72 67 3d 41 4c 4c 20 29 | 3b 20 20 20 2f 2f 20 6d |rg=ALL )|; // m|
|00000e80| 61 74 72 69 78 20 6d 61 | 78 0d 0a 56 4d 61 74 72 |atrix ma|x..VMatr|
|00000e90| 69 78 26 20 4d 6d 69 6e | 28 20 56 4d 61 74 72 69 |ix& Mmin|( VMatri|
|00000ea0| 78 26 20 52 4f 70 2c 20 | 6d 61 72 67 69 6e 73 20 |x& ROp, |margins |
|00000eb0| 6d 61 72 67 3d 41 4c 4c | 20 29 3b 20 20 20 2f 2f |marg=ALL| ); //|
|00000ec0| 20 20 6d 61 74 72 69 78 | 20 6d 69 6e 0d 0a 0d 0a | matrix| min....|
|00000ed0| 2f 2f 2f 2f 2f 2f 2f 2f | 2f 2f 2f 2f 2f 2f 2f 2f |////////|////////|
|00000ee0| 2f 20 65 6c 65 6d 65 6e | 74 61 72 79 20 6f 70 65 |/ elemen|tary ope|
|00000ef0| 72 61 74 69 6f 6e 73 0d | 0a 2f 2f 2f 2f 2f 2f 2f |rations.|.///////|
|00000f00| 2f 2f 2f 2f 2f 2f 2f 2f | 2f 2f 20 21 21 21 21 21 |////////|// !!!!!|
|00000f10| 21 21 20 6d 6f 64 69 66 | 79 20 69 6e 70 75 74 20 |!! modif|y input |
|00000f20| 6d 61 74 72 69 63 65 73 | 0d 0a 0d 0a 76 6f 69 64 |matrices|....void|
|00000f30| 20 43 72 6f 77 28 20 56 | 4d 61 74 72 69 78 26 20 | Crow( V|Matrix& |
|00000f40| 52 4f 70 2c 20 69 6e 74 | 20 72 6f 77 3d 30 2c 20 |ROp, int| row=0, |
|00000f50| 64 6f 75 62 6c 65 20 63 | 3d 31 2e 30 29 3b 0d 0a |double c|=1.0);..|
|00000f60| 76 6f 69 64 20 53 72 6f | 77 28 20 56 4d 61 74 72 |void Sro|w( VMatr|
|00000f70| 69 78 20 26 52 4f 70 2c | 20 69 6e 74 20 72 6f 77 |ix &ROp,| int row|
|00000f80| 31 20 3d 20 30 2c 20 69 | 6e 74 20 72 6f 77 32 20 |1 = 0, i|nt row2 |
|00000f90| 3d 20 30 29 3b 0d 0a 76 | 6f 69 64 20 4c 72 6f 77 |= 0);..v|oid Lrow|
|00000fa0| 28 20 56 4d 61 74 72 69 | 78 20 26 52 4f 70 2c 20 |( VMatri|x &ROp, |
|00000fb0| 69 6e 74 20 72 6f 77 31 | 20 3d 20 30 2c 20 69 6e |int row1| = 0, in|
|00000fc0| 74 20 72 6f 77 32 20 3d | 20 30 2c 20 64 6f 75 62 |t row2 =| 0, doub|
|00000fd0| 6c 65 20 63 3d 30 2e 30 | 29 3b 0d 0a 76 6f 69 64 |le c=0.0|);..void|
|00000fe0| 20 43 63 6f 6c 28 20 56 | 4d 61 74 72 69 78 26 20 | Ccol( V|Matrix& |
|00000ff0| 52 4f 70 2c 20 69 6e 74 | 20 63 6f 6c 3d 30 2c 20 |ROp, int| col=0, |
|00001000| 64 6f 75 62 6c 65 20 63 | 3d 31 2e 30 29 3b 0d 0a |double c|=1.0);..|
|00001010| 76 6f 69 64 20 53 63 6f | 6c 28 20 56 4d 61 74 72 |void Sco|l( VMatr|
|00001020| 69 78 20 26 52 4f 70 2c | 20 69 6e 74 20 63 6f 6c |ix &ROp,| int col|
|00001030| 31 20 3d 20 30 2c 20 69 | 6e 74 20 63 6f 6c 32 20 |1 = 0, i|nt col2 |
|00001040| 3d 20 30 29 3b 0d 0a 76 | 6f 69 64 20 4c 63 6f 6c |= 0);..v|oid Lcol|
|00001050| 28 20 56 4d 61 74 72 69 | 78 20 26 52 4f 70 2c 20 |( VMatri|x &ROp, |
|00001060| 69 6e 74 20 63 6f 6c 31 | 20 3d 20 30 2c 20 69 6e |int col1| = 0, in|
|00001070| 74 20 63 6f 6c 32 20 3d | 20 30 2c 20 64 6f 75 62 |t col2 =| 0, doub|
|00001080| 6c 65 20 63 3d 30 2e 30 | 29 3b 0d 0a 0d 0a 5c 65 |le c=0.0|);....\e|
|00001090| 6e 64 7b 76 65 72 62 61 | 74 69 6d 7d 0d 0a 0d 0a |nd{verba|tim}....|
|000010a0| 41 20 62 6f 6f 6c 65 61 | 6e 20 74 79 70 65 20 69 |A boolea|n type i|
|000010b0| 73 20 70 72 6f 76 69 64 | 65 64 2e 20 54 68 65 20 |s provid|ed. The |
|000010c0| 76 61 6c 75 65 73 20 61 | 72 65 20 46 46 41 4c 53 |values a|re FFALS|
|000010d0| 45 20 61 6e 64 0d 0a 54 | 54 52 55 45 2e 20 54 68 |E and..T|TRUE. Th|
|000010e0| 65 79 20 61 72 65 20 6d | 69 73 73 70 65 6c 6c 65 |ey are m|isspelle|
|000010f0| 64 20 74 6f 20 61 76 6f | 69 64 20 63 6f 6e 66 6c |d to avo|id confl|
|00001100| 69 63 74 73 20 77 69 74 | 68 20 6f 74 68 65 72 0d |icts wit|h other.|
|00001110| 0a 63 6f 6d 70 69 6c 65 | 72 73 20 77 68 69 63 68 |.compile|rs which|
|00001120| 20 6d 61 79 20 68 61 76 | 65 20 61 6c 73 6f 20 64 | may hav|e also d|
|00001130| 65 66 69 6e 65 64 20 61 | 20 62 6f 6f 6c 65 61 6e |efined a| boolean|
|00001140| 20 74 79 70 65 2e 0d 0a | 0d 0a 5c 73 75 62 73 65 | type...|..\subse|
|00001150| 63 74 69 6f 6e 7b 44 69 | 73 70 6c 61 79 20 43 6f |ction{Di|splay Co|
|00001160| 6e 74 72 6f 6c 7d 0d 0a | 4d 61 74 72 69 78 20 65 |ntrol}..|Matrix e|
|00001170| 6c 65 6d 65 6e 74 73 20 | 61 72 65 20 64 69 73 70 |lements |are disp|
|00001180| 6c 61 79 65 64 20 69 6e | 20 66 69 65 6c 64 73 20 |layed in| fields |
|00001190| 77 69 74 68 20 22 77 69 | 64 74 68 22 0d 0a 63 68 |with "wi|dth"..ch|
|000011a0| 61 72 61 63 74 65 72 73 | 2c 20 61 6e 64 20 22 64 |aracters|, and "d|
|000011b0| 65 63 22 20 64 69 67 69 | 74 73 20 74 6f 20 74 68 |ec" digi|ts to th|
|000011c0| 65 20 72 69 67 68 74 20 | 6f 66 20 74 68 65 20 64 |e right |of the d|
|000011d0| 65 63 69 6d 61 6c 0d 0a | 70 6c 61 63 65 2e 20 54 |ecimal..|place. T|
|000011e0| 68 65 73 65 20 70 61 72 | 61 6d 65 74 65 72 73 20 |hese par|ameters |
|000011f0| 6d 61 79 20 62 65 20 73 | 65 74 20 75 73 69 6e 67 |may be s|et using|
|00001200| 0d 0a 53 65 74 77 69 64 | 28 29 5c 69 6e 64 65 78 |..Setwid|()\index|
|00001210| 7b 66 75 6e 63 74 69 6f | 6e 73 21 53 65 74 77 69 |{functio|ns!Setwi|
|00001220| 64 28 29 7d 20 61 6e 64 | 0d 0a 53 65 74 64 65 63 |d()} and|..Setdec|
|00001230| 28 29 5c 69 6e 64 65 78 | 7b 66 75 6e 63 74 69 6f |()\index|{functio|
|00001240| 6e 73 21 53 65 74 64 65 | 63 28 29 7d 2e 20 54 77 |ns!Setde|c()}. Tw|
|00001250| 6f 20 6f 74 68 65 72 20 | 66 75 6e 63 74 69 6f 6e |o other |function|
|00001260| 73 20 61 72 65 0d 0a 70 | 72 6f 76 69 64 65 64 20 |s are..p|rovided |
|00001270| 66 6f 72 20 66 69 6e 64 | 69 6e 67 20 74 68 65 20 |for find|ing the |
|00001280| 63 75 72 72 65 6e 74 20 | 77 69 64 74 68 20 61 6e |current |width an|
|00001290| 64 20 64 65 63 2e 0d 0a | 47 65 74 77 69 64 28 29 |d dec...|Getwid()|
|000012a0| 5c 69 6e 64 65 78 7b 66 | 75 6e 63 74 69 6f 6e 73 |\index{f|unctions|
|000012b0| 21 47 65 74 77 69 64 28 | 29 7d 20 61 6e 64 0d 0a |!Getwid(|)} and..|
|000012c0| 47 65 74 64 65 63 28 29 | 5c 69 6e 64 65 78 7b 66 |Getdec()|\index{f|
|000012d0| 75 6e 63 74 69 6f 6e 73 | 21 47 65 74 64 65 63 28 |unctions|!Getdec(|
|000012e0| 29 7d 20 72 65 74 75 72 | 6e 20 69 6e 74 65 67 65 |)} retur|n intege|
|000012f0| 72 73 20 66 6f 72 0d 0a | 77 69 64 74 68 20 61 6e |rs for..|width an|
|00001300| 64 20 64 65 63 2e 20 59 | 6f 75 20 73 68 6f 75 6c |d dec. Y|ou shoul|
|00001310| 64 20 72 61 72 65 6c 79 | 20 72 65 71 75 69 72 65 |d rarely| require|
|00001320| 20 74 68 65 20 6c 61 73 | 74 20 74 77 6f 0d 0a 66 | the las|t two..f|
|00001330| 75 6e 63 74 69 6f 6e 73 | 2e 20 54 68 65 79 20 73 |unctions|. They s|
|00001340| 74 6f 72 65 20 77 69 64 | 74 68 20 61 6e 64 20 64 |tore wid|th and d|
|00001350| 65 63 20 69 6e 20 73 74 | 61 74 69 63 20 76 61 72 |ec in st|atic var|
|00001360| 69 61 62 6c 65 73 2e 0d | 0a 54 68 65 79 20 61 72 |iables..|.They ar|
|00001370| 65 20 61 6c 73 6f 20 63 | 61 6c 6c 65 64 20 62 79 |e also c|alled by|
|00001380| 20 6f 74 68 65 72 20 66 | 75 6e 63 74 69 6f 6e 73 | other f|unctions|
|00001390| 20 6e 65 65 64 69 6e 67 | 20 74 68 65 73 65 0d 0a | needing| these..|
|000013a0| 76 61 6c 75 65 73 2e 20 | 0d 0a 0d 0a 5c 73 75 62 |values. |....\sub|
|000013b0| 73 65 63 74 69 6f 6e 7b | 4d 61 74 72 69 78 20 49 |section{|Matrix I|
|000013c0| 4f 7d 0d 0a 54 68 65 72 | 65 20 61 72 65 20 74 77 |O}..Ther|e are tw|
|000013d0| 6f 20 66 6f 72 6d 61 74 | 73 20 66 6f 72 20 6d 61 |o format|s for ma|
|000013e0| 74 72 69 78 20 66 69 6c | 65 73 20 75 73 65 64 20 |trix fil|es used |
|000013f0| 69 6e 20 74 68 69 73 0d | 0a 70 72 6f 67 72 61 6d |in this.|.program|
|00001400| 3a 20 41 53 43 49 49 20 | 61 6e 64 20 62 69 6e 61 |: ASCII |and bina|
|00001410| 72 79 2e 20 45 61 63 68 | 20 66 6f 72 6d 61 74 20 |ry. Each| format |
|00001420| 68 61 76 65 20 72 65 61 | 64 20 61 6e 64 20 77 72 |have rea|d and wr|
|00001430| 69 74 65 0d 0a 66 75 6e | 63 74 69 6f 6e 73 2e 20 |ite..fun|ctions. |
|00001440| 52 65 61 64 61 28 29 5c | 69 6e 64 65 78 7b 66 75 |Reada()\|index{fu|
|00001450| 6e 63 74 69 6f 6e 73 21 | 52 65 61 64 61 28 29 7d |nctions!|Reada()}|
|00001460| 20 72 65 61 64 73 20 41 | 53 43 49 49 0d 0a 6d 61 | reads A|SCII..ma|
|00001470| 74 72 69 63 65 73 2c 20 | 61 6e 64 20 57 72 69 74 |trices, |and Writ|
|00001480| 65 61 28 29 5c 69 6e 64 | 65 78 7b 66 75 6e 63 74 |ea()\ind|ex{funct|
|00001490| 69 6f 6e 73 21 57 72 69 | 74 65 61 28 29 7d 20 77 |ions!Wri|tea()} w|
|000014a0| 72 69 74 65 73 0d 0a 74 | 68 65 6d 2e 20 54 68 65 |rites..t|hem. The|
|000014b0| 20 66 6f 72 6d 61 74 20 | 66 6f 72 20 61 6e 20 41 | format |for an A|
|000014c0| 53 43 49 49 20 66 69 6c | 65 20 69 73 20 72 65 61 |SCII fil|e is rea|
|000014d0| 73 6f 6e 61 62 6c 79 20 | 73 69 6d 70 6c 65 3a 0d |sonably |simple:.|
|000014e0| 0a 5c 62 65 67 69 6e 7b | 65 6e 75 6d 65 72 61 74 |.\begin{|enumerat|
|000014f0| 65 7d 0d 0a 20 20 5c 69 | 74 65 6d 20 4c 69 6e 65 |e}.. \i|tem Line|
|00001500| 20 31 3a 20 54 68 65 20 | 66 69 72 73 74 20 6c 69 | 1: The |first li|
|00001510| 6e 65 20 69 73 20 74 68 | 65 20 6d 61 74 72 69 78 |ne is th|e matrix|
|00001520| 20 6e 61 6d 65 2e 20 49 | 74 20 6d 61 79 0d 0a 20 | name. I|t may.. |
|00001530| 20 20 20 20 20 20 20 69 | 6e 63 6c 75 64 65 20 62 | i|nclude b|
|00001540| 6c 61 6e 6b 73 2c 20 6d | 61 79 20 62 65 20 6e 6f |lanks, m|ay be no|
|00001550| 20 6c 6f 6e 67 65 72 20 | 74 68 61 6e 20 38 30 20 | longer |than 80 |
|00001560| 63 6f 6c 75 6d 6e 73 2c | 0d 0a 20 20 20 20 20 20 |columns,|.. |
|00001570| 20 20 61 6e 64 20 69 73 | 20 74 65 72 6d 69 6e 61 | and is| termina|
|00001580| 74 65 64 20 62 79 20 61 | 20 63 61 72 72 69 61 67 |ted by a| carriag|
|00001590| 65 20 72 65 74 75 72 6e | 2e 0d 0a 20 20 5c 69 74 |e return|... \it|
|000015a0| 65 6d 20 4c 69 6e 65 20 | 32 3a 20 54 77 6f 20 69 |em Line |2: Two i|
|000015b0| 6e 74 65 67 65 72 73 2c | 20 74 68 65 20 66 69 72 |ntegers,| the fir|
|000015c0| 73 74 20 69 73 20 74 68 | 65 20 6e 75 6d 62 65 72 |st is th|e number|
|000015d0| 20 6f 66 0d 0a 20 20 20 | 20 20 20 20 20 72 6f 77 | of.. | row|
|000015e0| 73 20 61 6e 64 20 74 68 | 65 20 73 65 63 6f 6e 64 |s and th|e second|
|000015f0| 20 69 73 20 74 68 65 20 | 6e 75 6d 62 65 72 20 6f | is the |number o|
|00001600| 66 20 63 6f 6c 75 6d 6e | 73 2e 20 0d 0a 20 20 5c |f column|s. .. \|
|00001610| 69 74 65 6d 20 4c 69 6e | 65 73 20 33 2e 2e 2e 72 |item Lin|es 3...r|
|00001620| 2b 32 20 3a 20 54 68 65 | 20 6e 65 78 74 20 72 20 |+2 : The| next r |
|00001630| 72 6f 77 73 20 61 72 65 | 20 74 68 65 20 72 6f 77 |rows are| the row|
|00001640| 73 20 6f 66 20 74 68 65 | 0d 0a 20 20 20 20 20 20 |s of the|.. |
|00001650| 20 20 6d 61 74 72 69 78 | 2e 20 43 6f 6c 75 6d 6e | matrix|. Column|
|00001660| 73 20 61 72 65 20 73 65 | 70 61 72 61 74 65 64 20 |s are se|parated |
|00001670| 62 79 20 73 70 61 63 65 | 73 2e 0d 0a 5c 65 6e 64 |by space|s...\end|
|00001680| 7b 65 6e 75 6d 65 72 61 | 74 65 7d 0d 0a 54 68 65 |{enumera|te}..The|
|00001690| 72 65 20 69 73 20 6e 6f | 20 66 61 63 69 6c 69 74 |re is no| facilit|
|000016a0| 79 20 66 6f 72 20 6d 69 | 73 73 69 6e 67 20 64 61 |y for mi|ssing da|
|000016b0| 74 61 2e 20 20 54 68 65 | 20 64 61 74 61 20 69 73 |ta. The| data is|
|000016c0| 20 77 72 69 74 74 65 6e | 0d 0a 74 6f 20 74 68 65 | written|..to the|
|000016d0| 20 66 69 6c 65 20 75 73 | 69 6e 67 20 22 77 69 64 | file us|ing "wid|
|000016e0| 74 68 22 20 63 68 61 72 | 61 63 74 65 72 73 2c 20 |th" char|acters, |
|000016f0| 61 6e 64 20 22 64 65 63 | 22 20 64 65 63 69 6d 61 |and "dec|" decima|
|00001700| 6c 0d 0a 70 6c 61 63 65 | 73 2c 20 73 6f 20 73 6f |l..place|s, so so|
|00001710| 6d 65 20 61 63 63 75 72 | 61 63 79 20 6d 61 79 20 |me accur|acy may |
|00001720| 62 65 20 6c 6f 73 74 20 | 69 66 20 79 6f 75 20 64 |be lost |if you d|
|00001730| 6f 20 6e 6f 74 20 73 65 | 74 20 74 68 65 0d 0a 77 |o not se|t the..w|
|00001740| 69 64 74 68 20 61 6e 64 | 20 64 65 63 69 6d 61 6c |idth and| decimal|
|00001750| 20 70 6c 61 63 65 73 20 | 62 65 66 6f 72 65 20 77 | places |before w|
|00001760| 72 69 74 69 6e 67 20 74 | 68 65 20 6d 61 74 72 69 |riting t|he matri|
|00001770| 78 20 69 6e 20 41 53 43 | 49 49 0d 0a 66 6f 72 6d |x in ASC|II..form|
|00001780| 61 74 2e 20 54 68 65 20 | 61 72 67 75 6d 65 6e 74 |at. The |argument|
|00001790| 20 74 6f 20 52 65 61 64 | 61 28 29 20 69 73 20 61 | to Read|a() is a|
|000017a0| 20 66 69 6c 65 20 6e 61 | 6d 65 20 63 68 61 72 61 | file na|me chara|
|000017b0| 63 74 65 72 0d 0a 73 74 | 72 69 6e 67 2e 20 54 68 |cter..st|ring. Th|
|000017c0| 65 20 66 69 6c 65 20 69 | 73 20 6f 70 65 6e 65 64 |e file i|s opened|
|000017d0| 20 61 6e 64 20 72 65 61 | 64 2e 20 52 65 61 64 61 | and rea|d. Reada|
|000017e0| 28 29 20 72 65 74 75 72 | 6e 73 20 61 0d 0a 56 4d |() retur|ns a..VM|
|000017f0| 61 74 72 69 78 20 72 65 | 66 65 72 65 6e 63 65 2e |atrix re|ference.|
|00001800| 20 54 68 65 20 61 72 67 | 75 6d 65 6e 74 73 20 74 | The arg|uments t|
|00001810| 6f 20 57 72 69 74 65 61 | 28 29 20 61 72 65 20 61 |o Writea|() are a|
|00001820| 20 66 69 6c 65 0d 0a 6e | 61 6d 65 20 63 68 61 72 | file..n|ame char|
|00001830| 61 63 74 65 72 20 73 74 | 72 69 6e 67 2c 20 61 6e |acter st|ring, an|
|00001840| 64 20 74 68 65 20 56 4d | 61 74 72 69 78 20 74 6f |d the VM|atrix to|
|00001850| 20 62 65 20 77 72 69 74 | 74 65 6e 2e 0d 0a 0d 0a | be writ|ten.....|
|00001860| 52 65 61 64 62 28 29 5c | 69 6e 64 65 78 7b 66 75 |Readb()\|index{fu|
|00001870| 6e 63 74 69 6f 6e 73 21 | 52 65 61 64 62 28 29 7d |nctions!|Readb()}|
|00001880| 20 61 6e 64 0d 0a 57 72 | 69 74 65 62 28 29 5c 69 | and..Wr|iteb()\i|
|00001890| 6e 64 65 78 7b 66 75 6e | 63 74 69 6f 6e 73 21 57 |ndex{fun|ctions!W|
|000018a0| 72 69 74 65 62 28 29 7d | 20 72 65 61 64 20 61 6e |riteb()}| read an|
|000018b0| 64 20 77 72 69 74 65 20 | 62 69 6e 61 72 79 0d 0a |d write |binary..|
|000018c0| 6d 61 74 72 69 63 65 73 | 2e 20 57 72 69 74 65 62 |matrices|. Writeb|
|000018d0| 28 29 20 63 72 65 61 74 | 65 73 20 61 20 62 69 6e |() creat|es a bin|
|000018e0| 61 72 79 20 66 69 6c 65 | 20 73 74 6f 72 69 6e 67 |ary file| storing|
|000018f0| 20 74 68 65 0d 0a 6d 61 | 74 72 69 78 2e 20 54 68 | the..ma|trix. Th|
|00001900| 65 72 65 20 69 73 20 6e | 6f 20 6c 6f 73 73 20 69 |ere is n|o loss i|
|00001910| 6e 20 61 63 63 75 72 61 | 63 79 20 77 68 65 6e 20 |n accura|cy when |
|00001920| 75 73 69 6e 67 20 61 20 | 62 69 6e 61 72 79 0d 0a |using a |binary..|
|00001930| 6d 61 74 72 69 78 20 73 | 69 6e 63 65 20 74 68 65 |matrix s|ince the|
|00001940| 20 62 69 6e 61 72 79 20 | 66 6f 72 6d 20 6f 66 20 | binary |form of |
|00001950| 74 68 65 20 65 6c 65 6d | 65 6e 74 73 20 69 73 20 |the elem|ents is |
|00001960| 77 72 69 74 74 65 6e 2e | 0d 0a 54 68 65 20 66 69 |written.|..The fi|
|00001970| 6c 65 20 66 6f 72 6d 61 | 74 20 66 6f 72 20 61 20 |le forma|t for a |
|00001980| 62 69 6e 61 72 79 20 66 | 69 6c 65 20 69 73 3a 0d |binary f|ile is:.|
|00001990| 0a 5c 62 65 67 69 6e 7b | 65 6e 75 6d 65 72 61 74 |.\begin{|enumerat|
|000019a0| 65 7d 0d 0a 20 20 5c 69 | 74 65 6d 20 42 79 74 65 |e}.. \i|tem Byte|
|000019b0| 73 20 31 2d 34 3a 20 41 | 6e 20 69 6e 74 65 67 65 |s 1-4: A|n intege|
|000019c0| 72 20 63 6f 75 6e 74 69 | 6e 67 20 74 68 65 20 6e |r counti|ng the n|
|000019d0| 75 6d 62 65 72 20 6f 66 | 0d 0a 20 20 20 20 20 20 |umber of|.. |
|000019e0| 20 20 63 68 61 72 61 63 | 74 65 72 73 20 69 6e 20 | charac|ters in |
|000019f0| 74 68 65 20 6d 61 74 72 | 69 78 20 6e 61 6d 65 2e |the matr|ix name.|
|00001a00| 20 54 68 69 73 20 69 73 | 20 63 61 6c 6c 65 64 20 | This is| called |
|00001a10| 73 74 72 6c 65 6e 2e 0d | 0a 20 20 5c 69 74 65 6d |strlen..|. \item|
|00001a20| 20 42 79 74 65 73 20 35 | 2e 2e 2e 73 74 72 6c 65 | Bytes 5|...strle|
|00001a30| 6e 2b 35 3a 20 54 68 65 | 20 6d 61 74 72 69 78 20 |n+5: The| matrix |
|00001a40| 6e 61 6d 65 20 73 74 72 | 69 6e 67 2e 20 0d 0a 20 |name str|ing. .. |
|00001a50| 20 5c 69 74 65 6d 20 54 | 68 65 20 6e 65 78 74 20 | \item T|he next |
|00001a60| 74 77 6f 20 66 69 65 6c | 64 73 20 61 72 65 20 69 |two fiel|ds are i|
|00001a70| 6e 74 65 67 65 72 73 20 | 63 6f 6e 74 61 69 6e 69 |ntegers |containi|
|00001a80| 6e 67 20 74 68 65 0d 0a | 20 20 20 20 20 20 20 20 |ng the..| |
|00001a90| 6e 75 6d 62 65 72 73 20 | 6f 66 20 72 6f 77 73 20 |numbers |of rows |
|00001aa0| 61 6e 64 20 63 6f 6c 75 | 6d 6e 73 20 6f 66 20 74 |and colu|mns of t|
|00001ab0| 68 65 20 6d 61 74 72 69 | 78 2e 0d 0a 20 20 5c 69 |he matri|x... \i|
|00001ac0| 74 65 6d 20 54 68 65 20 | 72 65 6d 61 69 6e 69 6e |tem The |remainin|
|00001ad0| 67 20 66 69 65 6c 64 73 | 3a 20 54 68 65 20 6d 61 |g fields|: The ma|
|00001ae0| 74 72 69 78 20 65 6c 65 | 6d 65 6e 74 73 20 73 74 |trix ele|ments st|
|00001af0| 6f 72 65 64 20 69 6e 0d | 0a 20 20 20 20 20 20 20 |ored in.|. |
|00001b00| 20 72 6f 77 20 6d 61 6a | 6f 72 20 6f 72 64 65 72 | row maj|or order|
|00001b10| 2e 0d 0a 5c 65 6e 64 7b | 65 6e 75 6d 65 72 61 74 |...\end{|enumerat|
|00001b20| 65 7d 0d 0a 54 68 65 20 | 61 72 67 75 6d 65 6e 74 |e}..The |argument|
|00001b30| 73 20 66 6f 72 20 52 65 | 61 64 62 28 29 20 61 6e |s for Re|adb() an|
|00001b40| 64 20 57 72 69 74 65 62 | 28 29 20 61 72 65 20 74 |d Writeb|() are t|
|00001b50| 68 65 20 73 61 6d 65 20 | 61 73 0d 0a 74 68 65 69 |he same |as..thei|
|00001b60| 72 20 41 53 43 49 49 20 | 63 6f 75 6e 74 65 72 70 |r ASCII |counterp|
|00001b70| 61 72 74 73 2e 20 4e 6f | 74 65 20 68 6f 77 65 76 |arts. No|te howev|
|00001b80| 65 72 20 74 68 61 74 20 | 57 72 69 74 65 62 28 29 |er that |Writeb()|
|00001b90| 20 69 73 20 61 0d 0a 6d | 65 6d 62 65 72 20 66 75 | is a..m|ember fu|
|00001ba0| 6e 63 74 69 6f 6e 20 6f | 66 20 74 68 65 20 56 4d |nction o|f the VM|
|00001bb0| 61 74 72 69 78 20 63 6c | 61 73 73 2e 20 54 68 69 |atrix cl|ass. Thi|
|00001bc0| 73 20 69 73 20 72 65 71 | 75 69 72 65 64 20 73 6f |s is req|uired so|
|00001bd0| 0d 0a 74 68 61 74 20 57 | 72 69 74 65 62 28 29 20 |..that W|riteb() |
|00001be0| 6d 61 79 20 62 65 20 6d | 6f 72 65 20 65 66 66 69 |may be m|ore effi|
|00001bf0| 63 69 65 6e 74 2e 20 49 | 74 20 6e 65 65 64 73 20 |cient. I|t needs |
|00001c00| 61 63 63 65 73 73 20 74 | 6f 20 74 68 65 0d 0a 68 |access t|o the..h|
|00001c10| 64 72 20 70 6f 69 6e 74 | 65 72 20 69 6e 20 69 74 |dr point|er in it|
|00001c20| 73 20 76 64 6f 75 62 20 | 70 61 72 65 6e 74 20 63 |s vdoub |parent c|
|00001c30| 6c 61 73 73 2e 20 57 72 | 69 74 65 62 28 29 20 73 |lass. Wr|iteb() s|
|00001c40| 65 6e 64 73 20 64 61 74 | 61 0d 0a 6f 75 74 20 69 |ends dat|a..out i|
|00001c50| 6e 20 62 6c 6f 63 6b 73 | 20 6f 66 20 73 69 7a 65 |n blocks| of size|
|00001c60| 20 42 4c 4b 5c 5f 53 49 | 5a 45 20 62 79 74 65 73 | BLK\_SI|ZE bytes|
|00001c70| 2e 20 54 68 69 73 20 73 | 69 6d 70 6c 69 66 69 65 |. This s|implifie|
|00001c80| 73 20 74 68 65 0d 0a 70 | 61 67 69 6e 67 20 6f 66 |s the..p|aging of|
|00001c90| 20 74 68 65 20 6d 61 74 | 72 69 78 20 62 6c 6f 63 | the mat|rix bloc|
|00001ca0| 6b 73 20 69 6e 20 76 6d | 6d 20 73 74 6f 72 61 67 |ks in vm|m storag|
|00001cb0| 65 2e 20 41 20 62 6c 6f | 63 6b 20 69 73 20 72 65 |e. A blo|ck is re|
|00001cc0| 61 64 0d 0a 66 72 6f 6d | 20 74 68 65 20 76 6d 6d |ad..from| the vmm|
|00001cd0| 20 61 6e 64 20 77 72 69 | 74 74 65 6e 2e 20 48 6f | and wri|tten. Ho|
|00001ce0| 77 65 76 65 72 2c 20 52 | 65 61 64 62 28 29 20 69 |wever, R|eadb() i|
|00001cf0| 73 20 6e 6f 74 20 61 73 | 0d 0a 65 66 66 69 63 69 |s not as|..effici|
|00001d00| 65 6e 74 2e 20 49 74 20 | 72 65 61 64 73 20 65 6c |ent. It |reads el|
|00001d10| 65 6d 65 6e 74 73 20 6f | 6e 65 20 61 74 20 61 20 |ements o|ne at a |
|00001d20| 74 69 6d 65 2e 20 54 6f | 20 75 73 65 0d 0a 57 72 |time. To| use..Wr|
|00001d30| 69 74 65 62 28 29 2c 20 | 79 6f 75 20 6d 75 73 74 |iteb(), |you must|
|00001d40| 20 75 73 65 20 69 74 20 | 61 73 20 61 20 6d 65 6d | use it |as a mem|
|00001d50| 62 65 72 20 66 75 6e 63 | 74 69 6f 6e 73 2c 20 65 |ber func|tions, e|
|00001d60| 67 2e 0d 0a 5c 76 65 72 | 62 2b 20 61 2e 57 72 69 |g...\ver|b+ a.Wri|
|00001d70| 74 65 62 28 22 6a 75 6e | 6b 2e 62 69 6e 22 2c 61 |teb("jun|k.bin",a|
|00001d80| 29 2b 20 77 68 65 72 65 | 20 61 20 69 73 20 61 20 |)+ where| a is a |
|00001d90| 56 4d 61 74 72 69 78 2e | 20 0d 0a 0d 0a 41 6e 6f |VMatrix.| ....Ano|
|00001da0| 74 68 65 72 20 66 75 6e | 63 74 69 6f 6e 20 66 6f |ther fun|ction fo|
|00001db0| 72 20 6c 6f 61 64 69 6e | 67 20 61 20 6d 61 74 72 |r loadin|g a matr|
|00001dc0| 69 78 20 69 73 0d 0a 4c | 6f 61 64 4d 61 74 28 29 |ix is..L|oadMat()|
|00001dd0| 5c 69 6e 64 65 78 7b 66 | 75 6e 63 74 69 6f 6e 73 |\index{f|unctions|
|00001de0| 21 4c 6f 61 64 4d 61 74 | 28 29 7d 2e 20 4c 6f 61 |!LoadMat|()}. Loa|
|00001df0| 64 4d 61 74 28 29 20 69 | 73 20 61 6e 6f 74 68 65 |dMat() i|s anothe|
|00001e00| 72 0d 0a 6d 65 6d 62 65 | 72 20 66 75 6e 63 74 69 |r..membe|r functi|
|00001e10| 6f 6e 20 6f 66 20 56 4d | 61 74 72 69 78 2e 20 49 |on of VM|atrix. I|
|00001e20| 74 20 6c 65 74 73 20 79 | 6f 75 20 65 6e 74 65 72 |t lets y|ou enter|
|00001e30| 20 6d 61 74 72 69 78 20 | 65 6c 65 6d 65 6e 74 73 | matrix |elements|
|00001e40| 0d 0a 69 6e 74 65 72 61 | 63 74 69 76 65 6c 79 2e |..intera|ctively.|
|00001e50| 20 0d 0a 0d 0a 5c 73 75 | 62 73 65 63 74 69 6f 6e | ....\su|bsection|
|00001e60| 7b 53 6f 72 74 69 6e 67 | 2c 20 53 75 62 73 65 74 |{Sorting|, Subset|
|00001e70| 74 69 6e 67 2c 20 61 6e | 64 20 43 6f 6e 63 61 74 |ting, an|d Concat|
|00001e80| 65 6e 61 74 69 6f 6e 7d | 0d 0a 4d 53 6f 72 74 28 |enation}|..MSort(|
|00001e90| 29 5c 69 6e 64 65 78 7b | 66 75 6e 63 74 69 6f 6e |)\index{|function|
|00001ea0| 73 21 4d 53 6f 72 74 28 | 29 7d 20 73 6f 72 74 73 |s!MSort(|)} sorts|
|00001eb0| 20 74 68 65 20 72 6f 77 | 73 20 6f 66 20 61 0d 0a | the row|s of a..|
|00001ec0| 6d 61 74 72 69 78 20 61 | 63 63 6f 72 64 69 6e 67 |matrix a|ccording|
|00001ed0| 20 74 6f 20 6f 6e 65 20 | 6f 66 20 74 68 65 20 63 | to one |of the c|
|00001ee0| 6f 6c 75 6d 6e 73 20 6f | 66 20 74 68 65 20 6d 61 |olumns o|f the ma|
|00001ef0| 74 72 69 78 2e 20 54 68 | 65 0d 0a 63 6f 6c 75 6d |trix. Th|e..colum|
|00001f00| 6e 20 65 6c 65 6d 65 6e | 74 73 20 61 72 65 20 73 |n elemen|ts are s|
|00001f10| 6f 72 74 65 64 20 62 79 | 20 61 20 68 65 61 70 20 |orted by| a heap |
|00001f20| 73 6f 72 74 2c 20 74 68 | 65 6e 20 74 68 65 20 72 |sort, th|en the r|
|00001f30| 6f 77 73 20 6f 66 0d 0a | 74 68 65 20 6e 65 77 20 |ows of..|the new |
|00001f40| 6d 61 74 72 69 78 20 61 | 72 65 20 73 74 6f 72 65 |matrix a|re store|
|00001f50| 64 20 69 6e 20 74 68 65 | 20 6f 72 64 65 72 20 6f |d in the| order o|
|00001f60| 66 20 74 68 65 20 73 6f | 72 74 65 64 20 63 6f 6c |f the so|rted col|
|00001f70| 75 6d 6e 0d 0a 65 6c 65 | 6d 65 6e 74 73 2e 20 49 |umn..ele|ments. I|
|00001f80| 66 20 74 68 65 20 6f 70 | 74 69 6f 6e 61 6c 20 70 |f the op|tional p|
|00001f90| 61 72 61 6d 65 74 65 72 | 20 6f 72 64 65 72 20 69 |arameter| order i|
|00001fa0| 73 20 73 75 70 70 6c 69 | 65 64 2c 20 61 6e 64 0d |s suppli|ed, and.|
|00001fb0| 0a 69 73 20 6e 6f 74 20 | 7a 65 72 6f 2c 20 74 68 |.is not |zero, th|
|00001fc0| 65 6e 20 63 6f 6c 75 6d | 6e 73 20 61 72 65 20 73 |en colum|ns are s|
|00001fd0| 6f 72 74 65 64 20 62 79 | 20 74 68 65 20 65 6c 65 |orted by| the ele|
|00001fe0| 6d 65 6e 74 73 20 6f 66 | 20 61 0d 0a 72 6f 77 2e |ments of| a..row.|
|00001ff0| 20 4e 6f 74 65 20 74 68 | 61 74 20 61 20 68 65 61 | Note th|at a hea|
|00002000| 70 20 73 6f 72 74 20 69 | 73 20 75 73 65 64 20 69 |p sort i|s used i|
|00002010| 6e 20 74 68 69 73 20 72 | 6f 75 74 69 6e 65 20 72 |n this r|outine r|
|00002020| 61 74 68 65 72 0d 0a 74 | 68 61 6e 20 74 68 65 20 |ather..t|han the |
|00002030| 73 79 73 74 65 6d 20 71 | 73 6f 72 74 28 29 2e 20 |system q|sort(). |
|00002040| 52 65 63 61 6c 6c 20 74 | 68 61 74 20 71 73 6f 72 |Recall t|hat qsor|
|00002050| 74 28 29 20 6f 6e 6c 79 | 20 77 6f 72 6b 73 20 6f |t() only| works o|
|00002060| 6e 0d 0a 76 65 63 74 6f | 72 73 20 73 74 6f 72 65 |n..vecto|rs store|
|00002070| 64 20 63 6f 6d 70 6c 65 | 74 65 6c 79 20 69 6e 20 |d comple|tely in |
|00002080| 52 41 4d 2e 20 0d 0a 0d | 0a 53 75 62 6d 61 74 28 |RAM. ...|.Submat(|
|00002090| 29 5c 69 6e 64 65 78 7b | 66 75 6e 63 74 69 6f 6e |)\index{|function|
|000020a0| 73 21 53 75 62 6d 61 74 | 28 29 7d 20 65 78 74 72 |s!Submat|()} extr|
|000020b0| 61 63 74 73 20 61 20 73 | 75 62 6d 61 74 72 69 78 |acts a s|ubmatrix|
|000020c0| 0d 0a 66 72 6f 6d 20 61 | 20 6d 61 74 72 69 78 2e |..from a| matrix.|
|000020d0| 20 54 68 65 20 6f 72 64 | 65 72 20 6f 66 20 74 68 | The ord|er of th|
|000020e0| 65 20 61 72 67 75 6d 65 | 6e 74 73 20 69 73 20 61 |e argume|nts is a|
|000020f0| 20 6c 69 74 74 6c 65 0d | 0a 77 65 69 72 64 2c 20 | little.|.weird, |
|00002100| 62 75 74 20 49 20 77 61 | 6e 74 65 64 20 74 6f 20 |but I wa|nted to |
|00002110| 74 61 6b 65 20 61 64 76 | 61 6e 74 61 67 65 20 6f |take adv|antage o|
|00002120| 66 20 64 65 66 61 75 6c | 74 0d 0a 61 72 67 75 6d |f defaul|t..argum|
|00002130| 65 6e 74 73 2e 20 54 68 | 65 20 62 6f 74 74 6f 6d |ents. Th|e bottom|
|00002140| 20 72 69 67 68 74 20 63 | 6f 72 6e 65 72 20 69 73 | right c|orner is|
|00002150| 20 73 75 70 70 6c 69 65 | 64 20 66 69 72 73 74 20 | supplie|d first |
|00002160| 62 79 20 74 68 65 0d 0a | 72 6f 77 20 6e 75 6d 62 |by the..|row numb|
|00002170| 65 72 2c 20 72 2c 20 61 | 6e 64 20 74 68 65 20 63 |er, r, a|nd the c|
|00002180| 6f 6c 75 6d 6e 20 6e 75 | 6d 62 65 72 20 63 2e 20 |olumn nu|mber c. |
|00002190| 54 68 65 20 64 65 66 61 | 75 6c 74 20 74 6f 70 0d |The defa|ult top.|
|000021a0| 0a 6c 65 66 74 20 63 6f | 72 6e 65 72 20 69 73 20 |.left co|rner is |
|000021b0| 28 31 2c 31 29 2e 20 59 | 6f 75 20 6d 61 79 20 73 |(1,1). Y|ou may s|
|000021c0| 75 70 70 6c 79 20 6f 74 | 68 65 72 20 74 6f 70 6d |upply ot|her topm|
|000021d0| 6f 73 74 20 72 6f 77 20 | 69 6e 0d 0a 74 68 65 20 |ost row |in..the |
|000021e0| 76 61 72 69 61 62 6c 65 | 20 6c 72 2c 20 61 6e 64 |variable| lr, and|
|000021f0| 20 6c 65 66 74 20 6d 6f | 73 74 20 63 6f 6c 75 6d | left mo|st colum|
|00002200| 6e 20 69 6e 20 74 68 65 | 20 76 61 72 69 61 62 6c |n in the| variabl|
|00002210| 65 20 6c 63 2e 0d 0a 53 | 75 62 6d 61 74 28 29 20 |e lc...S|ubmat() |
|00002220| 72 65 74 75 72 6e 73 20 | 61 20 56 4d 61 74 72 69 |returns |a VMatri|
|00002230| 78 20 72 65 66 65 72 65 | 6e 63 65 2e 20 54 68 65 |x refere|nce. The|
|00002240| 20 73 75 62 6d 61 74 72 | 69 78 20 68 61 73 20 74 | submatr|ix has t|
|00002250| 6f 70 0d 0a 6c 65 66 74 | 20 69 6e 64 69 63 65 73 |op..left| indices|
|00002260| 20 6f 66 20 28 31 2c 31 | 29 2e 0d 0a 0d 0a 56 65 | of (1,1|).....Ve|
|00002270| 72 74 69 63 61 6c 20 61 | 6e 64 20 68 6f 72 69 7a |rtical a|nd horiz|
|00002280| 6f 6e 74 61 6c 20 63 6f | 6e 63 61 74 65 6e 61 74 |ontal co|ncatenat|
|00002290| 69 6f 6e 20 69 73 20 61 | 63 68 69 65 76 65 64 20 |ion is a|chieved |
|000022a0| 74 68 72 6f 75 67 68 0d | 0a 74 68 65 20 66 75 6e |through.|.the fun|
|000022b0| 63 74 69 6f 6e 73 20 43 | 76 28 29 5c 69 6e 64 65 |ctions C|v()\inde|
|000022c0| 78 7b 66 75 6e 63 74 69 | 6f 6e 73 21 43 76 28 29 |x{functi|ons!Cv()|
|000022d0| 7d 20 61 6e 64 0d 0a 43 | 68 28 29 5c 69 6e 64 65 |} and..C|h()\inde|
|000022e0| 78 7b 66 75 6e 63 74 69 | 6f 6e 73 21 43 68 28 29 |x{functi|ons!Ch()|
|000022f0| 7d 2e 20 42 6f 74 68 20 | 66 75 6e 63 74 69 6f 6e |}. Both |function|
|00002300| 73 20 74 61 6b 65 20 74 | 77 6f 0d 0a 6d 61 74 72 |s take t|wo..matr|
|00002310| 69 63 65 73 20 61 73 20 | 61 72 67 75 6d 65 6e 74 |ices as |argument|
|00002320| 73 2e 20 54 68 65 20 6d | 61 74 72 69 63 65 73 20 |s. The m|atrices |
|00002330| 6d 75 73 74 20 68 61 76 | 65 20 74 68 65 20 73 61 |must hav|e the sa|
|00002340| 6d 65 0d 0a 6e 75 6d 62 | 65 72 20 6f 66 20 63 6f |me..numb|er of co|
|00002350| 6c 75 6d 6e 73 20 74 6f | 20 62 65 20 76 65 72 74 |lumns to| be vert|
|00002360| 69 63 61 6c 6c 79 20 63 | 6f 6e 63 61 74 65 6e 61 |ically c|oncatena|
|00002370| 74 65 64 2c 20 61 6e 64 | 20 74 68 65 0d 0a 73 61 |ted, and| the..sa|
|00002380| 6d 65 20 6e 75 6d 62 65 | 72 20 6f 66 20 72 6f 77 |me numbe|r of row|
|00002390| 73 20 74 6f 20 62 65 20 | 68 6f 72 69 7a 6f 6e 74 |s to be |horizont|
|000023a0| 61 6c 6c 79 20 63 6f 6e | 63 61 74 65 6e 61 74 65 |ally con|catenate|
|000023b0| 64 2e 20 42 6f 74 68 0d | 0a 66 75 6e 63 74 69 6f |d. Both.|.functio|
|000023c0| 6e 73 20 72 65 74 75 72 | 6e 20 61 20 56 4d 61 74 |ns retur|n a VMat|
|000023d0| 72 69 78 20 72 65 66 65 | 72 65 6e 63 65 2e 20 0d |rix refe|rence. .|
|000023e0| 0a 0d 0a 5c 73 75 62 73 | 65 63 74 69 6f 6e 7b 45 |...\subs|ection{E|
|000023f0| 6c 65 6d 65 6e 74 77 69 | 73 65 20 4f 70 65 72 61 |lementwi|se Opera|
|00002400| 74 6f 72 73 7d 0d 0a 46 | 6f 75 72 20 65 6c 65 6d |tors}..F|our elem|
|00002410| 65 6e 74 77 69 73 65 20 | 66 75 6e 63 74 69 6f 6e |entwise |function|
|00002420| 73 20 61 72 65 20 70 72 | 6f 76 69 64 65 64 3a 20 |s are pr|ovided: |
|00002430| 4d 65 78 70 28 29 2c 0d | 0a 4d 61 62 73 28 29 2c |Mexp(),.|.Mabs(),|
|00002440| 20 4d 73 71 72 74 28 29 | 2c 20 61 6e 64 0d 0a 4d | Msqrt()|, and..M|
|00002450| 6c 6f 67 28 29 2e 5c 69 | 6e 64 65 78 7b 66 75 6e |log().\i|ndex{fun|
|00002460| 63 74 69 6f 6e 73 21 4d | 65 78 70 28 29 2c 4d 61 |ctions!M|exp(),Ma|
|00002470| 62 73 28 29 2c 4d 73 71 | 72 74 28 29 2c 4d 6c 6f |bs(),Msq|rt(),Mlo|
|00002480| 67 28 29 7d 2e 0d 0a 54 | 68 65 73 65 20 74 61 6b |g()}...T|hese tak|
|00002490| 65 20 74 68 65 20 65 6c | 65 6d 65 6e 74 77 69 73 |e the el|ementwis|
|000024a0| 65 20 65 78 70 6f 6e 65 | 6e 74 2c 20 61 62 73 6f |e expone|nt, abso|
|000024b0| 6c 75 74 65 20 76 61 6c | 75 65 2c 20 73 71 75 61 |lute val|ue, squa|
|000024c0| 72 65 0d 0a 72 6f 6f 74 | 2c 20 61 6e 64 20 6e 61 |re..root|, and na|
|000024d0| 74 75 72 61 6c 20 6c 6f | 67 61 72 69 74 68 6d 2e |tural lo|garithm.|
|000024e0| 20 41 72 67 75 6d 65 6e | 74 20 72 61 6e 67 65 73 | Argumen|t ranges|
|000024f0| 20 61 72 65 20 63 68 65 | 63 6b 65 64 20 69 6e 0d | are che|cked in.|
|00002500| 0a 74 68 65 20 73 71 75 | 61 72 65 20 72 6f 6f 74 |.the squ|are root|
|00002510| 20 61 6e 64 20 6c 6f 67 | 61 72 69 74 68 6d 20 66 | and log|arithm f|
|00002520| 75 6e 63 74 69 6f 6e 73 | 2e 20 49 66 20 61 6e 20 |unctions|. If an |
|00002530| 69 6e 76 61 6c 69 64 0d | 0a 61 72 67 75 6d 65 6e |invalid.|.argumen|
|00002540| 74 20 69 73 20 67 69 76 | 65 6e 2c 20 74 68 65 20 |t is giv|en, the |
|00002550| 70 72 6f 67 72 61 6d 20 | 74 65 72 6d 69 6e 61 74 |program |terminat|
|00002560| 65 73 20 74 68 72 6f 75 | 67 68 20 74 68 65 20 65 |es throu|gh the e|
|00002570| 72 72 6f 72 0d 0a 66 75 | 6e 63 74 69 6f 6e 2c 20 |rror..fu|nction, |
|00002580| 44 69 73 70 61 74 63 68 | 2d 24 3e 24 4e 72 65 72 |Dispatch|-$>$Nrer|
|00002590| 72 6f 72 28 29 2e 20 54 | 68 69 73 20 66 75 6e 63 |ror(). T|his func|
|000025a0| 74 69 6f 6e 20 77 61 73 | 20 64 65 66 69 6e 65 64 |tion was| defined|
|000025b0| 20 61 0d 0a 72 65 74 75 | 72 6e 69 6e 67 20 61 20 | a..retu|rning a |
|000025c0| 64 6f 75 62 6c 65 20 73 | 6f 20 74 68 61 74 20 69 |double s|o that i|
|000025d0| 74 20 63 6f 75 6c 64 20 | 62 65 20 75 73 65 64 20 |t could |be used |
|000025e0| 69 6e 20 74 68 65 20 74 | 65 72 6e 61 72 79 0d 0a |in the t|ernary..|
|000025f0| 6f 70 65 72 61 74 6f 72 | 20 61 73 20 61 6e 20 65 |operator| as an e|
|00002600| 72 72 6f 72 20 62 72 61 | 6e 63 68 2e 20 54 68 65 |rror bra|nch. The|
|00002610| 20 66 75 6e 63 74 69 6f | 6e 73 20 72 65 74 75 72 | functio|ns retur|
|00002620| 6e 0d 0a 72 65 66 65 72 | 65 6e 63 65 73 20 74 6f |n..refer|ences to|
|00002630| 20 61 20 56 4d 61 74 72 | 69 78 2e 0d 0a 0d 0a 5c | a VMatr|ix.....\|
|00002640| 73 65 63 74 69 6f 6e 7b | 4d 61 74 68 20 46 75 6e |section{|Math Fun|
|00002650| 63 74 69 6f 6e 73 7d 0d | 0a 5c 73 75 62 73 65 63 |ctions}.|.\subsec|
|00002660| 74 69 6f 6e 7b 54 72 61 | 6e 28 29 7d 0d 0a 54 72 |tion{Tra|n()}..Tr|
|00002670| 61 6e 28 29 5c 69 6e 64 | 65 78 7b 66 75 6e 63 74 |an()\ind|ex{funct|
|00002680| 69 6f 6e 73 21 54 72 61 | 6e 28 29 7d 20 72 65 74 |ions!Tra|n()} ret|
|00002690| 75 72 6e 73 20 74 68 65 | 20 74 72 61 6e 73 70 6f |urns the| transpo|
|000026a0| 73 65 20 6f 66 20 61 0d | 0a 6d 61 74 72 69 78 2e |se of a.|.matrix.|
|000026b0| 5c 66 6f 6f 74 6e 6f 74 | 65 7b 54 68 69 73 20 69 |\footnot|e{This i|
|000026c0| 73 20 6f 6e 65 20 6f 66 | 20 6d 79 20 64 69 73 61 |s one of| my disa|
|000026d0| 70 70 6f 69 6e 74 6d 65 | 6e 74 73 20 77 69 74 68 |ppointme|nts with|
|000026e0| 20 43 2b 2b 2e 20 49 0d | 0a 77 6f 75 6c 64 20 68 | C++. I.|.would h|
|000026f0| 61 76 65 20 70 72 65 66 | 65 72 72 65 64 20 74 6f |ave pref|erred to|
|00002700| 20 6f 76 65 72 6c 6f 61 | 64 20 61 20 70 6f 73 74 | overloa|d a post|
|00002710| 66 69 78 20 6f 70 65 72 | 61 74 6f 72 2c 20 73 61 |fix oper|ator, sa|
|00002720| 79 20 60 2c 0d 0a 66 6f | 72 20 74 68 65 20 74 72 |y `,..fo|r the tr|
|00002730| 61 6e 73 70 6f 73 65 2c | 20 62 75 74 20 73 75 63 |anspose,| but suc|
|00002740| 68 20 61 6e 20 6f 70 65 | 72 61 74 6f 72 20 64 6f |h an ope|rator do|
|00002750| 65 73 20 6e 6f 74 20 65 | 78 69 73 74 20 69 6e 0d |es not e|xist in.|
|00002760| 0a 43 2b 2b 2e 20 53 6f | 20 77 68 61 74 2c 20 49 |.C++. So| what, I|
|00002770| 20 6e 65 76 65 72 20 69 | 6e 74 65 6e 64 65 64 20 | never i|ntended |
|00002780| 74 6f 20 77 72 69 74 65 | 20 41 50 4c 2e 7d 0d 0a |to write| APL.}..|
|00002790| 0d 0a 5c 73 75 62 73 65 | 63 74 69 6f 6e 7b 54 72 |..\subse|ction{Tr|
|000027a0| 61 63 65 28 29 7d 0d 0a | 54 72 61 63 65 28 29 5c |ace()}..|Trace()\|
|000027b0| 69 6e 64 65 78 7b 66 75 | 6e 63 74 69 6f 6e 73 21 |index{fu|nctions!|
|000027c0| 54 72 61 63 65 28 29 7d | 20 72 65 74 75 72 6e 73 |Trace()}| returns|
|000027d0| 20 74 68 65 20 74 72 61 | 63 65 20 6f 66 20 61 0d | the tra|ce of a.|
|000027e0| 0a 73 71 75 61 72 65 20 | 6d 61 74 72 69 78 2c 20 |.square |matrix, |
|000027f0| 69 2e 65 2e 20 74 68 65 | 20 73 75 6d 20 6f 66 20 |i.e. the| sum of |
|00002800| 69 74 73 20 64 69 61 67 | 6f 6e 61 6c 20 65 6c 65 |its diag|onal ele|
|00002810| 6d 65 6e 74 73 2e 0d 0a | 0d 0a 5c 73 75 62 73 65 |ments...|..\subse|
|00002820| 63 74 69 6f 6e 7b 49 64 | 65 6e 74 28 29 2c 20 48 |ction{Id|ent(), H|
|00002830| 65 6c 6d 28 29 2c 20 46 | 69 6c 6c 28 29 2c 20 49 |elm(), F|ill(), I|
|00002840| 6e 64 65 78 28 29 7d 0d | 0a 54 68 65 73 65 20 74 |ndex()}.|.These t|
|00002850| 68 72 65 65 20 66 75 6e | 63 74 69 6f 6e 73 20 63 |hree fun|ctions c|
|00002860| 72 65 61 74 65 20 73 70 | 65 63 69 61 6c 6c 79 20 |reate sp|ecially |
|00002870| 70 61 74 74 65 72 6e 65 | 64 20 6d 61 74 72 69 63 |patterne|d matric|
|00002880| 65 73 2e 0d 0a 49 64 65 | 6e 74 28 29 5c 69 6e 64 |es...Ide|nt()\ind|
|00002890| 65 78 7b 66 75 6e 63 74 | 69 6f 6e 73 21 49 64 65 |ex{funct|ions!Ide|
|000028a0| 6e 74 28 29 7d 20 63 72 | 65 61 74 65 73 20 61 6e |nt()} cr|eates an|
|000028b0| 20 6e 78 6e 20 69 64 65 | 6e 74 69 74 79 0d 0a 6d | nxn ide|ntity..m|
|000028c0| 61 74 72 69 78 2e 20 0d | 0a 0d 0a 48 65 6c 6d 28 |atrix. .|...Helm(|
|000028d0| 29 5c 69 6e 64 65 78 7b | 66 75 6e 63 74 69 6f 6e |)\index{|function|
|000028e0| 73 21 48 65 6c 6d 28 29 | 7d 20 63 72 65 61 74 65 |s!Helm()|} create|
|000028f0| 73 20 61 6e 20 6e 78 6e | 20 48 65 6c 6d 65 72 74 |s an nxn| Helmert|
|00002900| 0d 0a 6d 61 74 72 69 78 | 2e 20 49 74 20 69 73 20 |..matrix|. It is |
|00002910| 75 73 65 66 75 6c 20 69 | 6e 20 6d 69 78 65 64 20 |useful i|n mixed |
|00002920| 6c 69 6e 65 61 72 20 6d | 6f 64 65 6c 73 2e 20 49 |linear m|odels. I|
|00002930| 74 20 69 73 20 61 6e 0d | 0a 6f 72 74 68 6f 6e 6f |t is an.|.orthono|
|00002940| 72 6d 61 6c 20 6d 61 74 | 72 69 78 20 69 6e 20 74 |rmal mat|rix in t|
|00002950| 68 65 20 73 65 6e 73 65 | 20 74 68 61 74 20 5c 76 |he sense| that \v|
|00002960| 65 72 62 2b 20 48 27 48 | 3d 48 48 27 3d 49 2b 2e |erb+ H'H|=HH'=I+.|
|00002970| 20 54 68 65 0d 0a 65 6c | 65 6d 65 6e 74 73 20 6f | The..el|ements o|
|00002980| 66 20 61 6e 20 6e 78 6e | 20 48 65 6c 6d 65 72 74 |f an nxn| Helmert|
|00002990| 20 6d 61 74 72 69 78 20 | 61 72 65 20 67 69 76 65 | matrix |are give|
|000029a0| 6e 20 62 79 0d 0a 24 24 | 0d 0a 20 5c 6c 65 66 74 |n by..$$|.. \left|
|000029b0| 5b 0d 0a 5c 62 65 67 69 | 6e 7b 61 72 72 61 79 7d |[..\begi|n{array}|
|000029c0| 7b 63 63 63 63 63 7d 0d | 0a 7b 31 20 5c 6f 76 65 |{ccccc}.|.{1 \ove|
|000029d0| 72 20 5c 73 71 72 74 7b | 6e 7d 7d 26 7b 31 20 5c |r \sqrt{|n}}&{1 \|
|000029e0| 6f 76 65 72 20 5c 73 71 | 72 74 7b 32 7d 7d 26 7b |over \sq|rt{2}}&{|
|000029f0| 31 5c 6f 76 65 72 20 5c | 73 71 72 74 7b 33 5c 63 |1\over \|sqrt{3\c|
|00002a00| 64 6f 74 20 32 7d 7d 26 | 5c 6c 64 6f 74 73 26 0d |dot 2}}&|\ldots&.|
|00002a10| 0a 20 20 20 7b 31 20 5c | 6f 76 65 72 20 5c 73 71 |. {1 \|over \sq|
|00002a20| 72 74 7b 20 6e 28 6e 2d | 31 29 20 7d 7d 20 5c 5c |rt{ n(n-|1) }} \\|
|00002a30| 0d 0a 7b 31 20 5c 6f 76 | 65 72 20 5c 73 71 72 74 |..{1 \ov|er \sqrt|
|00002a40| 7b 6e 7d 7d 26 7b 2d 31 | 5c 6f 76 65 72 20 5c 73 |{n}}&{-1|\over \s|
|00002a50| 71 72 74 7b 32 7d 7d 26 | 7b 31 5c 6f 76 65 72 20 |qrt{2}}&|{1\over |
|00002a60| 5c 73 71 72 74 7b 33 5c | 63 64 6f 74 20 32 7d 7d |\sqrt{3\|cdot 2}}|
|00002a70| 26 5c 6c 64 6f 74 73 26 | 0d 0a 20 20 20 7b 31 20 |&\ldots&|.. {1 |
|00002a80| 5c 6f 76 65 72 20 5c 73 | 71 72 74 7b 20 6e 28 6e |\over \s|qrt{ n(n|
|00002a90| 2d 31 29 20 7d 7d 20 5c | 5c 0d 0a 7b 31 20 5c 6f |-1) }} \|\..{1 \o|
|00002aa0| 76 65 72 20 5c 73 71 72 | 74 7b 6e 7d 7d 26 20 30 |ver \sqr|t{n}}& 0|
|00002ab0| 20 26 7b 2d 32 5c 6f 76 | 65 72 20 5c 73 71 72 74 | &{-2\ov|er \sqrt|
|00002ac0| 7b 33 5c 63 64 6f 74 20 | 32 7d 7d 26 5c 6c 64 6f |{3\cdot |2}}&\ldo|
|00002ad0| 74 73 26 7b 31 20 5c 6f | 76 65 72 20 5c 73 71 72 |ts&{1 \o|ver \sqr|
|00002ae0| 74 7b 20 6e 28 6e 2d 31 | 29 0d 0a 7d 7d 20 5c 5c |t{ n(n-1|)..}} \\|
|00002af0| 0d 0a 5c 76 64 6f 74 73 | 20 26 20 5c 76 64 6f 74 |..\vdots| & \vdot|
|00002b00| 73 20 26 20 30 20 26 20 | 5c 6c 64 6f 74 73 20 26 |s & 0 & |\ldots &|
|00002b10| 20 7b 31 5c 6f 76 65 72 | 20 5c 73 71 72 74 7b 6e | {1\over| \sqrt{n|
|00002b20| 28 6e 2d 31 29 7d 7d 5c | 5c 0d 0a 5c 76 64 6f 74 |(n-1)}}\|\..\vdot|
|00002b30| 73 20 26 20 5c 76 64 6f | 74 73 20 26 20 5c 76 64 |s & \vdo|ts & \vd|
|00002b40| 6f 74 73 20 26 20 5c 6c | 64 6f 74 73 20 26 20 7b |ots & \l|dots & {|
|00002b50| 2d 28 6e 2d 31 29 5c 6f | 76 65 72 20 5c 73 71 72 |-(n-1)\o|ver \sqr|
|00002b60| 74 7b 6e 28 6e 2d 31 29 | 7d 7d 0d 0a 5c 65 6e 64 |t{n(n-1)|}}..\end|
|00002b70| 7b 61 72 72 61 79 7d 0d | 0a 5c 72 69 67 68 74 5d |{array}.|.\right]|
|00002b80| 0d 0a 24 24 0d 0a 0d 0a | 46 69 6c 6c 28 29 5c 69 |..$$....|Fill()\i|
|00002b90| 6e 64 65 78 7b 66 75 6e | 63 74 69 6f 6e 73 21 46 |ndex{fun|ctions!F|
|00002ba0| 69 6c 6c 28 29 7d 20 63 | 72 65 61 74 65 73 20 61 |ill()} c|reates a|
|00002bb0| 6e 20 24 72 78 63 24 20 | 6d 61 74 72 69 78 20 6f |n $rxc$ |matrix o|
|00002bc0| 66 0d 0a 65 6c 65 6d 65 | 6e 74 73 20 6f 66 20 24 |f..eleme|nts of $|
|00002bd0| 64 24 2e 20 49 74 20 72 | 65 74 75 72 6e 73 20 61 |d$. It r|eturns a|
|00002be0| 20 56 4d 61 74 72 69 78 | 20 72 65 66 65 72 65 6e | VMatrix| referen|
|00002bf0| 63 65 2e 20 54 68 65 0d | 0a 48 65 6c 6d 65 72 74 |ce. The.|.Helmert|
|00002c00| 20 6d 61 74 72 69 78 20 | 69 73 20 61 20 73 65 74 | matrix |is a set|
|00002c10| 20 6f 66 20 65 69 67 65 | 6e 76 65 63 74 6f 72 73 | of eige|nvectors|
|00002c20| 20 6f 66 20 74 68 65 20 | 6d 61 74 72 69 78 20 0d | of the |matrix .|
|00002c30| 0a 0d 0a 5c 62 65 67 69 | 6e 7b 65 71 6e 61 72 72 |...\begi|n{eqnarr|
|00002c40| 61 79 2a 7d 0d 0a 56 20 | 26 20 3d 20 26 20 5c 70 |ay*}..V |& = & \p|
|00002c50| 68 69 5f 30 20 5c 68 62 | 6f 78 7b 49 64 65 6e 74 |hi_0 \hb|ox{Ident|
|00002c60| 7d 28 6e 29 20 2b 20 5c | 68 62 6f 78 7b 46 69 6c |}(n) + \|hbox{Fil|
|00002c70| 6c 7d 28 6e 2c 6e 2c 5c | 70 68 69 5f 31 29 20 5c |l}(n,n,\|phi_1) \|
|00002c80| 5c 0d 0a 20 20 26 20 3d | 20 26 20 5c 68 62 6f 78 |\.. & =| & \hbox|
|00002c90| 7b 48 65 6c 6d 7d 28 6e | 29 20 0d 0a 20 20 20 20 |{Helm}(n|) .. |
|00002ca0| 20 20 20 20 5c 68 62 6f | 78 7b 44 69 61 67 7d 5f | \hbo|x{Diag}_|
|00002cb0| 6e 28 5c 70 68 69 5f 30 | 20 2b 20 6e 5c 70 68 69 |n(\phi_0| + n\phi|
|00002cc0| 5f 31 2c 20 5c 70 68 69 | 5f 30 2c 20 5c 6c 64 6f |_1, \phi|_0, \ldo|
|00002cd0| 74 73 2c 20 5c 70 68 69 | 5f 30 29 0d 0a 20 20 20 |ts, \phi|_0).. |
|00002ce0| 20 20 20 20 20 5c 68 62 | 6f 78 7b 54 72 61 6e 7d | \hb|ox{Tran}|
|00002cf0| 28 20 5c 68 62 6f 78 7b | 48 65 6c 6d 7d 20 28 6e |( \hbox{|Helm} (n|
|00002d00| 29 29 20 0d 0a 5c 65 6e | 64 7b 65 71 6e 61 72 72 |)) ..\en|d{eqnarr|
|00002d10| 61 79 2a 7d 0d 0a 0d 0a | 49 6e 64 65 78 28 29 5c |ay*}....|Index()\|
|00002d20| 69 6e 64 65 78 7b 66 75 | 6e 63 74 69 6f 6e 73 21 |index{fu|nctions!|
|00002d30| 49 6e 64 65 78 28 29 7d | 20 63 72 65 61 74 65 73 |Index()}| creates|
|00002d40| 20 69 6e 64 65 78 20 6d | 61 74 72 69 63 65 73 2e | index m|atrices.|
|00002d50| 20 49 74 0d 0a 73 69 6d | 70 6c 69 66 69 65 73 20 | It..sim|plifies |
|00002d60| 6d 61 6b 69 6e 67 20 61 | 20 63 6f 6c 75 6d 6e 20 |making a| column |
|00002d70| 77 68 6f 73 65 20 65 6c | 65 6d 65 6e 74 73 20 72 |whose el|ements r|
|00002d80| 61 6e 67 65 20 66 72 6f | 6d 20 5c 76 65 72 62 2b |ange fro|m \verb+|
|00002d90| 6c 6f 77 65 72 2b 20 74 | 6f 0d 0a 5c 76 65 72 62 |lower+ t|o..\verb|
|00002da0| 2b 75 70 70 65 72 2b 20 | 62 79 20 69 6e 63 72 65 |+upper+ |by incre|
|00002db0| 6d 65 6e 74 73 20 6f 66 | 20 5c 76 65 72 62 2b 73 |ments of| \verb+s|
|00002dc0| 74 65 70 2b 2e 20 49 66 | 20 5c 76 65 72 62 2b 6c |tep+. If| \verb+l|
|00002dd0| 6f 77 65 72 2b 20 69 73 | 0d 0a 67 72 65 61 74 65 |ower+ is|..greate|
|00002de0| 72 20 74 68 61 6e 20 5c | 76 65 72 62 2b 75 70 70 |r than \|verb+upp|
|00002df0| 65 72 2b 2c 20 74 68 65 | 6e 20 5c 76 65 72 62 2b |er+, the|n \verb+|
|00002e00| 73 74 65 70 2b 20 73 68 | 6f 75 6c 64 20 62 65 20 |step+ sh|ould be |
|00002e10| 6e 65 67 61 74 69 76 65 | 2e 0d 0a 54 68 65 20 64 |negative|...The d|
|00002e20| 65 66 61 75 6c 74 20 73 | 74 65 70 20 73 69 7a 65 |efault s|tep size|
|00002e30| 20 69 73 20 31 2e 0d 0a | 0d 0a 5c 73 75 62 73 65 | is 1...|..\subse|
|00002e40| 63 74 69 6f 6e 7b 53 77 | 65 65 70 28 29 20 61 6e |ction{Sw|eep() an|
|00002e50| 64 20 49 6e 76 28 29 7d | 0d 0a 53 77 65 65 70 28 |d Inv()}|..Sweep(|
|00002e60| 29 5c 69 6e 64 65 78 7b | 66 75 6e 63 74 69 6f 6e |)\index{|function|
|00002e70| 73 21 53 77 65 65 70 28 | 29 7d 20 6d 61 79 20 62 |s!Sweep(|)} may b|
|00002e80| 65 20 75 73 65 64 20 66 | 6f 72 20 63 72 65 61 74 |e used f|or creat|
|00002e90| 69 6e 67 20 61 0d 0a 67 | 65 6e 65 72 61 6c 69 7a |ing a..g|eneraliz|
|00002ea0| 65 64 20 69 6e 76 65 72 | 73 65 20 6f 66 20 61 20 |ed inver|se of a |
|00002eb0| 73 71 75 61 72 65 20 6d | 61 74 72 69 78 20 75 73 |square m|atrix us|
|00002ec0| 69 6e 67 20 47 61 75 73 | 73 69 61 6e 0d 0a 65 6c |ing Gaus|sian..el|
|00002ed0| 69 6d 69 6e 61 74 69 6f | 6e 2e 20 41 20 67 65 6e |iminatio|n. A gen|
|00002ee0| 65 72 61 6c 69 7a 65 64 | 20 69 6e 76 65 72 73 65 |eralized| inverse|
|00002ef0| 20 6f 66 20 74 68 65 20 | 6d 61 74 72 69 78 20 24 | of the |matrix $|
|00002f00| 41 24 2c 20 73 61 79 20 | 24 41 5e 2b 24 0d 0a 73 |A$, say |$A^+$..s|
|00002f10| 61 74 69 73 66 69 65 73 | 20 74 68 65 20 70 72 6f |atisfies| the pro|
|00002f20| 70 65 72 74 69 65 73 2c | 20 24 41 5e 2b 41 41 5e |perties,| $A^+AA^|
|00002f30| 2b 3d 41 5e 2b 24 20 61 | 6e 64 20 24 41 41 5e 2b |+=A^+$ a|nd $AA^+|
|00002f40| 41 3d 41 24 2e 0d 0a 41 | 6c 73 6f 2c 20 74 68 65 |A=A$...A|lso, the|
|00002f50| 20 71 75 61 6e 74 69 74 | 79 20 24 41 5e 2b 41 24 | quantit|y $A^+A$|
|00002f60| 20 69 73 20 61 6e 20 69 | 64 65 6d 70 6f 74 65 6e | is an i|dempoten|
|00002f70| 74 20 6d 61 74 72 69 78 | 20 6f 66 20 7a 65 72 6f |t matrix| of zero|
|00002f80| 73 0d 0a 61 6e 64 20 6f | 6e 65 73 2c 20 73 6f 20 |s..and o|nes, so |
|00002f90| 69 74 73 20 72 61 6e 6b | 20 69 73 20 69 74 73 20 |its rank| is its |
|00002fa0| 74 72 61 63 65 2e 20 54 | 68 65 73 65 20 61 72 65 |trace. T|hese are|
|00002fb0| 20 68 61 6e 64 79 0d 0a | 70 72 6f 70 65 72 74 69 | handy..|properti|
|00002fc0| 65 73 20 77 68 65 6e 20 | 64 6f 69 6e 67 20 6c 69 |es when |doing li|
|00002fd0| 6e 65 61 72 20 6d 6f 64 | 65 6c 73 2e 20 0d 0a 0d |near mod|els. ...|
|00002fe0| 0a 54 68 65 20 61 72 67 | 75 6d 65 6e 74 73 20 6f |.The arg|uments o|
|00002ff0| 66 20 53 77 65 65 70 28 | 29 20 61 72 65 20 74 68 |f Sweep(|) are th|
|00003000| 65 20 72 6f 77 73 20 74 | 6f 20 62 65 20 65 6c 69 |e rows t|o be eli|
|00003010| 6d 69 6e 61 74 65 64 2c | 0d 0a 66 72 6f 6d 20 6b |minated,|..from k|
|00003020| 31 20 74 6f 20 6b 32 2c | 20 61 6e 64 20 74 68 65 |1 to k2,| and the|
|00003030| 20 6d 61 74 72 69 78 20 | 74 6f 20 6f 70 65 72 61 | matrix |to opera|
|00003040| 74 65 20 6f 6e 2e 20 49 | 66 20 61 6c 6c 20 72 6f |te on. I|f all ro|
|00003050| 77 73 0d 0a 61 72 65 20 | 65 6c 69 6d 69 6e 61 74 |ws..are |eliminat|
|00003060| 65 64 2c 20 61 6e 64 20 | 74 68 65 20 6d 61 74 72 |ed, and |the matr|
|00003070| 69 78 20 68 61 73 20 66 | 75 6c 6c 20 72 61 6e 6b |ix has f|ull rank|
|00003080| 2c 20 74 68 65 6e 20 74 | 68 65 0d 0a 6d 61 74 72 |, then t|he..matr|
|00003090| 69 78 20 69 73 20 69 6e | 76 65 72 74 65 64 2e 20 |ix is in|verted. |
|000030a0| 54 68 65 20 66 75 6e 63 | 74 69 6f 6e 2c 0d 0a 49 |The func|tion,..I|
|000030b0| 6e 76 28 29 5c 69 6e 64 | 65 78 7b 66 75 6e 63 74 |nv()\ind|ex{funct|
|000030c0| 69 6f 6e 73 21 49 6e 76 | 28 29 7d 2c 20 70 65 72 |ions!Inv|()}, per|
|000030d0| 66 6f 72 6d 73 20 6d 61 | 74 72 69 78 20 69 6e 76 |forms ma|trix inv|
|000030e0| 65 72 73 69 6f 6e 20 62 | 79 0d 0a 65 6c 69 6d 69 |ersion b|y..elimi|
|000030f0| 6e 61 74 69 6e 67 20 61 | 6c 6c 20 72 6f 77 73 20 |nating a|ll rows |
|00003100| 61 6e 64 20 63 6f 6c 75 | 6d 6e 73 2e 20 49 66 20 |and colu|mns. If |
|00003110| 61 6e 79 20 70 69 76 6f | 74 20 69 73 20 6c 65 73 |any pivo|t is les|
|00003120| 73 20 74 68 61 6e 0d 0a | 31 2e 30 45 2d 38 2c 20 |s than..|1.0E-8, |
|00003130| 74 68 65 6e 20 74 68 65 | 20 72 6f 77 20 61 6e 64 |then the| row and|
|00003140| 20 63 6f 6c 75 6d 6e 20 | 62 65 69 6e 67 20 65 6c | column |being el|
|00003150| 69 6d 69 6e 61 74 65 64 | 20 69 73 20 73 65 74 20 |iminated| is set |
|00003160| 74 6f 0d 0a 7a 65 72 6f | 2e 20 54 68 69 73 20 70 |to..zero|. This p|
|00003170| 72 6f 63 65 64 75 72 65 | 20 63 72 65 61 74 65 73 |rocedure| creates|
|00003180| 20 24 41 5e 2b 24 2e 20 | 0d 0a 0d 0a 53 77 65 65 | $A^+$. |....Swee|
|00003190| 70 28 29 20 61 6c 73 6f | 20 73 69 6d 70 6c 69 66 |p() also| simplif|
|000031a0| 69 65 73 20 74 68 65 20 | 63 61 6c 63 75 6c 61 74 |ies the |calculat|
|000031b0| 69 6f 6e 20 6f 66 20 72 | 65 67 72 65 73 73 69 6f |ion of r|egressio|
|000031c0| 6e 0d 0a 63 6f 65 66 66 | 69 63 69 65 6e 74 73 20 |n..coeff|icients |
|000031d0| 61 6e 64 20 74 68 65 20 | 72 65 73 69 64 75 61 6c |and the |residual|
|000031e0| 20 6d 65 61 6e 20 73 71 | 75 61 72 65 2e 20 43 6f | mean sq|uare. Co|
|000031f0| 6e 73 69 64 65 72 20 74 | 68 65 0d 0a 72 65 67 72 |nsider t|he..regr|
|00003200| 65 73 73 69 6f 6e 20 6f | 66 20 24 58 5f 7b 4e 78 |ession o|f $X_{Nx|
|00003210| 70 7d 24 20 6f 6e 20 24 | 59 5f 7b 4e 78 31 7d 24 |p}$ on $|Y_{Nx1}$|
|00003220| 2e 20 54 68 65 20 73 74 | 65 70 73 20 66 6f 72 0d |. The st|eps for.|
|00003230| 0a 63 61 6c 63 75 6c 61 | 74 69 6e 67 20 74 68 65 |.calcula|ting the|
|00003240| 20 72 65 67 72 65 73 73 | 69 6f 6e 20 63 6f 65 66 | regress|ion coef|
|00003250| 66 69 63 69 65 6e 74 73 | 20 61 72 65 20 61 73 20 |ficients| are as |
|00003260| 66 6f 6c 6c 6f 77 73 3a | 0d 0a 5c 62 65 67 69 6e |follows:|..\begin|
|00003270| 7b 65 6e 75 6d 65 72 61 | 74 65 7d 0d 0a 5c 69 74 |{enumera|te}..\it|
|00003280| 65 6d 20 43 6f 6e 63 61 | 74 65 6e 61 74 65 20 24 |em Conca|tenate $|
|00003290| 58 24 20 61 6e 64 20 24 | 59 24 20 75 73 69 6e 67 |X$ and $|Y$ using|
|000032a0| 20 74 68 65 20 73 74 61 | 74 65 6d 65 6e 74 0d 0a | the sta|tement..|
|000032b0| 20 20 20 20 20 20 56 4d | 61 74 72 69 78 20 58 59 | VM|atrix XY|
|000032c0| 20 3d 20 43 68 28 58 2c | 59 29 3b 20 54 68 69 73 | = Ch(X,|Y); This|
|000032d0| 20 70 72 6f 64 75 63 65 | 73 20 61 6e 20 4e 78 28 | produce|s an Nx(|
|000032e0| 70 2b 31 29 20 6d 61 74 | 72 69 78 2e 0d 0a 5c 69 |p+1) mat|rix...\i|
|000032f0| 74 65 6d 20 43 61 6c 63 | 75 6c 61 74 65 20 74 68 |tem Calc|ulate th|
|00003300| 65 20 6d 61 74 72 69 78 | 20 6f 66 20 63 72 6f 73 |e matrix| of cros|
|00003310| 73 70 72 6f 64 75 63 74 | 73 20 75 73 69 6e 67 0d |sproduct|s using.|
|00003320| 0a 20 20 20 20 20 20 56 | 4d 61 74 72 69 78 20 78 |. V|Matrix x|
|00003330| 79 70 78 79 20 3d 20 54 | 72 61 6e 28 58 59 29 2a |ypxy = T|ran(XY)*|
|00003340| 58 59 3b 0d 0a 5c 69 74 | 65 6d 20 43 61 6c 63 75 |XY;..\it|em Calcu|
|00003350| 6c 61 74 65 20 74 68 65 | 20 63 6f 65 66 66 69 63 |late the| coeffic|
|00003360| 69 65 6e 74 73 20 62 79 | 20 73 77 65 65 70 69 6e |ients by| sweepin|
|00003370| 67 20 6f 75 74 20 74 68 | 65 20 66 69 72 73 74 20 |g out th|e first |
|00003380| 70 0d 0a 20 20 20 20 20 | 20 72 6f 77 73 20 6f 66 |p.. | rows of|
|00003390| 20 78 79 70 78 79 2c 20 | 56 4d 61 74 72 69 78 20 | xypxy, |VMatrix |
|000033a0| 69 78 79 70 78 79 20 3d | 20 53 77 65 65 70 28 31 |ixypxy =| Sweep(1|
|000033b0| 2c 70 2c 78 79 70 78 79 | 29 3b 0d 0a 5c 69 74 65 |,p,xypxy|);..\ite|
|000033c0| 6d 20 54 68 65 20 72 65 | 67 72 65 73 73 69 6f 6e |m The re|gression|
|000033d0| 20 63 6f 65 66 66 69 63 | 69 65 6e 74 73 20 61 72 | coeffic|ients ar|
|000033e0| 65 20 69 6e 20 74 68 65 | 20 72 69 67 68 74 20 6d |e in the| right m|
|000033f0| 6f 73 74 0d 0a 20 20 20 | 20 20 20 63 6f 6c 75 6d |ost.. | colum|
|00003400| 6e 3a 20 56 4d 61 74 72 | 69 78 20 62 65 74 61 68 |n: VMatr|ix betah|
|00003410| 61 74 20 3d 20 53 75 62 | 6d 61 74 28 69 78 79 70 |at = Sub|mat(ixyp|
|00003420| 78 79 2c 70 2c 70 2b 31 | 2c 31 2c 70 2b 31 29 3b |xy,p,p+1|,1,p+1);|
|00003430| 0d 0a 5c 69 74 65 6d 20 | 54 68 65 20 6d 65 61 6e |..\item |The mean|
|00003440| 20 73 71 75 61 72 65 20 | 65 72 72 6f 72 20 69 73 | square |error is|
|00003450| 20 63 61 6c 63 75 6c 61 | 74 65 64 20 66 72 6f 6d | calcula|ted from|
|00003460| 20 74 68 65 20 62 6f 74 | 74 6f 6d 0d 0a 20 20 20 | the bot|tom.. |
|00003470| 20 20 20 72 69 67 68 74 | 20 63 6f 72 6e 65 72 3a | right| corner:|
|00003480| 20 64 6f 75 62 6c 65 20 | 6d 73 65 20 3d 20 69 78 | double |mse = ix|
|00003490| 79 70 78 79 2e 6d 28 70 | 2b 31 2c 70 2b 31 29 20 |ypxy.m(p|+1,p+1) |
|000034a0| 2f 0d 0a 20 20 20 20 20 | 20 28 28 64 6f 75 62 6c |/.. | ((doubl|
|000034b0| 65 29 28 58 2e 72 2d 58 | 2e 63 29 29 3b 0d 0a 5c |e)(X.r-X|.c));..\|
|000034c0| 65 6e 64 7b 65 6e 75 6d | 65 72 61 74 65 7d 0d 0a |end{enum|erate}..|
|000034d0| 54 68 69 73 20 72 65 73 | 75 6c 74 73 20 66 72 6f |This res|ults fro|
|000034e0| 6d 20 73 77 65 65 70 69 | 6e 67 20 6f 75 74 20 74 |m sweepi|ng out t|
|000034f0| 68 65 20 63 6f 6c 75 6d | 6e 73 20 6f 66 20 24 58 |he colum|ns of $X|
|00003500| 27 58 24 2e 20 54 68 65 | 0d 0a 6f 72 69 67 69 6e |'X$. The|..origin|
|00003510| 61 6c 20 6d 61 74 72 69 | 78 20 69 73 20 70 61 72 |al matri|x is par|
|00003520| 74 69 74 69 6f 6e 65 64 | 20 61 73 0d 0a 24 24 0d |titioned| as..$$.|
|00003530| 0a 78 79 70 78 79 20 3d | 20 0d 0a 5c 6c 65 66 74 |.xypxy =| ..\left|
|00003540| 5b 0d 0a 5c 62 65 67 69 | 6e 7b 61 72 72 61 79 7d |[..\begi|n{array}|
|00003550| 7b 63 63 7d 0d 0a 58 27 | 58 20 26 20 58 27 59 20 |{cc}..X'|X & X'Y |
|00003560| 5c 5c 0d 0a 59 27 58 20 | 26 20 59 27 59 0d 0a 5c |\\..Y'X |& Y'Y..\|
|00003570| 65 6e 64 7b 61 72 72 61 | 79 7d 0d 0a 5c 72 69 67 |end{arra|y}..\rig|
|00003580| 68 74 5d 0d 0a 24 24 0d | 0a 54 68 65 20 73 77 65 |ht]..$$.|.The swe|
|00003590| 70 74 20 6d 61 74 72 69 | 78 20 69 73 20 67 69 76 |pt matri|x is giv|
|000035a0| 65 6e 20 62 79 0d 0a 24 | 24 0d 0a 5c 68 62 6f 78 |en by..$|$..\hbox|
|000035b0| 7b 53 77 65 65 70 7d 28 | 31 2c 70 2c 78 70 79 78 |{Sweep}(|1,p,xpyx|
|000035c0| 79 29 20 3d 0d 0a 5c 6c | 65 66 74 5b 0d 0a 5c 62 |y) =..\l|eft[..\b|
|000035d0| 65 67 69 6e 7b 61 72 72 | 61 79 7d 7b 63 63 7d 0d |egin{arr|ay}{cc}.|
|000035e0| 0a 28 58 27 58 29 5e 7b | 2d 31 7d 20 26 20 28 58 |.(X'X)^{|-1} & (X|
|000035f0| 27 58 29 5e 7b 2d 31 7d | 58 27 59 20 5c 5c 0d 0a |'X)^{-1}|X'Y \\..|
|00003600| 2d 59 27 58 28 58 27 58 | 29 5e 7b 2d 31 7d 20 26 |-Y'X(X'X|)^{-1} &|
|00003610| 20 59 27 28 49 2d 58 28 | 58 27 58 29 5e 7b 2d 31 | Y'(I-X(|X'X)^{-1|
|00003620| 7d 58 27 29 59 0d 0a 5c | 65 6e 64 7b 61 72 72 61 |}X')Y..\|end{arra|
|00003630| 79 7d 0d 0a 5c 72 69 67 | 68 74 5d 0d 0a 24 24 0d |y}..\rig|ht]..$$.|
|00003640| 0a 54 68 65 20 74 6f 70 | 20 72 69 67 68 74 20 6d |.The top| right m|
|00003650| 61 74 72 69 78 20 69 73 | 20 74 68 65 20 73 6f 6c |atrix is| the sol|
|00003660| 75 74 69 6f 6e 20 74 6f | 20 74 68 65 20 6c 65 61 |ution to| the lea|
|00003670| 73 74 20 73 71 75 61 72 | 65 73 0d 0a 6e 6f 72 6d |st squar|es..norm|
|00003680| 61 6c 20 65 71 75 61 74 | 69 6f 6e 73 2e 20 4d 6f |al equat|ions. Mo|
|00003690| 72 65 20 69 6e 66 6f 72 | 6d 61 74 69 6f 6e 20 61 |re infor|mation a|
|000036a0| 62 6f 75 74 20 74 68 65 | 20 73 77 65 65 70 20 6f |bout the| sweep o|
|000036b0| 70 65 72 61 74 6f 72 0d | 0a 63 61 6e 20 62 65 20 |perator.|.can be |
|000036c0| 66 6f 75 6e 64 20 69 6e | 20 4b 65 6e 6e 65 64 79 |found in| Kennedy|
|000036d0| 20 61 6e 64 20 47 65 6e | 74 6c 65 5c 63 69 74 65 | and Gen|tle\cite|
|000036e0| 7b 4b 47 3a 73 63 7d 2c | 0d 0a 48 65 69 62 65 72 |{KG:sc},|..Heiber|
|000036f0| 67 65 72 5c 63 69 74 65 | 7b 48 45 3a 61 64 7d 20 |ger\cite|{HE:ad} |
|00003700| 61 6e 64 20 48 6f 63 6b | 69 6e 67 5c 63 69 74 65 |and Hock|ing\cite|
|00003710| 7b 48 4b 3a 61 6d 7d 2e | 0d 0a 0d 0a 5c 73 75 62 |{HK:am}.|....\sub|
|00003720| 73 65 63 74 69 6f 6e 7b | 4b 72 6f 6e 28 29 7d 0d |section{|Kron()}.|
|00003730| 0a 4b 72 6f 6e 28 29 5c | 69 6e 64 65 78 7b 66 75 |.Kron()\|index{fu|
|00003740| 6e 63 74 69 6f 6e 73 21 | 4b 72 6f 6e 28 29 7d 20 |nctions!|Kron()} |
|00003750| 63 61 6c 63 75 6c 61 74 | 65 73 20 74 68 65 20 4b |calculat|es the K|
|00003760| 72 6f 6e 69 6b 65 72 0d | 0a 70 72 6f 64 75 63 74 |roniker.|.product|
|00003770| 20 6f 66 20 74 77 6f 20 | 6d 61 74 72 69 63 65 73 | of two |matrices|
|00003780| 2c 20 24 43 3d 41 5c 6f | 74 69 6d 65 73 20 42 24 |, $C=A\o|times B$|
|00003790| 2e 20 54 68 65 20 28 69 | 2c 6a 29 20 62 6c 6f 63 |. The (i|,j) bloc|
|000037a0| 6b 20 6f 66 0d 0a 24 43 | 24 20 69 73 20 24 61 5f |k of..$C|$ is $a_|
|000037b0| 7b 69 2c 6a 7d 42 24 2e | 20 54 68 69 73 20 69 73 |{i,j}B$.| This is|
|000037c0| 20 61 20 76 65 72 79 20 | 75 73 65 66 75 6c 20 6f | a very |useful o|
|000037d0| 70 65 72 61 74 6f 72 20 | 69 6e 0d 0a 62 61 6c 61 |perator |in..bala|
|000037e0| 6e 63 65 64 20 6d 69 78 | 65 64 20 6c 69 6e 65 61 |nced mix|ed linea|
|000037f0| 72 20 6d 6f 64 65 6c 73 | 2e 20 53 65 65 20 48 6f |r models|. See Ho|
|00003800| 63 6b 69 6e 67 5c 63 69 | 74 65 7b 48 4b 3a 61 6d |cking\ci|te{HK:am|
|00003810| 7d 20 66 6f 72 0d 0a 74 | 68 65 73 65 20 75 73 65 |} for..t|hese use|
|00003820| 73 2c 20 61 6e 64 20 47 | 72 61 6d 5c 63 69 74 65 |s, and G|ram\cite|
|00003830| 7b 47 6d 3a 6b 70 7d 20 | 66 6f 72 20 69 74 73 20 |{Gm:kp} |for its |
|00003840| 61 70 70 6c 69 63 61 74 | 69 6f 6e 73 20 69 6e 0d |applicat|ions in.|
|00003850| 0a 6d 61 74 72 69 78 20 | 63 61 6c 63 75 6c 75 73 |.matrix |calculus|
|00003860| 2e 20 0d 0a 0d 0a 5c 73 | 75 62 73 65 63 74 69 6f |. ....\s|ubsectio|
|00003870| 6e 7b 44 65 74 28 29 7d | 0d 0a 44 65 74 28 29 5c |n{Det()}|..Det()\|
|00003880| 69 6e 64 65 78 7b 66 75 | 6e 63 74 69 6f 6e 73 21 |index{fu|nctions!|
|00003890| 44 65 74 28 29 7d 20 63 | 61 6c 63 75 6c 61 74 65 |Det()} c|alculate|
|000038a0| 73 20 74 68 65 20 64 65 | 74 65 72 6d 69 6e 61 6e |s the de|terminan|
|000038b0| 74 20 6f 66 20 61 0d 0a | 73 71 75 61 72 65 20 6d |t of a..|square m|
|000038c0| 61 74 72 69 78 2e 20 49 | 74 20 75 73 65 73 20 70 |atrix. I|t uses p|
|000038d0| 69 76 6f 74 69 6e 67 20 | 74 6f 20 6d 6f 76 65 20 |ivoting |to move |
|000038e0| 73 6d 61 6c 6c 20 70 69 | 76 6f 74 73 20 74 6f 20 |small pi|vots to |
|000038f0| 74 68 65 0d 0a 72 69 67 | 68 74 20 61 73 20 74 68 |the..rig|ht as th|
|00003900| 65 79 20 61 72 65 20 65 | 6e 63 6f 75 6e 74 65 72 |ey are e|ncounter|
|00003910| 65 64 2e 20 49 74 20 75 | 73 65 73 20 47 61 75 73 |ed. It u|ses Gaus|
|00003920| 73 69 61 6e 20 65 6c 69 | 6d 69 6e 61 74 69 6f 6e |sian eli|mination|
|00003930| 20 74 6f 0d 0a 63 6f 6e | 76 65 72 74 20 74 68 65 | to..con|vert the|
|00003940| 20 6d 61 74 72 69 78 20 | 74 6f 20 61 6e 20 75 70 | matrix |to an up|
|00003950| 70 65 72 20 74 72 69 61 | 6e 67 75 6c 61 72 20 6d |per tria|ngular m|
|00003960| 61 74 72 69 78 2e 20 54 | 68 65 0d 0a 64 65 74 65 |atrix. T|he..dete|
|00003970| 72 6d 69 6e 61 6e 74 20 | 69 73 20 74 68 65 20 70 |rminant |is the p|
|00003980| 72 6f 64 75 63 74 20 6f | 66 20 74 68 65 20 64 69 |roduct o|f the di|
|00003990| 61 67 6f 6e 61 6c 20 65 | 6c 65 6d 65 6e 74 73 2e |agonal e|lements.|
|000039a0| 0d 0a 0d 0a 5c 73 75 62 | 73 65 63 74 69 6f 6e 7b |....\sub|section{|
|000039b0| 43 68 6f 6c 65 73 6b 79 | 28 29 2c 20 51 52 28 29 |Cholesky|(), QR()|
|000039c0| 7d 0d 0a 43 68 6f 6c 65 | 73 6b 79 28 29 5c 69 6e |}..Chole|sky()\in|
|000039d0| 64 65 78 7b 66 75 6e 63 | 74 69 6f 6e 73 21 43 68 |dex{func|tions!Ch|
|000039e0| 6f 6c 65 73 6b 79 28 29 | 7d 20 63 6f 6e 76 65 72 |olesky()|} conver|
|000039f0| 74 73 20 61 20 73 71 75 | 61 72 65 0d 0a 73 79 6d |ts a squ|are..sym|
|00003a00| 6d 65 74 72 69 63 20 6d | 61 74 72 69 78 2c 20 24 |metric m|atrix, $|
|00003a10| 41 24 20 69 6e 74 6f 20 | 61 61 6e 20 75 70 70 65 |A$ into |aan uppe|
|00003a20| 72 20 74 72 69 61 6e 67 | 75 6c 61 72 20 6d 61 74 |r triang|ular mat|
|00003a30| 72 69 78 2c 20 24 53 24 | 2c 20 73 75 63 68 0d 0a |rix, $S$|, such..|
|00003a40| 74 68 61 74 20 24 41 3d | 53 27 53 24 2e 20 54 68 |that $A=|S'S$. Th|
|00003a50| 65 20 66 75 6e 63 74 69 | 6f 6e 20 64 6f 65 73 20 |e functi|on does |
|00003a60| 6e 6f 74 20 70 69 76 6f | 74 2c 20 61 6e 64 20 73 |not pivo|t, and s|
|00003a70| 74 6f 70 73 20 69 66 20 | 61 20 7a 65 72 6f 0d 0a |tops if |a zero..|
|00003a80| 70 69 76 6f 74 20 69 73 | 20 66 6f 75 6e 64 2e 20 |pivot is| found. |
|00003a90| 54 68 69 73 20 76 65 72 | 73 69 6f 6e 20 69 73 20 |This ver|sion is |
|00003aa0| 74 61 6b 65 6e 20 66 72 | 6f 6d 20 48 6f 63 6b 69 |taken fr|om Hocki|
|00003ab0| 6e 67 5c 63 69 74 65 7b | 48 4b 3a 61 6d 7d 2e 20 |ng\cite{|HK:am}. |
|00003ac0| 0d 0a 0d 0a 51 52 28 29 | 5c 69 6e 64 65 78 7b 66 |....QR()|\index{f|
|00003ad0| 75 6e 63 74 69 6f 6e 73 | 21 51 52 28 29 7d 20 63 |unctions|!QR()} c|
|00003ae0| 6f 6e 76 65 72 74 73 20 | 61 6e 20 24 72 78 63 24 |onverts |an $rxc$|
|00003af0| 20 6d 61 74 72 69 78 20 | 24 41 24 20 69 6e 74 6f | matrix |$A$ into|
|00003b00| 20 74 68 65 0d 0a 70 72 | 6f 64 75 63 74 20 24 51 | the..pr|oduct $Q|
|00003b10| 52 24 2c 20 77 68 65 72 | 65 20 24 51 24 20 69 73 |R$, wher|e $Q$ is|
|00003b20| 20 24 72 78 63 24 20 6f | 66 20 6f 72 74 68 6f 67 | $rxc$ o|f orthog|
|00003b30| 6f 6e 61 6c 20 63 6f 6c | 75 6d 6e 73 2c 20 61 6e |onal col|umns, an|
|00003b40| 64 20 24 52 24 0d 0a 69 | 73 20 61 6e 20 75 70 70 |d $R$..i|s an upp|
|00003b50| 65 72 20 74 72 69 61 6e | 67 75 6c 61 72 20 24 63 |er trian|gular $c|
|00003b60| 78 63 24 20 6d 61 74 72 | 69 78 2e 20 54 68 65 20 |xc$ matr|ix. The |
|00003b70| 72 6f 75 74 69 6e 65 20 | 73 74 6f 70 73 20 69 66 |routine |stops if|
|00003b80| 20 61 20 7a 65 72 6f 0d | 0a 64 69 61 67 6f 6e 61 | a zero.|.diagona|
|00003b90| 6c 20 65 6c 65 6d 65 6e | 74 20 6f 66 20 24 52 24 |l elemen|t of $R$|
|00003ba0| 20 69 73 20 70 72 6f 64 | 75 63 65 64 2e 20 54 68 | is prod|uced. Th|
|00003bb0| 65 20 66 75 6e 63 74 69 | 6f 6e 20 70 72 6f 64 75 |e functi|on produ|
|00003bc0| 63 65 73 20 24 51 24 0d | 0a 62 79 20 64 65 66 61 |ces $Q$.|.by defa|
|00003bd0| 75 6c 74 2c 20 62 75 74 | 20 73 75 70 70 6c 79 69 |ult, but| supplyi|
|00003be0| 6e 67 20 6d 61 6b 65 71 | 3d 46 46 41 4c 53 45 20 |ng makeq|=FFALSE |
|00003bf0| 74 75 72 6e 73 20 74 68 | 69 73 20 6f 70 74 69 6f |turns th|is optio|
|00003c00| 6e 20 6f 66 66 2e 0d 0a | 54 79 70 69 63 61 6c 6c |n off...|Typicall|
|00003c10| 79 20 74 68 65 20 51 52 | 20 72 65 64 75 63 74 69 |y the QR| reducti|
|00003c20| 6f 6e 20 69 73 20 75 73 | 65 64 20 74 6f 20 72 65 |on is us|ed to re|
|00003c30| 64 75 63 65 20 61 20 24 | 58 24 20 6d 61 74 72 69 |duce a $|X$ matri|
|00003c40| 78 20 69 6e 0d 0a 72 65 | 67 72 65 73 73 69 6f 6e |x in..re|gression|
|00003c50| 20 74 6f 20 61 76 6f 69 | 64 20 72 6f 75 6e 64 20 | to avoi|d round |
|00003c60| 6f 66 66 20 65 72 72 6f | 72 20 69 6e 20 63 61 6c |off erro|r in cal|
|00003c70| 63 75 6c 61 74 69 6e 67 | 20 24 58 27 58 24 2e 20 |culating| $X'X$. |
|00003c80| 54 68 65 0d 0a 24 58 24 | 20 6d 61 74 72 69 78 20 |The..$X$| matrix |
|00003c90| 68 61 73 20 61 74 20 6c | 65 61 73 74 20 61 73 20 |has at l|east as |
|00003ca0| 6d 61 6e 79 20 72 6f 77 | 73 20 61 73 20 63 6f 6c |many row|s as col|
|00003cb0| 75 6d 6e 73 2c 20 73 6f | 20 74 68 65 72 65 20 69 |umns, so| there i|
|00003cc0| 73 0d 0a 73 6f 6d 65 20 | 73 61 76 69 6e 67 73 20 |s..some |savings |
|00003cd0| 69 6e 20 63 61 6c 63 75 | 6c 61 74 69 6e 67 20 24 |in calcu|lating $|
|00003ce0| 51 24 20 61 73 20 24 51 | 20 3d 20 58 52 5e 7b 2d |Q$ as $Q| = XR^{-|
|00003cf0| 31 7d 24 2e 20 59 6f 75 | 20 73 68 6f 75 6c 64 0d |1}$. You| should.|
|00003d00| 0a 74 75 72 6e 20 6f 66 | 66 20 74 68 65 20 63 61 |.turn of|f the ca|
|00003d10| 6c 63 75 6c 61 74 69 6f | 6e 20 6f 66 20 24 51 24 |lculatio|n of $Q$|
|00003d20| 20 69 66 20 66 69 6e 64 | 69 6e 67 20 24 52 5e 7b | if find|ing $R^{|
|00003d30| 2d 31 7d 24 20 69 73 0d | 0a 70 72 6f 68 69 62 69 |-1}$ is.|.prohibi|
|00003d40| 74 69 76 65 2c 20 6f 72 | 20 69 66 20 6f 6e 6c 79 |tive, or| if only|
|00003d50| 20 24 52 24 20 69 73 20 | 6e 65 65 64 65 64 2e 20 | $R$ is |needed. |
|00003d60| 49 74 73 20 75 73 65 20 | 69 6e 20 72 65 67 72 65 |Its use |in regre|
|00003d70| 73 73 69 6f 6e 20 6d 61 | 79 0d 0a 62 65 20 69 6d |ssion ma|y..be im|
|00003d80| 70 72 6f 76 65 64 20 62 | 79 20 70 69 76 6f 74 69 |proved b|y pivoti|
|00003d90| 6e 67 20 7a 65 72 6f 20 | 64 69 61 67 6f 6e 61 6c |ng zero |diagonal|
|00003da0| 20 65 6c 65 6d 65 6e 74 | 73 20 6f 66 20 52 2e 20 | element|s of R. |
|00003db0| 28 53 65 65 0d 0a 5c 63 | 69 74 65 7b 4b 42 48 3a |(See..\c|ite{KBH:|
|00003dc0| 6e 6d 7d 20 66 6f 72 20 | 6d 6f 72 65 29 2e 20 54 |nm} for |more). T|
|00003dd0| 68 65 20 70 72 6f 67 72 | 61 6d 20 69 73 20 61 0d |he progr|am is a.|
|00003de0| 0a 74 72 61 6e 73 6c 61 | 74 69 6f 6e 20 6f 66 20 |.transla|tion of |
|00003df0| 61 6e 20 41 6c 67 6f 6c | 20 70 72 6f 67 72 61 6d |an Algol| program|
|00003e00| 20 66 6f 75 6e 64 20 69 | 6e 20 5c 63 69 74 65 7b | found i|n \cite{|
|00003e10| 53 42 3a 6e 61 7d 2e 0d | 0a 20 0d 0a 5c 73 75 62 |SB:na}..|. ..\sub|
|00003e20| 73 65 63 74 69 6f 6e 7b | 53 76 64 28 29 20 61 6e |section{|Svd() an|
|00003e30| 64 20 47 69 6e 76 28 29 | 7d 0d 0a 53 76 64 28 29 |d Ginv()|}..Svd()|
|00003e40| 5c 69 6e 64 65 78 7b 66 | 75 6e 63 74 69 6f 6e 73 |\index{f|unctions|
|00003e50| 21 53 76 64 28 29 7d 20 | 70 72 6f 76 69 64 65 73 |!Svd()} |provides|
|00003e60| 20 61 20 73 69 6e 67 75 | 6c 61 72 20 76 61 6c 75 | a singu|lar valu|
|00003e70| 65 64 0d 0a 64 65 63 6f | 6d 70 6f 73 69 74 69 6f |ed..deco|mpositio|
|00003e80| 6e 2e 20 49 74 20 69 73 | 20 61 20 64 69 72 65 63 |n. It is| a direc|
|00003e90| 74 20 74 72 61 6e 73 6c | 61 74 69 6f 6e 20 6f 66 |t transl|ation of|
|00003ea0| 20 74 68 65 20 45 49 53 | 50 41 43 4b 20 72 6f 75 | the EIS|PACK rou|
|00003eb0| 74 69 6e 65 0d 0a 77 69 | 74 68 20 74 68 65 20 73 |tine..wi|th the s|
|00003ec0| 61 6d 65 20 6e 61 6d 65 | 20 28 5c 63 69 74 65 7b |ame name| (\cite{|
|00003ed0| 53 42 47 3a 65 69 7d 29 | 2e 20 54 68 65 20 72 6f |SBG:ei})|. The ro|
|00003ee0| 75 74 69 6e 65 20 64 65 | 63 6f 6d 70 6f 73 65 73 |utine de|composes|
|00003ef0| 20 61 6e 0d 0a 24 72 78 | 63 24 20 6d 61 74 72 69 | an..$rx|c$ matri|
|00003f00| 78 20 24 41 24 20 61 73 | 20 24 41 3d 55 44 56 27 |x $A$ as| $A=UDV'|
|00003f10| 24 2c 20 77 68 65 72 65 | 20 24 55 27 55 3d 55 55 |$, where| $U'U=UU|
|00003f20| 27 3d 49 5f 72 24 2c 0d | 0a 24 56 27 56 3d 56 56 |'=I_r$,.|.$V'V=VV|
|00003f30| 27 3d 49 5f 63 24 2c 20 | 61 6e 64 20 61 20 76 65 |'=I_c$, |and a ve|
|00003f40| 63 74 6f 72 20 24 53 24 | 20 63 6f 6e 74 61 69 6e |ctor $S$| contain|
|00003f50| 69 6e 67 20 74 68 65 20 | 64 69 61 67 6f 6e 61 6c |ing the |diagonal|
|00003f60| 20 65 6c 65 6d 65 6e 74 | 73 0d 0a 6f 66 20 24 44 | element|s..of $D|
|00003f70| 24 2c 20 77 68 69 63 68 | 20 61 72 65 20 74 68 65 |$, which| are the|
|00003f80| 20 73 71 75 61 72 65 20 | 72 6f 6f 74 73 20 6f 66 | square |roots of|
|00003f90| 20 74 68 65 20 65 69 67 | 65 6e 76 61 6c 75 65 73 | the eig|envalues|
|00003fa0| 20 6f 66 20 24 41 27 41 | 24 2e 0d 0a 54 68 65 20 | of $A'A|$...The |
|00003fb0| 64 65 66 61 75 6c 74 20 | 69 73 20 74 6f 20 70 72 |default |is to pr|
|00003fc0| 6f 64 75 63 65 20 24 55 | 24 20 61 6e 64 20 24 56 |oduce $U|$ and $V|
|00003fd0| 24 2c 20 62 75 74 20 74 | 68 69 73 20 6d 61 79 20 |$, but t|his may |
|00003fe0| 62 65 20 74 75 72 6e 65 | 64 0d 0a 6f 66 66 20 62 |be turne|d..off b|
|00003ff0| 79 20 73 75 70 70 6c 79 | 69 6e 67 20 6d 61 6b 65 |y supply|ing make|
|00004000| 76 3d 46 46 41 4c 53 45 | 20 6f 72 20 6d 61 6b 65 |v=FFALSE| or make|
|00004010| 75 3d 46 46 41 4c 53 45 | 2e 0d 0a 0d 0a 47 69 6e |u=FFALSE|.....Gin|
|00004020| 76 28 29 5c 69 6e 64 65 | 78 7b 66 75 6e 63 74 69 |v()\inde|x{functi|
|00004030| 6f 6e 73 21 47 69 6e 76 | 28 29 7d 20 70 72 6f 64 |ons!Ginv|()} prod|
|00004040| 75 63 65 73 20 61 20 67 | 65 6e 65 72 61 6c 69 7a |uces a g|eneraliz|
|00004050| 65 64 20 69 6e 76 65 72 | 73 65 20 6f 66 0d 0a 24 |ed inver|se of..$|
|00004060| 41 24 20 75 73 69 6e 67 | 20 74 68 65 20 73 69 6e |A$ using| the sin|
|00004070| 67 75 6c 61 72 20 76 61 | 6c 75 65 64 20 64 65 63 |gular va|lued dec|
|00004080| 6f 6d 70 6f 73 69 74 69 | 6f 6e 3a 20 24 41 5e 2b |ompositi|on: $A^+|
|00004090| 20 3d 20 56 44 5e 2b 55 | 27 24 2e 20 54 68 65 0d | = VD^+U|'$. The.|
|000040a0| 0a 6d 61 74 72 69 78 20 | 24 44 5e 2b 24 20 69 73 |.matrix |$D^+$ is|
|000040b0| 20 61 20 64 69 61 67 6f | 6e 61 6c 20 6d 61 74 72 | a diago|nal matr|
|000040c0| 69 78 20 77 69 74 68 20 | 74 68 65 20 72 65 63 69 |ix with |the reci|
|000040d0| 70 72 6f 63 61 6c 73 20 | 6f 66 20 74 68 65 0d 0a |procals |of the..|
|000040e0| 6e 6f 6e 7a 65 72 6f 20 | 73 69 6e 67 75 6c 61 72 |nonzero |singular|
|000040f0| 20 76 61 6c 75 65 73 20 | 6f 66 20 24 41 24 2e 0d | values |of $A$..|
|00004100| 0a 0d 0a 5c 73 75 62 73 | 65 63 74 69 6f 6e 7b 41 |...\subs|ection{A|
|00004110| 6e 20 41 6c 6d 6f 73 74 | 20 46 66 74 28 29 7d 0d |n Almost| Fft()}.|
|00004120| 0a 46 66 74 28 29 5c 69 | 6e 64 65 78 7b 66 75 6e |.Fft()\i|ndex{fun|
|00004130| 63 74 69 6f 6e 73 21 46 | 66 74 28 29 7d 20 63 61 |ctions!F|ft()} ca|
|00004140| 6c 63 75 6c 61 74 65 73 | 20 74 68 65 20 46 6f 75 |lculates| the Fou|
|00004150| 72 69 65 72 20 74 72 61 | 6e 73 66 6f 72 6d 0d 0a |rier tra|nsform..|
|00004160| 61 6e 64 20 69 74 73 20 | 69 6e 76 65 72 73 65 20 |and its |inverse |
|00004170| 66 6f 72 20 61 20 76 65 | 63 74 6f 72 20 6f 66 20 |for a ve|ctor of |
|00004180| 24 6e 24 20 72 65 61 6c | 73 2c 20 6f 72 20 61 20 |$n$ real|s, or a |
|00004190| 63 6f 6d 70 6c 65 78 20 | 76 65 63 74 6f 72 0d 0a |complex |vector..|
|000041a0| 73 74 6f 72 65 64 20 69 | 6e 20 61 20 6e 78 32 20 |stored i|n a nx2 |
|000041b0| 6d 61 74 72 69 78 2e 20 | 54 68 69 73 20 46 66 74 |matrix. |This Fft|
|000041c0| 20 64 6f 65 73 20 6e 6f | 74 20 72 65 71 75 69 72 | does no|t requir|
|000041d0| 65 20 6e 20 74 6f 20 62 | 65 20 61 0d 0a 70 6f 77 |e n to b|e a..pow|
|000041e0| 65 72 20 6f 66 20 32 2e | 20 48 6f 77 65 76 65 72 |er of 2.| However|
|000041f0| 20 69 74 20 73 6c 6f 77 | 73 20 64 6f 77 6e 20 66 | it slow|s down f|
|00004200| 6f 72 20 6e 24 3e 24 31 | 30 30 30 2c 20 6f 72 20 |or n$>$1|000, or |
|00004210| 66 6f 72 20 6e 20 77 69 | 74 68 0d 0a 61 20 73 6d |for n wi|th..a sm|
|00004220| 61 6c 6c 65 73 74 20 70 | 72 69 6d 65 20 66 61 63 |allest p|rime fac|
|00004230| 74 6f 72 20 67 72 65 61 | 74 65 72 20 74 68 61 6e |tor grea|ter than|
|00004240| 20 31 39 2e 20 49 6e 20 | 73 75 63 68 20 63 61 73 | 19. In |such cas|
|00004250| 65 73 20 69 74 20 6d 61 | 79 20 62 65 0d 0a 62 65 |es it ma|y be..be|
|00004260| 74 74 65 72 20 74 6f 20 | 72 65 73 6f 72 74 20 74 |tter to |resort t|
|00004270| 6f 20 61 20 24 32 5e 6e | 24 20 66 66 74 20 61 6e |o a $2^n|$ fft an|
|00004280| 64 20 7a 65 72 6f 20 70 | 61 64 64 69 6e 67 20 28 |d zero p|adding (|
|00004290| 73 65 65 0d 0a 5c 63 69 | 74 65 7b 50 72 3a 6e 72 |see..\ci|te{Pr:nr|
|000042a0| 63 7d 29 2e 20 59 6f 75 | 20 63 61 6e 20 63 61 6c |c}). You| can cal|
|000042b0| 63 75 6c 61 74 65 20 74 | 68 65 20 69 6e 76 65 72 |culate t|he inver|
|000042c0| 73 65 20 66 66 74 20 62 | 79 20 73 75 70 70 6c 79 |se fft b|y supply|
|000042d0| 69 6e 67 0d 0a 74 68 65 | 20 76 61 72 69 61 62 6c |ing..the| variabl|
|000042e0| 65 20 49 4e 5a 45 45 3d | 46 46 41 4c 53 45 2e 20 |e INZEE=|FFALSE. |
|000042f0| 53 65 65 20 74 68 65 20 | 65 78 61 6d 70 6c 65 20 |See the |example |
|00004300| 70 72 6f 67 72 61 6d 20 | 5c 76 65 72 62 2b 0d 0a |program |\verb+..|
|00004310| 74 65 73 74 72 65 67 2e | 63 70 70 2b 20 66 6f 72 |testreg.|cpp+ for|
|00004320| 20 63 61 6c 63 75 6c 61 | 74 69 6e 67 20 74 68 65 | calcula|ting the|
|00004330| 20 66 69 72 73 74 20 35 | 20 73 65 72 69 61 6c 20 | first 5| serial |
|00004340| 63 6f 72 72 65 6c 61 74 | 69 6f 6e 73 0d 0a 75 73 |correlat|ions..us|
|00004350| 69 6e 67 20 74 68 65 20 | 66 66 74 20 6d 65 74 68 |ing the |fft meth|
|00004360| 6f 64 2e 0d 0a 0d 0a 54 | 68 65 20 70 72 6f 67 72 |od.....T|he progr|
|00004370| 61 6d 20 69 73 20 61 20 | 74 72 61 6e 73 6c 61 74 |am is a |translat|
|00004380| 69 6f 6e 20 6f 66 20 61 | 20 46 4f 52 54 52 41 4e |ion of a| FORTRAN|
|00004390| 20 70 72 6f 67 72 61 6d | 20 66 6f 75 6e 64 20 69 | program| found i|
|000043a0| 6e 20 43 6f 6e 74 65 0d | 0a 61 6e 64 20 64 65 20 |n Conte.|.and de |
|000043b0| 42 6f 6f 72 28 20 73 65 | 65 20 5c 63 69 74 65 7b |Boor( se|e \cite{|
|000043c0| 43 42 3a 65 6e 7d 20 29 | 2e 20 54 68 65 20 74 72 |CB:en} )|. The tr|
|000043d0| 61 6e 73 6c 61 74 69 6f | 6e 20 77 61 73 20 70 72 |anslatio|n was pr|
|000043e0| 6f 64 75 63 65 64 20 62 | 79 0d 0a 52 2e 20 47 2e |oduced b|y..R. G.|
|000043f0| 20 44 61 76 69 65 73 20 | 69 6e 20 68 69 73 20 6d | Davies |in his m|
|00004400| 61 74 72 69 78 20 63 6c | 61 73 73 2c 20 4e 45 57 |atrix cl|ass, NEW|
|00004410| 4d 41 54 20 63 75 72 72 | 65 6e 74 6c 79 20 61 76 |MAT curr|ently av|
|00004420| 61 69 6c 61 62 6c 65 20 | 69 6e 0d 0a 74 68 65 20 |ailable |in..the |
|00004430| 42 6f 72 6c 61 6e 64 20 | 43 2b 2b 20 6c 69 62 72 |Borland |C++ libr|
|00004440| 61 72 79 20 6f 66 20 43 | 6f 6d 70 75 73 65 72 76 |ary of C|ompuserv|
|00004450| 65 2e 20 49 20 68 61 76 | 65 20 71 75 69 74 65 20 |e. I hav|e quite |
|00004460| 75 6e 61 73 68 61 6d 65 | 64 6c 79 0d 0a 74 72 61 |unashame|dly..tra|
|00004470| 6e 73 6c 61 74 65 64 20 | 69 74 20 66 6f 72 20 75 |nslated |it for u|
|00004480| 73 65 20 69 6e 20 59 41 | 4d 50 2e 20 49 20 68 61 |se in YA|MP. I ha|
|00004490| 76 65 2c 20 68 6f 77 65 | 76 65 72 2c 20 61 64 64 |ve, howe|ver, add|
|000044a0| 65 64 20 74 68 65 0d 0a | 61 62 69 6c 69 74 79 20 |ed the..|ability |
|000044b0| 74 6f 20 64 6f 20 74 68 | 65 20 69 6e 76 65 72 73 |to do th|e invers|
|000044c0| 65 20 66 66 74 2c 20 73 | 6f 20 49 20 64 6f 6e 27 |e fft, s|o I don'|
|000044d0| 74 20 66 65 65 6c 20 6c | 69 6b 65 20 61 20 74 6f |t feel l|ike a to|
|000044e0| 74 61 6c 0d 0a 74 68 69 | 65 66 2e 20 4d 79 20 76 |tal..thi|ef. My v|
|000044f0| 65 72 73 69 6f 6e 20 69 | 73 20 73 6c 6f 77 65 72 |ersion i|s slower|
|00004500| 20 73 69 6e 63 65 20 69 | 74 20 63 61 6c 63 75 6c | since i|t calcul|
|00004510| 61 74 65 73 20 6f 66 66 | 73 65 74 73 20 69 6e 0d |ates off|sets in.|
|00004520| 0a 76 65 63 74 6f 72 73 | 20 72 61 74 68 65 72 20 |.vectors| rather |
|00004530| 74 68 61 6e 20 69 6e 63 | 72 65 6d 65 6e 74 69 6e |than inc|rementin|
|00004540| 67 20 70 6f 69 6e 74 65 | 72 73 20 61 63 72 6f 73 |g pointe|rs acros|
|00004550| 73 20 74 68 65 20 68 65 | 61 70 2e 20 4d 79 0d 0a |s the he|ap. My..|
|00004560| 76 65 72 73 69 6f 6e 20 | 69 73 20 61 6c 73 6f 20 |version |is also |
|00004570| 73 6c 6f 77 65 72 20 69 | 6e 20 74 68 65 20 76 69 |slower i|n the vi|
|00004580| 72 74 75 61 6c 20 6d 65 | 6d 6f 72 79 20 6d 6f 64 |rtual me|mory mod|
|00004590| 65 6c 20 73 69 6e 63 65 | 20 69 74 20 6d 75 73 74 |el since| it must|
|000045a0| 0d 0a 70 61 67 65 20 6d | 65 6d 6f 72 79 20 61 6c |..page m|emory al|
|000045b0| 6d 6f 73 74 20 63 6f 6e | 73 74 61 6e 74 6c 79 2e |most con|stantly.|
|000045c0| 20 20 4d 79 20 67 75 65 | 73 73 20 69 73 20 74 68 | My gue|ss is th|
|000045d0| 61 74 20 65 78 70 6c 69 | 63 69 74 0d 0a 65 76 61 |at expli|cit..eva|
|000045e0| 6c 75 61 74 69 6f 6e 20 | 6f 66 20 74 68 65 20 64 |luation |of the d|
|000045f0| 69 73 63 72 65 74 65 20 | 46 6f 75 72 69 65 72 20 |iscrete |Fourier |
|00004600| 74 72 61 6e 73 66 6f 72 | 6d 20 69 73 20 66 61 73 |transfor|m is fas|
|00004610| 74 65 72 20 73 69 6e 63 | 65 20 69 74 0d 0a 72 65 |ter sinc|e it..re|
|00004620| 71 75 69 72 65 73 20 6c | 65 73 73 20 6d 65 6d 6f |quires l|ess memo|
|00004630| 72 79 20 70 61 67 69 6e | 67 2e 20 49 20 65 76 65 |ry pagin|g. I eve|
|00004640| 6e 74 75 61 6c 6c 79 20 | 6e 65 65 64 20 74 6f 20 |ntually |need to |
|00004650| 73 65 65 20 77 68 61 74 | 20 63 61 6e 0d 0a 62 65 |see what| can..be|
|00004660| 20 64 6f 6e 65 20 61 62 | 6f 75 74 20 74 68 69 73 | done ab|out this|
|00004670| 2e 0d 0a 0d 0a 5c 73 75 | 62 73 65 63 74 69 6f 6e |.....\su|bsection|
|00004680| 7b 52 65 73 68 61 70 69 | 6e 67 20 66 75 6e 63 74 |{Reshapi|ng funct|
|00004690| 69 6f 6e 73 3a 20 56 65 | 63 28 29 2c 20 56 65 63 |ions: Ve|c(), Vec|
|000046a0| 64 69 61 67 28 29 2c 20 | 44 69 61 67 28 29 2c 20 |diag(), |Diag(), |
|000046b0| 61 6e 64 0d 0a 53 68 61 | 70 65 28 29 7d 20 54 68 |and..Sha|pe()} Th|
|000046c0| 65 73 65 20 66 75 6e 63 | 74 69 6f 6e 73 20 72 65 |ese func|tions re|
|000046d0| 73 68 61 70 65 20 6d 61 | 74 72 69 63 65 73 2e 0d |shape ma|trices..|
|000046e0| 0a 56 65 63 28 29 5c 69 | 6e 64 65 78 7b 66 75 6e |.Vec()\i|ndex{fun|
|000046f0| 63 74 69 6f 6e 73 21 56 | 65 63 28 29 7d 20 73 65 |ctions!V|ec()} se|
|00004700| 6e 64 73 20 61 20 6d 61 | 74 72 69 78 20 74 6f 20 |nds a ma|trix to |
|00004710| 61 20 76 65 63 74 6f 72 | 2e 20 54 68 65 0d 0a 63 |a vector|. The..c|
|00004720| 6f 6c 75 6d 6e 73 20 6f | 66 20 74 68 65 20 76 65 |olumns o|f the ve|
|00004730| 63 74 6f 72 20 61 72 65 | 20 73 74 61 63 6b 65 64 |ctor are| stacked|
|00004740| 20 69 6e 74 6f 20 61 20 | 24 72 63 78 31 24 20 76 | into a |$rcx1$ v|
|00004750| 65 63 74 6f 72 2e 0d 0a | 56 65 63 64 69 61 67 28 |ector...|Vecdiag(|
|00004760| 29 5c 69 6e 64 65 78 7b | 66 75 6e 63 74 69 6f 6e |)\index{|function|
|00004770| 73 21 56 65 63 64 69 61 | 67 28 29 7d 20 65 78 74 |s!Vecdia|g()} ext|
|00004780| 72 61 63 74 73 20 74 68 | 65 20 70 72 69 6e 63 69 |racts th|e princi|
|00004790| 70 61 6c 0d 0a 64 69 61 | 67 6f 6e 61 6c 20 6f 66 |pal..dia|gonal of|
|000047a0| 20 61 20 73 71 75 61 72 | 65 20 6d 61 74 72 69 78 | a squar|e matrix|
|000047b0| 20 69 6e 74 6f 20 61 20 | 76 65 63 74 6f 72 2e 0d | into a |vector..|
|000047c0| 0a 44 69 61 67 28 29 5c | 69 6e 64 65 78 7b 66 75 |.Diag()\|index{fu|
|000047d0| 6e 63 74 69 6f 6e 73 21 | 44 69 61 67 28 29 7d 20 |nctions!|Diag()} |
|000047e0| 73 65 6e 64 73 20 61 20 | 76 65 63 74 6f 72 20 69 |sends a |vector i|
|000047f0| 6e 74 6f 20 74 68 65 20 | 70 72 69 6e 63 69 70 61 |nto the |principa|
|00004800| 6c 0d 0a 64 69 61 67 6f | 6e 61 6c 20 6f 66 20 61 |l..diago|nal of a|
|00004810| 20 73 71 75 61 72 65 20 | 7a 65 72 6f 20 6d 61 74 | square |zero mat|
|00004820| 72 69 78 2e 20 49 74 20 | 61 6c 73 6f 20 7a 65 72 |rix. It |also zer|
|00004830| 6f 73 20 74 68 65 20 6f | 66 66 2d 64 69 61 67 6f |os the o|ff-diago|
|00004840| 6e 61 6c 0d 0a 65 6c 65 | 6d 65 6e 74 73 20 69 66 |nal..ele|ments if|
|00004850| 20 74 68 65 20 69 6e 70 | 75 74 20 6d 61 74 72 69 | the inp|ut matri|
|00004860| 78 20 69 73 20 73 71 75 | 61 72 65 2e 0d 0a 0d 0a |x is squ|are.....|
|00004870| 53 68 61 70 65 28 29 5c | 69 6e 64 65 78 7b 66 75 |Shape()\|index{fu|
|00004880| 6e 63 74 69 6f 6e 73 21 | 53 68 61 70 65 28 29 7d |nctions!|Shape()}|
|00004890| 20 74 61 6b 65 73 20 61 | 6e 20 24 72 78 63 24 20 | takes a|n $rxc$ |
|000048a0| 6d 61 74 72 69 78 20 74 | 6f 20 61 20 6e 65 77 20 |matrix t|o a new |
|000048b0| 6d 61 74 72 69 78 0d 0a | 77 69 74 68 20 24 6e 72 |matrix..|with $nr|
|000048c0| 6f 77 73 24 20 72 6f 77 | 73 2e 20 54 68 65 20 76 |ows$ row|s. The v|
|000048d0| 61 6c 75 65 20 6f 66 20 | 24 6e 72 6f 77 73 24 20 |alue of |$nrows$ |
|000048e0| 6d 75 73 74 20 64 69 76 | 69 64 65 20 24 72 63 24 |must div|ide $rc$|
|000048f0| 20 77 69 74 68 6f 75 74 | 20 61 0d 0a 72 65 6d 61 | without| a..rema|
|00004900| 69 6e 64 65 72 20 6f 72 | 20 74 68 65 20 70 72 6f |inder or| the pro|
|00004910| 67 72 61 6d 20 77 69 6c | 6c 20 73 74 6f 70 2e 20 |gram wil|l stop. |
|00004920| 0d 0a 0d 0a 5c 73 75 62 | 73 65 63 74 69 6f 6e 7b |....\sub|section{|
|00004930| 53 75 6d 6d 61 74 69 6f | 6e 20 46 75 6e 63 74 69 |Summatio|n Functi|
|00004940| 6f 6e 73 3a 20 53 75 6d | 28 29 2c 20 53 75 6d 73 |ons: Sum|(), Sums|
|00004950| 71 28 29 2c 20 43 75 73 | 75 6d 28 29 7d 0d 0a 54 |q(), Cus|um()}..T|
|00004960| 68 65 73 65 20 66 75 6e | 63 74 69 6f 6e 73 20 66 |hese fun|ctions f|
|00004970| 6f 72 6d 20 64 69 66 66 | 65 72 65 6e 74 20 6b 69 |orm diff|erent ki|
|00004980| 6e 64 73 20 6f 66 20 73 | 75 6d 73 20 6f 66 20 74 |nds of s|ums of t|
|00004990| 68 65 20 65 6c 65 6d 65 | 6e 74 73 20 6f 66 0d 0a |he eleme|nts of..|
|000049a0| 61 20 6d 61 74 72 69 78 | 2e 20 53 75 6d 28 29 5c |a matrix|. Sum()\|
|000049b0| 69 6e 64 65 78 7b 66 75 | 6e 63 74 69 6f 6e 73 21 |index{fu|nctions!|
|000049c0| 53 75 6d 28 29 7d 20 73 | 75 6d 73 20 74 68 65 20 |Sum()} s|ums the |
|000049d0| 65 6c 65 6d 65 6e 74 73 | 20 6f 66 20 61 0d 0a 6d |elements| of a..m|
|000049e0| 61 74 72 69 78 2e 20 54 | 68 65 20 64 65 66 61 75 |atrix. T|he defau|
|000049f0| 6c 74 20 69 73 20 74 6f | 20 73 75 6d 20 61 6c 6c |lt is to| sum all|
|00004a00| 20 6f 66 20 74 68 65 20 | 65 6c 65 6d 65 6e 74 73 | of the |elements|
|00004a10| 20 61 6e 64 20 72 65 74 | 75 72 6e 20 61 0d 0a 31 | and ret|urn a..1|
|00004a20| 78 31 20 6d 61 74 72 69 | 78 2e 20 54 68 65 20 6f |x1 matri|x. The o|
|00004a30| 70 74 69 6f 6e 61 6c 20 | 70 61 72 61 6d 65 74 65 |ptional |paramete|
|00004a40| 72 20 6d 61 72 67 20 6d | 61 79 20 62 65 20 73 65 |r marg m|ay be se|
|00004a50| 74 20 74 6f 20 52 4f 57 | 53 20 6f 72 0d 0a 43 4f |t to ROW|S or..CO|
|00004a60| 4c 55 4d 4e 53 2c 20 74 | 6f 20 73 75 6d 20 61 63 |LUMNS, t|o sum ac|
|00004a70| 72 6f 73 73 20 72 6f 77 | 73 20 6f 72 20 63 6f 6c |ross row|s or col|
|00004a80| 75 6d 6e 73 20 72 65 73 | 70 65 63 74 69 76 65 6c |umns res|pectivel|
|00004a90| 79 2e 20 53 65 74 74 69 | 6e 67 0d 0a 6d 61 72 67 |y. Setti|ng..marg|
|00004aa0| 3d 52 4f 57 53 20 70 72 | 6f 64 75 63 65 73 20 61 |=ROWS pr|oduces a|
|00004ab0| 20 31 78 63 20 6d 61 74 | 72 69 78 20 6f 66 20 63 | 1xc mat|rix of c|
|00004ac0| 6f 6c 75 6d 6e 20 73 75 | 6d 73 2e 20 53 65 74 74 |olumn su|ms. Sett|
|00004ad0| 69 6e 67 0d 0a 6d 61 72 | 67 3d 43 4f 4c 55 4d 4e |ing..mar|g=COLUMN|
|00004ae0| 53 20 70 72 6f 64 75 63 | 65 73 20 61 6e 20 72 78 |S produc|es an rx|
|00004af0| 31 20 6d 61 74 72 69 78 | 20 6f 66 20 72 6f 77 20 |1 matrix| of row |
|00004b00| 73 75 6d 73 2e 0d 0a 0d | 0a 53 75 6d 73 71 28 29 |sums....|.Sumsq()|
|00004b10| 5c 69 6e 64 65 78 7b 66 | 75 6e 63 74 69 6f 6e 73 |\index{f|unctions|
|00004b20| 21 53 75 6d 73 71 28 29 | 7d 20 66 75 6e 63 74 69 |!Sumsq()|} functi|
|00004b30| 6f 6e 73 20 61 73 20 64 | 6f 65 73 20 53 75 6d 28 |ons as d|oes Sum(|
|00004b40| 29 2c 20 62 75 74 0d 0a | 70 72 6f 64 75 63 65 73 |), but..|produces|
|00004b50| 20 73 75 6d 73 20 6f 66 | 20 73 71 75 61 72 65 64 | sums of| squared|
|00004b60| 20 65 6c 65 6d 65 6e 74 | 73 2e 0d 0a 0d 0a 43 75 | element|s.....Cu|
|00004b70| 73 75 6d 28 29 5c 69 6e | 64 65 78 7b 66 75 6e 63 |sum()\in|dex{func|
|00004b80| 74 69 6f 6e 73 21 43 75 | 73 75 6d 28 29 7d 20 66 |tions!Cu|sum()} f|
|00004b90| 6f 72 6d 73 20 61 20 72 | 75 6e 6e 69 6e 67 20 74 |orms a r|unning t|
|00004ba0| 6f 74 61 6c 20 61 63 72 | 6f 73 73 0d 0a 72 6f 77 |otal acr|oss..row|
|00004bb0| 73 2e 20 49 74 20 70 72 | 6f 63 65 64 65 73 20 72 |s. It pr|ocedes r|
|00004bc0| 6f 77 2d 77 69 73 65 20 | 74 68 72 6f 75 67 68 20 |ow-wise |through |
|00004bd0| 61 20 6d 61 74 72 69 78 | 20 61 6e 64 20 72 65 70 |a matrix| and rep|
|00004be0| 6c 61 63 65 73 20 65 61 | 63 68 0d 0a 65 6c 65 6d |laces ea|ch..elem|
|00004bf0| 65 6e 74 20 62 79 20 74 | 68 65 20 63 75 72 72 65 |ent by t|he curre|
|00004c00| 6e 74 20 61 63 63 75 6d | 75 6c 61 74 65 64 20 74 |nt accum|ulated t|
|00004c10| 6f 74 61 6c 2e 0d 0a 0d | 0a 5c 73 75 62 73 65 63 |otal....|.\subsec|
|00004c20| 74 69 6f 6e 7b 4d 6d 69 | 6e 28 29 2c 20 4d 6d 61 |tion{Mmi|n(), Mma|
|00004c30| 78 28 29 7d 0d 0a 4d 6d | 69 6e 28 29 20 61 6e 64 |x()}..Mm|in() and|
|00004c40| 20 4d 6d 61 78 28 29 5c | 69 6e 64 65 78 7b 66 75 | Mmax()\|index{fu|
|00004c50| 6e 63 74 69 6f 6e 73 21 | 4d 6d 69 6e 28 29 2c 20 |nctions!|Mmin(), |
|00004c60| 4d 6d 61 78 28 29 7d 20 | 63 61 6c 63 75 6c 61 74 |Mmax()} |calculat|
|00004c70| 65 20 74 68 65 0d 0a 6d | 69 6e 20 61 6e 64 20 6d |e the..m|in and m|
|00004c80| 61 78 20 6f 66 20 6d 61 | 74 72 69 63 65 73 2e 20 |ax of ma|trices. |
|00004c90| 54 68 65 79 20 61 6c 73 | 6f 20 72 65 74 75 72 6e |They als|o return|
|00004ca0| 20 74 68 65 20 69 6e 64 | 65 78 20 6f 66 20 76 61 | the ind|ex of va|
|00004cb0| 6c 75 65 73 3a 0d 0a 5c | 62 65 67 69 6e 7b 76 65 |lues:..\|begin{ve|
|00004cc0| 72 62 61 74 69 6d 7d 0d | 0a 20 20 20 69 66 20 6d |rbatim}.|. if m|
|00004cd0| 61 72 67 20 3d 20 41 4c | 4c 20 20 20 20 20 20 72 |arg = AL|L r|
|00004ce0| 65 74 75 72 6e 20 33 78 | 31 20 20 20 5b 20 6d 61 |eturn 3x|1 [ ma|
|00004cf0| 78 72 2c 20 6d 61 78 63 | 2c 20 6d 61 78 20 65 6c |xr, maxc|, max el|
|00004d00| 65 6d 65 6e 74 20 5d 0d | 0a 20 20 20 69 66 20 6d |ement ].|. if m|
|00004d10| 61 72 67 20 3d 20 52 4f | 57 53 20 20 20 20 20 72 |arg = RO|WS r|
|00004d20| 65 74 75 72 6e 20 33 78 | 63 20 20 20 54 72 61 6e |eturn 3x|c Tran|
|00004d30| 28 5b 20 6d 61 78 72 2c | 20 63 6f 6c 3d 31 2e 2e |([ maxr,| col=1..|
|00004d40| 63 2c 20 6d 61 78 20 65 | 6c 65 6d 65 6e 74 20 5d |c, max e|lement ]|
|00004d50| 29 0d 0a 20 20 20 69 66 | 20 6d 61 72 67 20 3d 20 |).. if| marg = |
|00004d60| 43 4f 4c 55 4d 4e 53 20 | 20 72 65 74 75 72 6e 20 |COLUMNS | return |
|00004d70| 72 78 33 20 20 20 5b 20 | 72 6f 77 3d 31 2e 2e 72 |rx3 [ |row=1..r|
|00004d80| 2c 20 6d 61 78 63 2c 20 | 6d 61 78 20 65 6c 65 6d |, maxc, |max elem|
|00004d90| 65 6e 74 5d 0d 0a 5c 65 | 6e 64 7b 76 65 72 62 61 |ent]..\e|nd{verba|
|00004da0| 74 69 6d 7d 0d 0a 77 68 | 65 72 65 20 6d 61 78 72 |tim}..wh|ere maxr|
|00004db0| 20 69 73 20 74 68 65 20 | 69 6e 64 65 78 20 6f 66 | is the |index of|
|00004dc0| 20 74 68 65 20 72 6f 77 | 20 6d 61 78 2c 20 6d 61 | the row| max, ma|
|00004dd0| 78 63 20 69 73 20 74 68 | 65 20 69 6e 64 65 78 20 |xc is th|e index |
|00004de0| 6f 66 20 74 68 65 0d 0a | 63 6f 6c 75 6d 6e 20 6d |of the..|column m|
|00004df0| 61 78 2c 20 61 6e 64 20 | 6d 61 78 20 65 6c 65 6d |ax, and |max elem|
|00004e00| 65 6e 74 20 69 73 20 74 | 68 65 20 6d 61 78 69 6d |ent is t|he maxim|
|00004e10| 75 6d 2e 20 4d 6d 69 6e | 28 29 20 66 75 6e 63 74 |um. Mmin|() funct|
|00004e20| 69 6f 6e 73 0d 0a 73 69 | 6d 69 6c 61 72 6c 79 2c |ions..si|milarly,|
|00004e30| 20 20 62 75 74 20 72 65 | 74 75 72 6e 73 20 6d 69 | but re|turns mi|
|00004e40| 6e 69 6e 75 6d 73 20 61 | 6e 64 20 74 68 65 69 72 |ninums a|nd their|
|00004e50| 20 69 6e 64 69 63 65 73 | 2e 0d 0a 0d 0a 5c 73 75 | indices|.....\su|
|00004e60| 62 73 65 63 74 69 6f 6e | 7b 45 6c 65 6d 65 6e 74 |bsection|{Element|
|00004e70| 61 72 79 20 52 6f 77 20 | 61 6e 64 20 43 6f 6c 75 |ary Row |and Colu|
|00004e80| 6d 6e 20 4f 70 65 72 61 | 74 69 6f 6e 73 7d 0d 0a |mn Opera|tions}..|
|00004e90| 54 68 65 20 65 6c 65 6d | 65 6e 74 61 72 79 20 72 |The elem|entary r|
|00004ea0| 6f 77 20 61 6e 64 20 63 | 6f 6c 75 6d 6e 20 6f 70 |ow and c|olumn op|
|00004eb0| 65 72 61 74 69 6f 6e 73 | 20 6f 70 65 72 61 74 65 |erations| operate|
|00004ec0| 20 64 69 72 65 63 74 6c | 79 20 6f 6e 20 61 0d 0a | directl|y on a..|
|00004ed0| 6d 61 74 72 69 78 2e 20 | 54 68 61 74 20 69 73 2c |matrix. |That is,|
|00004ee0| 20 74 68 65 79 20 61 6c | 74 65 72 20 74 68 65 20 | they al|ter the |
|00004ef0| 69 6e 70 75 74 20 6d 61 | 74 72 69 78 2c 20 69 6e |input ma|trix, in|
|00004f00| 73 74 65 61 64 20 6f 66 | 0d 0a 72 65 74 75 72 6e |stead of|..return|
|00004f10| 69 6e 67 20 61 20 6e 65 | 77 20 6d 61 74 72 69 78 |ing a ne|w matrix|
|00004f20| 20 74 68 61 74 20 72 65 | 73 75 6c 74 73 20 66 72 | that re|sults fr|
|00004f30| 6f 6d 20 74 68 65 20 6f | 70 65 72 61 74 69 6f 6e |om the o|peration|
|00004f40| 73 2e 20 54 68 65 0d 0a | 66 75 6e 63 74 69 6f 6e |s. The..|function|
|00004f50| 73 20 61 72 65 3a 0d 0a | 5c 62 65 67 69 6e 7b 76 |s are:..|\begin{v|
|00004f60| 65 72 62 61 74 69 6d 7d | 0d 0a 20 20 20 20 20 20 |erbatim}|.. |
|00004f70| 20 43 72 6f 77 28 20 56 | 4d 61 74 72 69 78 26 20 | Crow( V|Matrix& |
|00004f80| 52 4f 70 2c 20 69 6e 74 | 20 72 6f 77 3d 30 2c 20 |ROp, int| row=0, |
|00004f90| 64 6f 75 62 6c 65 20 63 | 3d 31 2e 30 29 3b 0d 0a |double c|=1.0);..|
|00004fa0| 20 20 20 20 20 20 20 53 | 72 6f 77 28 20 56 4d 61 | S|row( VMa|
|00004fb0| 74 72 69 78 20 26 52 4f | 70 2c 20 69 6e 74 20 72 |trix &RO|p, int r|
|00004fc0| 6f 77 31 20 3d 20 30 2c | 20 69 6e 74 20 72 6f 77 |ow1 = 0,| int row|
|00004fd0| 32 20 3d 20 30 29 3b 0d | 0a 20 20 20 20 20 20 20 |2 = 0);.|. |
|00004fe0| 4c 72 6f 77 28 20 56 4d | 61 74 72 69 78 20 26 52 |Lrow( VM|atrix &R|
|00004ff0| 4f 70 2c 20 69 6e 74 20 | 72 6f 77 31 20 3d 20 30 |Op, int |row1 = 0|
|00005000| 2c 20 69 6e 74 20 72 6f | 77 32 20 3d 20 30 2c 20 |, int ro|w2 = 0, |
|00005010| 64 6f 75 62 6c 65 20 63 | 3d 30 2e 30 29 3b 0d 0a |double c|=0.0);..|
|00005020| 20 20 20 20 20 20 20 43 | 63 6f 6c 28 20 56 4d 61 | C|col( VMa|
|00005030| 74 72 69 78 26 20 52 4f | 70 2c 20 69 6e 74 20 63 |trix& RO|p, int c|
|00005040| 6f 6c 3d 30 2c 20 64 6f | 75 62 6c 65 20 63 3d 31 |ol=0, do|uble c=1|
|00005050| 2e 30 29 3b 0d 0a 20 20 | 20 20 20 20 20 53 63 6f |.0);.. | Sco|
|00005060| 6c 28 20 56 4d 61 74 72 | 69 78 20 26 52 4f 70 2c |l( VMatr|ix &ROp,|
|00005070| 20 69 6e 74 20 63 6f 6c | 31 20 3d 20 30 2c 20 69 | int col|1 = 0, i|
|00005080| 6e 74 20 63 6f 6c 32 20 | 3d 20 30 29 3b 0d 0a 20 |nt col2 |= 0);.. |
|00005090| 20 20 20 20 20 20 4c 63 | 6f 6c 28 20 56 4d 61 74 | Lc|ol( VMat|
|000050a0| 72 69 78 20 26 52 4f 70 | 2c 20 69 6e 74 20 63 6f |rix &ROp|, int co|
|000050b0| 6c 31 20 3d 20 30 2c 20 | 69 6e 74 20 63 6f 6c 32 |l1 = 0, |int col2|
|000050c0| 20 3d 20 30 2c 20 64 6f | 75 62 6c 65 20 63 3d 30 | = 0, do|uble c=0|
|000050d0| 2e 30 29 3b 0d 0a 5c 65 | 6e 64 7b 76 65 72 62 61 |.0);..\e|nd{verba|
|000050e0| 74 69 6d 7d 0d 0a 43 72 | 6f 77 28 29 28 43 63 6f |tim}..Cr|ow()(Cco|
|000050f0| 6c 28 29 29 5c 69 6e 64 | 65 78 7b 66 75 6e 63 74 |l())\ind|ex{funct|
|00005100| 69 6f 6e 73 21 43 72 6f | 77 28 29 2c 20 43 63 6f |ions!Cro|w(), Cco|
|00005110| 6c 28 29 7d 20 6d 75 6c | 74 69 70 6c 79 20 74 68 |l()} mul|tiply th|
|00005120| 65 0d 0a 72 6f 77 28 63 | 6f 6c 29 20 62 79 20 74 |e..row(c|ol) by t|
|00005130| 68 65 20 63 6f 6e 73 74 | 61 6e 74 20 63 2e 0d 0a |he const|ant c...|
|00005140| 53 72 6f 77 28 29 28 53 | 63 6f 6c 28 29 29 5c 69 |Srow()(S|col())\i|
|00005150| 6e 64 65 78 7b 66 75 6e | 63 74 69 6f 6e 73 21 53 |ndex{fun|ctions!S|
|00005160| 72 6f 77 28 29 2c 53 63 | 6f 6c 28 29 7d 20 73 77 |row(),Sc|ol()} sw|
|00005170| 61 70 20 72 6f 77 31 20 | 77 69 74 68 0d 0a 72 6f |ap row1 |with..ro|
|00005180| 77 32 20 28 63 6f 6c 31 | 20 77 69 74 68 20 63 6f |w2 (col1| with co|
|00005190| 6c 32 29 2e 0d 0a 4c 72 | 6f 77 28 29 28 4c 63 6f |l2)...Lr|ow()(Lco|
|000051a0| 6c 28 29 29 5c 69 6e 64 | 65 78 7b 66 75 6e 63 74 |l())\ind|ex{funct|
|000051b0| 69 6f 6e 73 21 4c 72 6f | 77 28 29 2c 4c 63 6f 6c |ions!Lro|w(),Lcol|
|000051c0| 28 29 7d 20 61 64 64 20 | 61 20 63 6f 6e 73 74 61 |()} add |a consta|
|000051d0| 6e 74 0d 0a 6d 75 6c 74 | 69 70 6c 65 20 6f 66 20 |nt..mult|iple of |
|000051e0| 72 6f 77 31 20 74 6f 20 | 72 6f 77 32 2e 0d 0a 0d |row1 to |row2....|
|000051f0| 0a 4e 6f 74 65 20 74 68 | 61 74 20 74 68 65 20 66 |.Note th|at the f|
|00005200| 75 6e 63 74 69 6f 6e 73 | 20 73 75 70 70 6c 79 20 |unctions| supply |
|00005210| 6f 75 74 20 6f 66 20 72 | 61 6e 67 65 20 64 65 66 |out of r|ange def|
|00005220| 61 75 6c 74 20 61 72 67 | 75 6d 65 6e 74 73 2e 0d |ault arg|uments..|
|00005230| 0a 54 68 69 73 20 66 6f | 72 63 65 73 20 79 6f 75 |.This fo|rces you|
|00005240| 20 74 6f 20 73 75 70 70 | 6c 79 20 61 6c 6c 20 6f | to supp|ly all o|
|00005250| 66 20 74 68 65 20 76 61 | 6c 75 65 73 20 63 6f 72 |f the va|lues cor|
|00005260| 72 65 63 74 6c 79 2e 20 | 54 68 65 20 64 65 66 61 |rectly. |The defa|
|00005270| 75 6c 74 0d 0a 63 6f 6e | 73 74 61 6e 74 73 20 70 |ult..con|stants p|
|00005280| 65 72 66 6f 72 6d 20 6e | 6f 20 61 63 74 69 6f 6e |erform n|o action|
|00005290| 2c 20 73 6f 20 74 68 65 | 79 20 6d 75 73 74 20 61 |, so the|y must a|
|000052a0| 6c 73 6f 20 62 65 20 73 | 75 70 70 6c 69 65 64 2e |lso be s|upplied.|
|000052b0| 0d 0a | |.. | |
+--------+-------------------------+-------------------------+--------+--------+