  ***************************************************************************
  * All the software  contained in this library  is protected by copyright. *
  * Permission  to use, copy, modify, and  distribute this software for any *
  * purpose without fee is hereby granted, provided that this entire notice *
  * is included  in all copies  of any software which is or includes a copy *
  * or modification  of this software  and in all copies  of the supporting *
  * documentation for such software.                                        *
  ***************************************************************************
  * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED *
  * WARRANTY. IN NO EVENT, NEITHER  THE AUTHORS, NOR THE PUBLISHER, NOR ANY *
  * MEMBER  OF THE EDITORIAL BOARD OF  THE JOURNAL  "NUMERICAL ALGORITHMS", *
  * NOR ITS EDITOR-IN-CHIEF, BE  LIABLE FOR ANY ERROR  IN THE SOFTWARE, ANY *
  * MISUSE  OF IT  OR ANY DAMAGE ARISING OUT OF ITS USE. THE ENTIRE RISK OF *
  * USING THE SOFTWARE LIES WITH THE PARTY DOING SO.                        *
  ***************************************************************************
  * ANY USE  OF THE SOFTWARE  CONSTITUTES  ACCEPTANCE  OF THE TERMS  OF THE *
  * ABOVE STATEMENT.                                                        *
  ***************************************************************************

   AUTHORS:

       Dario A. Bini
       Dipartimento di Matematica
       Universita' di Pisa, Pisa, Italy
       bini@dm.unipi.it

       Ana Marco
       Departemento de Matematicas
       Universidad de Alcala, Madrid, Spain
       
   REFERENCE:

    -  Computing curve intersection by means of simultaneous iterations
       NUMERICAL ALGORITHMS, 43 (2006), 151-175

   SOFTWARE REVISION DATE:

       V1.0, December 2006

   SOFTWARE LANGUAGE:

       Fortran 95

=====================================================================
PACKAGE
=====================================================================

The directory contains the following files

README             :  this file
system_main.f90    :  main fortran 95 program   
system_module.f90  :  fortran 95 subroutines
md_stnd.f90        :  fortran 95 implementation of the Manocha-Demmel alg.
                      with standard eigenvalues
md_gen.f90         :  fortran 95 implementation of the Manocha-Demmel alg.
                      with generalized eigenvalues
Makefile           :  make file
make.inc           :  file used by Makefile (it defines Compiler and options 
                      to be used)
test_ea            :  script file with a partial test of Ehrlich-Aberth
                      it prints on the screen the results
test_mdstnd        :  script file with a partial test of Manocha-Demmel
                      it prints on the screen the results
test_mdgen         :  script file with a partial test of Manocha-Demmel
                      it prints on the screen the results
Tests_g95          :  directory with the computed results of test_ea,
                      test_mdgen, test_mdstnd, compiled with g95
Tests_lahey        :  directory with the computed results of test_ea,
                      test_mdgen, test_mdstnd, compiled with the compiler Lahey
polynomials        :  directory with the set of test polynomials
pol.pol            :  data file with a test polynomial. Default input file used 
                      by the program system_main.f90 
min_blas_lapack    :  directory with the needed routines selected from
                      BLAS, LAPACK and LAPACK95

==========
COMPILER
==========

The fortran 95 compiler used in the makefile is g95. For different
compilers you have to edit the file make.inc and modify the name of the
compiler together with the optimization flags. 

In the file make.inc you may find the settings for the following compilers:
Lahey Fortran
g95 GNU Fortran 
Intel Fortran (32 bits CPU)
f95 NAG Fortran (32 bits CPU)

The modifications have to be made before installing the software.

=====================================================================
HOW TO INSTALL
=====================================================================

The software is installed with the command 'make'
followed by one of the following options

ea          for the Ehrlich-Aberth iteration
md_stnd     for the Manocha-Demmel algorithm with the standard eigenvalue problem
md_gen      for the Manocha-Demmel algorithm with the generalized eigenvalue problem
all         for all the above three programs
blas        for making the BLAS library
lapack      for making the LAPACK library
lapack95    for making the LAPACK95 library
clean       for removing the object and the module files
cleanlib    for removing the libraries generated
cleanall    for removing libraries, object and module files

==========
LIBRARIES
==========

The makefile creates some libraries containing the lapack, blas and lapack95
programs needed in the computation and in the compilation of the programs.
After that executable programs have been create, the libraries can be
removed by the command

cleanlib

==========
PROGRAMS
==========

You can create simultaneously the three executable ea (Ehrlich-Aberth), 
md_stnd (Manocha-Demmel with standard eigenvalues) and md_gen 
(Manocha-Demmel with generalized eigenvalues) with the command

make all

or select the desired program:

make ea
for creating just the executable ea

make md_stnd
for creating just the executable md_stnd

make md_gen
for creating just the executable md_gen

If you made some modification into the source program, you
have first to remove all the executables and the files *.o
with the command
make clean
and after recreate the executable(s)

Remark: During the compilation some Warning can appear. 
        Don't worry about it.
=====================
STANDARD INSTALLATION
=====================

For the standard installation, give the following commands

make all
make cleanlib

=====================
INSTALLATION TEST
=====================

To test the software there are three script files (one for
each program):
test_ea
test_mdgen
test_mdstnd
The corresponding precomputed results have been stored in the files
test_ea.res
test_mdgen.res
test_mdstnd.res
of the directory Tests_g95 (for Fortran GNU g95 compiler) or of the directory
Tests_lahey (for Fortran Lahey compiler)

So, for example, you may type 
./test_ea > test_ea.new
and compare the results
that you get with the ones in the file test_ea.res which you find in the
directories Tests_g95 and Test_lahey

The numerical results may slightly differ in the less significant digits
according to the Fortran compiler and to the processor on which the program
is run.

Several polynomials are tested for each script file. 
The polynomials equal40, equal50, equal60 have been commented out with a "#"
from the script files test_ea, test_mdgen, test_mdstnd in order to save time.
Remove the "#" in the corresponding lines if you wish to run these tests.

================
RUN THE PROGRAMS
================

The program ea implements the algorithm for computing curve intersection,
by using the Ehrlich-Aberth iteration.
The program reads the polynomials data from the file "pol.pol".
If you want to change the name of the file will be read, you have to
edit the source file system_main.f90 and modify the statements
!  write(*,*)'Type the file name with the input data'
!  read(*,*)filename
  filename='pol.pol'
into
  write(*,*)'Type the file name with the input data'
  read(*,*)filename
!  filename='pol.pol'

The file must contain:
 t1,t2,u1,u2
 na1,na2,na3,na4
 nb1,nb2,nb3,nb4
 the coefficient of the polynomials a1--a4, b1--b4 with increasing 
 degree, each coefficient on a different line

The output is on the screen. For having an output file, use the
redirection Unix command >

The same rules apply to the programs md_stnd and md_gen

=======================================================================
The test reported in the paper 
Computing curve intersection by means of simultaneous iterations
NUMERICAL ALGORITHMS, 43 (2006), 151-175
have been made by using (respectively) the following polynomials

Test1: smallrootB0, smallrootB1, smallrootB2
Test2: equal20, equal30, equal40, equal50, equal60
Test3: bezier14int, bezier12rat, bezier15R
Test4: Casciola1R

