Mercurial > matrix-functions
comparison toolbox/matrix.m @ 2:c124219d7bfa draft
Re-add the 1995 toolbox after noticing the statement in the ~higham/mctoolbox/ webpage.
author | Antonio Pino Robles <data.script93@gmail.com> |
---|---|
date | Thu, 07 May 2015 18:36:24 +0200 |
parents | 8f23314345f4 |
children |
comparison
equal
deleted
inserted
replaced
1:e471a92d17be | 2:c124219d7bfa |
---|---|
1 function A = matrix(k, n) | |
2 %MATRIX Test Matrix Toolbox information and matrix access by number. | |
3 % MATRIX(K, N) is the N-by-N instance of the matrix number K in | |
4 % the Test Matrix Toolbox (including some of the matrices provided | |
5 % with MATLAB), with all other parameters set to their default. | |
6 % N.B. Only those matrices which take an arbitrary dimension N | |
7 % are included (thus GALLERY is omitted, for example). | |
8 % MATRIX(K) is a string containing the name of the K'th matrix. | |
9 % MATRIX(0) is the number of matrices, i.e. the upper limit for K. | |
10 % Thus to set A to each N-by-N test matrix in turn use a loop like | |
11 % for k=1:matrix(0) | |
12 % A = matrix(k, N); | |
13 % Aname = matrix(k); % The name of the matrix | |
14 % end | |
15 % MATRIX(-1) returns the version number and date of the toolbox. | |
16 % MATRIX with no arguments lists the names of the M-files in the | |
17 % collection. | |
18 | |
19 % References: | |
20 % N.J. Higham. The Test Matrix Toolbox for Matlab (version 3.0), | |
21 % Numerical Analysis Report No. 276, Manchester Centre for | |
22 % Computational Mathematics, Manchester, England, September 1995. | |
23 % N.J. Higham, Algorithm 694: A collection of test matrices in | |
24 % MATLAB, ACM Trans. Math. Soft., 17 (1991), pp. 289-305. | |
25 % | |
26 % Matrices omitted are: gallery, hadamard, hanowa, lauchli, | |
27 % neumann, wathen, wilk. | |
28 % Matrices provided with MATLAB that are included here: invhilb, | |
29 % magic. | |
30 | |
31 % Set up string array a few lines at a time to avoid `input buffer line | |
32 % overflow'. | |
33 | |
34 matrices = ''; | |
35 | |
36 matrices = [matrices | |
37 'augment '; 'cauchy '; 'chebspec'; 'chebvand'; | |
38 'chow '; 'circul '; 'clement '; 'compan '; | |
39 'condex '; 'cycol '; 'dingdong'; 'dorr '; | |
40 'dramadah'; 'fiedler '; 'forsythe'; 'frank ';]; | |
41 | |
42 matrices = [matrices | |
43 'gearm '; 'gfpp '; 'grcar '; 'hilb '; | |
44 'invhess '; 'invol '; 'ipjfact '; 'jordbloc'; | |
45 'kahan '; 'kms '; 'krylov '; 'lehmer '; | |
46 'lesp '; 'lotkin '; 'makejcf '; 'minij ';]; | |
47 | |
48 matrices = [matrices | |
49 'moler '; 'ohess '; 'orthog '; 'parter '; | |
50 'pascal '; 'pdtoep '; 'pei '; 'pentoep '; | |
51 'prolate '; 'rando '; 'randsvd '; | |
52 'redheff '; 'riemann '; 'rschur '; 'smoke '; | |
53 'tridiag '; 'triw '; 'vand ';]; | |
54 | |
55 if nargin == 0 | |
56 | |
57 fprintf('Test matrices: \n') | |
58 fprintf(' \n') | |
59 fprintf('augment cycol gfpp kahan moler poisson triw \n') | |
60 fprintf('cauchy dingdong grcar kms neumann prolate vand \n') | |
61 fprintf('chebspec dorr hadamard krylov ohess rando wathen \n') | |
62 fprintf('chebvand dramadah hanowa lauchli orthog randsvd wilk \n') | |
63 fprintf('chow fiedler hilb lehmer parter redheff \n') | |
64 fprintf('circul forsythe invhess lesp pascal riemann \n') | |
65 fprintf('clement frank invol lotkin pdtoep rschur \n') | |
66 fprintf('compan gallery ipjfact makejcf pei smoke \n') | |
67 fprintf('condex gearm jordbloc minij pentoep tridiag \n') | |
68 fprintf(' \n') | |
69 fprintf('Visualization: Decompositions: Miscellaneous: \n') | |
70 fprintf(' \n') | |
71 fprintf('fv cgs gj bandred matrix show \n') | |
72 fprintf('gersh cholp mgs chop matsignt skewpart\n') | |
73 fprintf('ps cod poldec comp pnorm sparsify\n') | |
74 fprintf('pscont diagpiv signm cond qmult sub \n') | |
75 fprintf('see ge cpltaxes rq symmpart\n') | |
76 fprintf(' gecp dual seqa trap2tri\n') | |
77 fprintf(' eigsens seqcheb \n') | |
78 fprintf(' house seqm \n') | |
79 fprintf(' eigsens seqcheb \n\n') | |
80 fprintf('Direct search optimization: adsmax, mdsmax, nmsmax \n') | |
81 fprintf('Demonstration: tmtdemo \n') | |
82 | |
83 elseif nargin == 1 | |
84 if k == 0 | |
85 [A, temp] = size(matrices); | |
86 elseif k > 0 | |
87 A = matrices(k,:); | |
88 else | |
89 % Version number and date of collection. | |
90 % A = 'Version 1.0, July 4 1989'; | |
91 % A = 'Version 1.1, November 15 1989'; | |
92 % A = 'Version 1.2, May 30 1990'; | |
93 % A = 'Version 1.3, November 14 1991'; | |
94 % A = 'Version 2.0, November 14 1993'; | |
95 A = 'Version 3.0, September 19 1995'; | |
96 end | |
97 else | |
98 A = eval( [matrices(k,:) '(n)'] ); | |
99 end |