1function cs_install (do_pause)
2%CS_INSTALL: compile and install CXSparse for use in MATLAB.
3%   Your current working directory must be CXSparse/MATLAB in order to use this
4%   function.
5%
6%   The directories
7%
8%       CXSparse/MATLAB/CSparse
9%       CXSparse/MATLAB/Demo
10%       CXSparse/MATLAB/ssget
11%
12%   are added to your MATLAB path (see the "pathtool" command to add these to
13%   your path permanently, for future MATLAB sessions).
14%
15%   Next, the MATLAB CXSparse demo program, CXSparse/MATLAB/cs_demo is executed.
16%   To run the demo with pauses so you can see the results, use cs_install(1).
17%   To run the full MATLAB test programs for CXSparse, run testall in the
18%   Test directory.
19%
20%   Example:
21%       cs_install          % install and run demo with no pauses
22%       cs_install(1)       % install and run demo with pauses
23%
24%   See also: cs_demo
25%
26%   Copyright 2006-2012, Timothy A. Davis, http://www.suitesparse.com
27
28fprintf ('Compiling and installing CXSparse\n') ;
29if (nargin < 1)
30    do_pause = 0 ;
31end
32
33if (do_pause)
34    input ('Hit enter to continue: ') ;
35end
36addpath ([pwd '/CSparse']) ;
37addpath ([pwd '/Demo']) ;
38
39if (verLessThan ('matlab', '8.4'))
40    fprintf ('ssget not installed (MATLAB 8.4 or later required)\n') ;
41else
42    % install ssget, unless it's already in the path
43    try
44        % if this fails, then ssget is not yet installed
45        index = ssget ;
46        fprintf ('ssget already installed:\n') ;
47        which ssget
48    catch
49        index = [ ] ;
50    end
51    if (isempty (index))
52        % ssget is not installed.  Use ./ssget
53        fprintf ('Installing ./ssget\n') ;
54        try
55            addpath ([pwd '/ssget']) ;
56        catch me
57            disp (me.message) ;
58            fprintf ('ssget not installed\n') ;
59        end
60    end
61end
62
63cd ('CSparse') ;
64cs_make (1) ;
65cd ('../Demo') ;
66cs_demo (do_pause)
67