File: sskinds.m

package info (click to toggle)
suitesparse 1%3A7.10.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 254,920 kB
  • sloc: ansic: 1,134,743; cpp: 46,133; makefile: 4,875; fortran: 2,087; java: 1,826; sh: 996; ruby: 725; python: 495; asm: 371; sed: 166; awk: 44
file content (74 lines) | stat: -rw-r--r-- 2,232 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
function kinds = sskinds
%SSKINDS get 'kind' of each problem in the SuiteSparse Matrix Collection.
%
% A problem 'kind' is the domain from which the problem arises.  Examples
% include 'circuit simulation', 'optimization', 'least squares', and 'robotics'.
% See ssget/README.txt for a complete list.
%
% A 'kind' is related to the matrix 'Group'.  The latter is determined by
% person, persons, or organization that created the matrix.  'Group' may also
% refer to another matrix collection that has been included in this collection
% (such as 'HB' for the Harwell/Boeing collection).
%
% kinds = sskinds returns a cell array with one row per matrix.  kinds{id}
% is the same as Problem.kind where Problem=ssget(id).  If an error occurs,
% an empty cell array is returned.
%
% Example:
%
%   kinds = sskinds ;
%   Problem = ssget (42)
%   kinds{42}
%
% results in the following output:
%
%   Problem = 
%        title: 'SYMMETRIC STIFFNEss MATRIX - FRAME WITHIN A SUSPENSION BRIDGE'
%            A: [485x485 double]
%         name: 'HB/bcsstk20'
%           id: 42
%         date: '1984'
%       author: 'J. Lewis'
%           ed: 'I. Duff, R. Grimes, J. Lewis'
%         kind: 'structural problem'
%
%   ans =
%       'structural problem'
%
% To find a list t of the id's all matrices from material science:
%
%   kinds = sskinds ;
%   t = zeros (1, length (kinds)) ;
%   for id = 1:length(kinds)
%       t (id) = ~isempty (strfind (kinds {id}, 'material')) ;
%   end
%   t = find (t) ;
%   for id = t
%       Problem = ssget (id)
%   end
%
% See also ssget.

% ssget, Copyright (c) 2009-2022, Timothy A. Davis. All Rights Reserved.
% SPDX-License-Identifier: BSD-3-clause

params = ssget_defaults ;
statfile = sprintf ('%sfiles/ssstats.csv', params.topdir) ;

try
    f = fopen (statfile, 'r') ;
    nmat = str2double (fgetl (f)) ;     % number of matrices
    s = fgetl (f) ;  %#ok               % date ssstats.csv was created (unused)
    kinds = cell (nmat,1) ;
    for id = 1:nmat
        s = fgetl (f) ;
        t = find (s == ',') ;
        t1 = t (11) ;
        t2 = t (12) ;
        r = s ((t1+1):(t2-1)) ;
        kinds {id} = r ;
    end
catch
    kinds = cell (0,0) ;                % return empty string on error
end