5164
|
1 ## Copyright (C) 1998-2004 Andy Adler |
|
2 ## |
|
3 ## This program is free software; you can redistribute it and/or modify |
|
4 ## it under the terms of the GNU General Public License as published by |
|
5 ## the Free Software Foundation; either version 2 of the License, or |
|
6 ## (at your option) any later version. |
|
7 ## |
|
8 ## This program is distributed in the hope that it will be useful, |
|
9 ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
10 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
11 ## GNU General Public License for more details. |
|
12 ## |
|
13 ## You should have received a copy of the GNU General Public License |
|
14 ## along with this program; if not, write to the Free Software |
5307
|
15 ## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
16 ## 02110-1301 USA |
5164
|
17 |
|
18 ## -*- texinfo -*- |
|
19 ## @deftypefn {Function File} {} spy (@var{x}) |
|
20 ## Plot the sparsity pattern of the sparse matrix @var{x}. |
|
21 ## @end deftypefn |
|
22 |
6446
|
23 function spy (S) |
|
24 |
|
25 if (issparse (S)) |
|
26 [i, j, s, m, n] = spfind (S); |
5164
|
27 else |
6446
|
28 [i, j, s] = find (S); |
|
29 [m, n] = size (S); |
5164
|
30 endif |
|
31 |
6446
|
32 if (numel (i) < 1000) |
|
33 plot (j, i, "*"); |
|
34 else |
|
35 plot (j, i, "."); |
|
36 endif |
5164
|
37 |
6606
|
38 axis ([0, n+1, m+1, 0]); |
5164
|
39 |
|
40 endfunction |