#/bin/csh
#Script that automatically demonstrates the capabilities of LANZ is
#several different situations

#NOTE: THIS SCRIPT TAKES ONE ARGUMENT, THE NAME OF THE MACHINE.  ON A SUN-4
#      YOU WOULD TYPE "autotest sun4" TO RUN THIS SCRIPT.

#To check that LANZ is working correctly, the user can compare the output
#of each test (in files called test#) to results that are known to be
#correct from runs on a SUN-4 (in files called out#).  Differences in
#timing and small differences in numerical results can be expected on different
#machines.  When dynamic shifting is on, results can be quite different
#because the tradeoff involving taking another shift may be very different on
#different machines.

#No tests of large problems are included because no large problems are
#included with the distribution package.  However, some large problems can be
#acquired from Mark Jones via e-mail "mjones@mcs.anl.gov".

#Throughout the tests, the debugging level is 0, the maximum number of
#iterations will be the size of the matrix, the number of eigenvalues to
#store will 20, the matrices will be read in ascii format and not written out

#Test matrix descriptions
#    cy7*  -- Generated by a finite element model of circular cylindrical
#             shell (cy7.k is the stiffness matrix, cy7.m.sp is the 
#             consistent mass matrix, cy7.m.diag is the diagonal mass
#             matrix, and cy7.indef is the geometric stiffness matrix)
#   
#    tmat1.k -- 8x8 matrix with 8 unique, non-zero eigenvalues.
#   
#    tmat1.m -- 8x8 identity matrix
#   
#    tmat2.k -- 40x40 diagonal matrix with 4 pairs of non-zero eigenvalues
#               and unique 32 non-zero eigenvalues
#   
#    tmat2.m -- 40x40 identity matrix
#   
#    tmat3.m -- 8x8 matrix with only 4 non-zero entries, all on the diagonal
#   
#    The small problems are merely included to demonstrate some
#    possibly difficult matrices that LANZ can cope with.  It would
#    be a mistake to use LANZ for such small problems.  It would also
#    be a mistake to use LANZ to find all the eigenvalues.
#
#Test 1: find 1 eigenvalue
#        semi-positive definite diagonal M matrix
#        no inertia checking
#        report level 4
#        take at most 35 steps on one shift
#        find eigenvalues closest to shift
#        use appropriate banded factorization
#        allow dynamic shifting
#        no delayed pivot space, since not using sparse methods
#        shift of 0.0
#        relative accuracy 0.0001
#        if banded B-K factorization is used then allow 1.1 times
#              as much space as for banded LDL factorization
#
# run test 1
cp cy7.k fort.7
cp cy7.m.diag fort.8
cp input.test1 fort.9
if ($1 == "encore") then
forcerun lanz.$1 1 >& test1
else if ($1 == "pymp") then
forcerun lanz.$1 1 >& test1
else
lanz.$1 >& test1
endif
#   
#Test 2: find 10 eigenvalues
#        semi-positive definite non-diagonal M matrix
#        use inertia checking
#        report level 3
#        take at most 35 steps on one shift
#        find eigenvalues closest to shift
#        use appropriate sparse factorization
#        do not allow dynamic shifting
#        allow for 10 delayed pivots, since we might need them
#        shift of 1.0E6
#        relative accuracy 0.001
#        don't care about extra space for banded B-K
#
# run test 2
cp cy7.k fort.7
cp cy7.m.sp fort.8
cp input.test2 fort.9
if ($1 == "encore") then
forcerun lanz.$1 1 >& test2
else if ($1 == "pymp") then
forcerun lanz.$1 1 >& test2
else
lanz.$1 >& test2
endif
#   
#Test 3: find all eigenvalues in a range
#        indefinite M matrix
#        don't use inertia checking
#        report level 2
#        take at most 35 steps on one shift
#        find eigenvalues between 1.0 and 1.3
#        use appropriate banded factorization
#        allow dynamic shifting
#        no delayed pivot space, since not using sparse methods
#        shift (determined by range)
#        relative accuracy 0.00001
#        if banded B-K factorization is used then allow 1.1 times
#              as much space as for banded LDL factorization
#
# run test 3
cp cy7.k fort.7
cp cy7.m.indef fort.8
cp input.test3 fort.9
if ($1 == "encore") then
forcerun lanz.$1 1 >& test3
else if ($1 == "pymp") then
forcerun lanz.$1 1 >& test3
else
lanz.$1 >& test3
endif
#   
#Test 4: find 15 eigenvalues
#        indefinite M matrix
#        don't use inertia checking
#        report level 1
#        take at most 15 steps on one shift
#        find eigenvalues closest to shift
#        use only LDL sparse factorization
#        allow dynamic shifting
#        allow for 20 delayed pivots
#        shift of 0.0
#        relative accuracy 0.0001
#        don't care about banded B-K
#
# run test 4
cp cy7.k fort.7
cp cy7.m.indef fort.8
cp input.test4 fort.9
if ($1 == "encore") then
forcerun lanz.$1 1 >& test4
else if ($1 == "pymp") then
forcerun lanz.$1 1 >& test4
else
lanz.$1 >& test4
endif
#   
#Test 5: find all 8 eigenvalues
#        semi-positive definite diagonal M matrix
#        no inertia checking
#        report level 4
#        take at most 35 steps on one shift
#        find eigenvalues closest to shift
#        use appropriate banded factorization
#        allow dynamic shifting
#        no delayed pivot space, since not using sparse methods
#        shift of 0.0
#        relative accuracy 0.0001
#        if banded B-K factorization is used then allow 1.1 times
#              as much space as for banded LDL factorization
#
# run test 5
cp tmat1.k fort.7
cp tmat1.m fort.8
cp input.test5 fort.9
if ($1 == "encore") then
forcerun lanz.$1 1 >& test5
else if ($1 == "pymp") then
forcerun lanz.$1 1 >& test5
else
lanz.$1 >& test5
endif
#   
#Test 6: find lowest 8 eigenvalues
#        semi-positive definite diagonal M matrix
#        no inertia checking
#        report level 4
#        take at most 35 steps on one shift
#        find eigenvalues closest to shift
#        use appropriate banded factorization
#        allow dynamic shifting
#        no delayed pivot space, since not using sparse methods
#        shift of 0.0
#        relative accuracy 0.0001
#        if banded B-K factorization is used then allow 1.1 times
#              as much space as for banded LDL factorization
#
# run test 6
cp tmat2.k fort.7
cp tmat2.m fort.8
cp input.test6 fort.9
if ($1 == "encore") then
forcerun lanz.$1 1 >& test6
else if ($1 == "pymp") then
forcerun lanz.$1 1 >& test6
else
lanz.$1 >& test6
endif
#   
#Test 7: find all 4 nonzero eigenvalues
#        semi-positive definite diagonal M matrix
#        no inertia checking
#        report level 4
#        take at most 35 steps on one shift
#        find eigenvalues closest to shift
#        use appropriate banded factorization
#        allow dynamic shifting
#        no delayed pivot space, since not using sparse methods
#        shift of 0.0
#        relative accuracy 0.0001
#        if banded B-K factorization is used then allow 1.1 times
#              as much space as for banded LDL factorization
#
# run test 7
cp tmat1.k fort.7
cp tmat3.m fort.8
cp input.test7 fort.9
if ($1 == "encore") then
forcerun lanz.$1 1 >& test7
else if ($1 == "pymp") then
forcerun lanz.$1 1 >& test7
else
lanz.$1 >& test7
endif
rm fort.7 fort.8 fort.9
