Installation instructions for fast_clf
-----------------------------------------------------------------------

fast_clf is written in C with a mex interface to MATLAB.  Before 
installation, make sure that BLAS and LAPACK libraries are installed
in your machine. 


1. Unpack the fast_clf files, or get them individually.

2. Start MATLAB and cd to the directory containing the source files.

3. At the MATLAB command prompt type

        >> mex -setup

   and enter the number corresponding to the template option gccopts.sh.

4. Compile clf_sim.c using

        >> mex clf_sim.c

   On some machines you may need to specify the libraries

        >> mex clf_sim.c -lblas -llapack
    
   If you want to link your own libraries, you can. For example,
   to link the libraries libacml.a, libacml_mv.a, and libgfortran.a 
   in the directory /opt/acml/lib, use the option '-L' to specify the 
   library search path and the option '-l' to specify the individual 
   libraries, as in

       >> mex clf_sim.c -L/opt/acml/lib -lacml -lacml_mv -lgfortran

5. Test the installation by running the masses_example script

       >> clf_example

   which will run the CLF control policy, for 10000 steps, on a
   randomly generated system using clf_sim. For each iteration where a
   QP is solved, you should see the steps of the interior-point method 
   printed to your screen. This looks like, for example

iteration 	 step 		 res
    0 		 0.5000 	 9.76477e+00
    1 		 0.5000 	 4.88238e+00
    2 		 0.2500 	 3.66179e+00
    3 		 0.2500 	 2.74634e+00
    4 		 0.5000 	 1.37317e+00
    5 		 1.0000 	 8.82619e-04

6. Note: for better timing results you should disable output to screen
   by setting:
        
        params.quiet = true;

   in the file clf_example.m.
