lib_ex_pour_HZpp/Partie_2/algebre_lineaire/IML++/imltext.shar

1 line
19 KiB
Bash
Executable file

#!/bin/sh
# This is a shell archive (produced by shar 3.49)
# To extract the files from this archive, save it to a file, remove
# everything above the "!/bin/sh" line above, and type "sh file_name".
#
# made 09/26/1995 18:40 UTC by pozo@rowan
# Source directory /tmp_mnt/home/fs2c/pozo/projects/iml
#
# existing files will NOT be overwritten unless -c is specified
#
# This shar contains:
# length mode name
# ------ ---------- ------------------------------------------
# 1304 -rw-rw---- testing/tbicg.cc
# 1314 -rw-rw---- testing/tbicgsta.cc
# 1270 -rw-rw---- testing/tcg.cc
# 1272 -rw-rw---- testing/tcgs.cc
# 1435 -rw-rw---- testing/tcheby.cc
# 1487 -rw-rw---- testing/tgmres.cc
# 1264 -rw-rw---- testing/ticcg.cc
# 1491 -rw-rw---- testing/tilugmre.cc
# 1270 -rw-rw---- testing/tir.cc
# 1317 -rw-rw---- testing/tqmr.cc
#
# ============= testing/tbicg.cc ==============
if test ! -d 'testing'; then
echo 'x - creating directory testing'
mkdir 'testing'
fi
if test -f 'testing/tbicg.cc' -a X"$1" != X"-c"; then
echo 'x - skipping testing/tbicg.cc (File already exists)'
else
echo 'x - extracting testing/tbicg.cc (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'testing/tbicg.cc' &&
#include <stdlib.h> // System includes
#include <iostream.h> //
X
#include "compcol_double.h" // Compressed column matrix header
#include "iohb_double.h" // Harwell-Boeing matrix I/O header
#include "mvblasd.h" // MV_Vector level 1 BLAS
#include "diagpre_double.h" // Diagonal preconditioner
X
#include "bicg.h" // IML++ BiCG template
X
int
main(int argc, char * argv[])
{
X if (argc < 2) {
X cerr << "Usage: " << argv[0] << " HBfile " << endl;
X exit(-1);
X }
X
X double tol = 1.e-6; // Convergence tolerance
X int result, maxit = 150; // Maximum iterations
X
X CompCol_Mat_double A; // Create a matrix
X readHB_mat(argv[1], &A); // Read matrix data
X VECTOR_double b, x(A.dim(1), 0.0); // Create rhs, solution vectors
X readHB_rhs(argv[1], &b); // Read rhs data
X
X DiagPreconditioner_double D(A); // Create diagonal preconditioner
X
X result = BiCG(A, x, b, D, maxit, tol); // Solve system
X
X cout << "BiCG flag = " << result << endl;
X cout << "iterations performed: " << maxit << endl;
X cout << "tolerance achieved : " << tol << endl;
X
X return result;
}
SHAR_EOF
chmod 0660 testing/tbicg.cc ||
echo 'restore of testing/tbicg.cc failed'
Wc_c="`wc -c < 'testing/tbicg.cc'`"
test 1304 -eq "$Wc_c" ||
echo 'testing/tbicg.cc: original size 1304, current size' "$Wc_c"
fi
# ============= testing/tbicgsta.cc ==============
if test -f 'testing/tbicgsta.cc' -a X"$1" != X"-c"; then
echo 'x - skipping testing/tbicgsta.cc (File already exists)'
else
echo 'x - extracting testing/tbicgsta.cc (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'testing/tbicgsta.cc' &&
#include <stdlib.h> // System includes
#include <iostream.h> //
X
#include "compcol_double.h" // Compressed column matrix header
#include "iohb_double.h" // Harwell-Boeing matrix I/O header
#include "mvblasd.h" // MV_Vector level 1 BLAS
#include "diagpre_double.h" // Diagonal preconditioner
X
#include "bicgstab.h" // IML++ BiCGSTAB template
X
int
main(int argc, char * argv[])
{
X if (argc < 2) {
X cerr << "Usage: " << argv[0] << " HBfile " << endl;
X exit(-1);
X }
X
X double tol = 1.e-6; // Convergence tolerance
X int result, maxit = 150; // Maximum iterations
X
X CompCol_Mat_double A; // Create a matrix
X readHB_mat(argv[1], &A); // Read matrix data
X VECTOR_double b, x(A.dim(1), 0.0); // Create rhs, solution vectors
X readHB_rhs(argv[1], &b); // Read rhs data
X
X DiagPreconditioner_double D(A); // Create diagonal preconditioner
X
X result = BiCGSTAB(A, x, b, D, maxit, tol); // Solve system
X
X cout << "BiCGSTAB flag = " << result << endl;
X cout << "iterations performed: " << maxit << endl;
X cout << "tolerance achieved : " << tol << endl;
X
X return result;
}
SHAR_EOF
chmod 0660 testing/tbicgsta.cc ||
echo 'restore of testing/tbicgsta.cc failed'
Wc_c="`wc -c < 'testing/tbicgsta.cc'`"
test 1314 -eq "$Wc_c" ||
echo 'testing/tbicgsta.cc: original size 1314, current size' "$Wc_c"
fi
# ============= testing/tcg.cc ==============
if test -f 'testing/tcg.cc' -a X"$1" != X"-c"; then
echo 'x - skipping testing/tcg.cc (File already exists)'
else
echo 'x - extracting testing/tcg.cc (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'testing/tcg.cc' &&
#include <stdlib.h> // System includes
#include <iostream.h> //
X
#include "compcol_double.h" // Compressed column matrix header
#include "iohb_double.h" // Harwell-Boeing matrix I/O header
#include "mvblasd.h" // MV_Vector level 1 BLAS
#include "diagpre_double.h" // Diagonal preconditioner
X
#include "cg.h" // IML++ CG template
X
int
main(int argc, char * argv[])
{
X if (argc < 2) {
X cerr << "Usage: " << argv[0] << " HBfile " << endl;
X exit(-1);
X }
X
X double tol = 1.e-6; // Convergence tolerance
X int result, maxit = 150; // Maximum iterations
X
X CompCol_Mat_double A; // Create a matrix
X readHB_mat(argv[1], &A); // Read matrix data
X VECTOR_double b, x(A.dim(1), 0.0); // Create rhs, solution vectors
X readHB_rhs(argv[1], &b); // Read rhs data
X
X DiagPreconditioner_double D(A); // Create diagonal preconditioner
X
X result = CG(A, x, b, D, maxit, tol); // Solve system
X
X cout << "CG flag = " << result << endl;
X cout << "iterations performed: " << maxit << endl;
X cout << "tolerance achieved : " << tol << endl;
X
X return result;
}
SHAR_EOF
chmod 0660 testing/tcg.cc ||
echo 'restore of testing/tcg.cc failed'
Wc_c="`wc -c < 'testing/tcg.cc'`"
test 1270 -eq "$Wc_c" ||
echo 'testing/tcg.cc: original size 1270, current size' "$Wc_c"
fi
# ============= testing/tcgs.cc ==============
if test -f 'testing/tcgs.cc' -a X"$1" != X"-c"; then
echo 'x - skipping testing/tcgs.cc (File already exists)'
else
echo 'x - extracting testing/tcgs.cc (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'testing/tcgs.cc' &&
#include <stdlib.h> // System includes
#include <iostream.h> //
X
#include "compcol_double.h" // Compressed column matrix header
#include "iohb_double.h" // Harwell-Boeing matrix I/O header
#include "mvblasd.h" // MV_Vector level 1 BLAS
#include "diagpre_double.h" // Diagonal preconditioner
X
#include "cgs.h" // IML++ CGS template
X
int
main(int argc, char * argv[])
{
X if (argc < 2) {
X cerr << "Usage: " << argv[0] << " HBfile " << endl;
X exit(-1);
X }
X
X double tol = 1.e-6; // Convergence tolerance
X int result, maxit = 150; // Maximum iterations
X
X CompCol_Mat_double A; // Create a matrix
X readHB_mat(argv[1], &A); // Read matrix data
X VECTOR_double b, x(A.dim(1), 0.0); // Create rhs, solution vectors
X readHB_rhs(argv[1], &b); // Read rhs data
X
X DiagPreconditioner_double D(A); // Create diagonal preconditioner
X
X result = CGS(A, x, b, D, maxit, tol); // Solve system
X
X cout << "CGS flag = " << result << endl;
X cout << "iterations performed: " << maxit << endl;
X cout << "tolerance achieved : " << tol << endl;
X
X return result;
}
SHAR_EOF
chmod 0660 testing/tcgs.cc ||
echo 'restore of testing/tcgs.cc failed'
Wc_c="`wc -c < 'testing/tcgs.cc'`"
test 1272 -eq "$Wc_c" ||
echo 'testing/tcgs.cc: original size 1272, current size' "$Wc_c"
fi
# ============= testing/tcheby.cc ==============
if test -f 'testing/tcheby.cc' -a X"$1" != X"-c"; then
echo 'x - skipping testing/tcheby.cc (File already exists)'
else
echo 'x - extracting testing/tcheby.cc (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'testing/tcheby.cc' &&
#include <stdlib.h> // System includes
#include <iostream.h> //
X
#include "compcol_double.h" // Compressed column matrix header
#include "iohb_double.h" // Harwell-Boeing matrix I/O header
#include "mvblasd.h" // MV_Vector level 1 BLAS
#include "diagpre_double.h" // Diagonal preconditioner
X
#include "cheby.h" // IML++ Cheby template
X
int
main(int argc, char * argv[])
{
X if (argc < 2) {
X cerr << "Usage: " << argv[0] << " HBfile " << endl;
X exit(-1);
X }
X
X double tol = 1.e-6; // Convergence tolerance
X int result, maxit = 300; // Maximum iterations
X double mineig = .01; // eigenvalue information
X double maxeig = 3; // (this info for la2d8 example)
X
X CompCol_Mat_double A; // Create a matrix
X readHB_mat(argv[1], &A); // Read matrix data
X VECTOR_double b, x(A.dim(1), 0.0); // Create rhs, solution vectors
X readHB_rhs(argv[1], &b); // Read rhs data
X
X DiagPreconditioner_double D(A); // Create diagonal preconditioner
X
X result = CHEBY(A, x, b, D, maxit, tol, mineig, maxeig); // Solve system
X
X cout << "cheby flag = " << result << endl;
X cout << "iterations performed: " << maxit << endl;
X cout << "tolerance achieved : " << tol << endl;
X
X return result;
}
SHAR_EOF
chmod 0660 testing/tcheby.cc ||
echo 'restore of testing/tcheby.cc failed'
Wc_c="`wc -c < 'testing/tcheby.cc'`"
test 1435 -eq "$Wc_c" ||
echo 'testing/tcheby.cc: original size 1435, current size' "$Wc_c"
fi
# ============= testing/tgmres.cc ==============
if test -f 'testing/tgmres.cc' -a X"$1" != X"-c"; then
echo 'x - skipping testing/tgmres.cc (File already exists)'
else
echo 'x - extracting testing/tgmres.cc (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'testing/tgmres.cc' &&
#include <stdlib.h> // System includes
#include <iostream.h> //
X
#include "compcol_double.h" // Compressed column matrix header
#include "iohb_double.h" // Harwell-Boeing matrix I/O header
#include "mvblasd.h" // MV_Vector level 1 BLAS
#include "diagpre_double.h" // Diagonal preconditioner
X
#include MATRIX_H // dense matrix header
#include "gmres.h" // IML++ GMRES template
X
int
main(int argc, char * argv[])
{
X if (argc < 2) {
X cerr << "Usage: " << argv[0] << " HBfile " << endl;
X exit(-1);
X }
X
X double tol = 1.e-6; // Convergence tolerance
X int result, maxit = 150, restart = 32; // Maximum, restart iterations
X
X CompCol_Mat_double A; // Create a matrix
X readHB_mat(argv[1], &A); // Read matrix data
X VECTOR_double b, x(A.dim(1), 0.0); // Create rhs, solution vectors
X readHB_rhs(argv[1], &b); // Read rhs data
X
X MATRIX_double H(restart+1, restart, 0.0); // storage for upper Hessenberg H
X
X DiagPreconditioner_double D(A); // Create diagonal preconditioner
X
X result = GMRES(A, x, b, D, H, restart, maxit, tol); // Solve system
X
X cout << "GMRES flag = " << result << endl;
X cout << "iterations performed: " << maxit << endl;
X cout << "tolerance achieved : " << tol << endl;
X
X return result;
}
SHAR_EOF
chmod 0660 testing/tgmres.cc ||
echo 'restore of testing/tgmres.cc failed'
Wc_c="`wc -c < 'testing/tgmres.cc'`"
test 1487 -eq "$Wc_c" ||
echo 'testing/tgmres.cc: original size 1487, current size' "$Wc_c"
fi
# ============= testing/ticcg.cc ==============
if test -f 'testing/ticcg.cc' -a X"$1" != X"-c"; then
echo 'x - skipping testing/ticcg.cc (File already exists)'
else
echo 'x - extracting testing/ticcg.cc (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'testing/ticcg.cc' &&
#include <stdlib.h> // System includes
#include <iostream.h> //
X
#include "compcol_double.h" // Compressed column matrix header
#include "iohb_double.h" // Harwell-Boeing matrix I/O header
#include "mvblasd.h" // MV_Vector level 1 BLAS
#include "icpre_double.h" // Diagonal preconditioner
X
#include "cg.h" // IML++ CG template
X
int
main(int argc, char * argv[])
{
X if (argc < 2) {
X cerr << "Usage: " << argv[0] << " HBfile " << endl;
X exit(-1);
X }
X
X double tol = 1.e-6; // Convergence tolerance
X int result, maxit = 150; // Maximum iterations
X
X CompCol_Mat_double A; // Create a matrix
X readHB_mat(argv[1], &A); // Read matrix data
X VECTOR_double b, x(A.dim(1), 0.0); // Create rhs, solution vectors
X readHB_rhs(argv[1], &b); // Read rhs data
X
X ICPreconditioner_double M(A); // Create IC preconditioner
X
X result = CG(A, x, b, M, maxit, tol); // Solve system
X
X cout << "CG flag = " << result << endl;
X cout << "iterations performed: " << maxit << endl;
X cout << "tolerance achieved : " << tol << endl;
X
X return result;
}
SHAR_EOF
chmod 0660 testing/ticcg.cc ||
echo 'restore of testing/ticcg.cc failed'
Wc_c="`wc -c < 'testing/ticcg.cc'`"
test 1264 -eq "$Wc_c" ||
echo 'testing/ticcg.cc: original size 1264, current size' "$Wc_c"
fi
# ============= testing/tilugmre.cc ==============
if test -f 'testing/tilugmre.cc' -a X"$1" != X"-c"; then
echo 'x - skipping testing/tilugmre.cc (File already exists)'
else
echo 'x - extracting testing/tilugmre.cc (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'testing/tilugmre.cc' &&
#include <stdlib.h> // System includes
#include <iostream.h> //
X
#include "compcol_double.h" // Compressed column matrix header
#include "iohb_double.h" // Harwell-Boeing matrix I/O header
#include "mvblasd.h" // MV_Vector level 1 BLAS
#include "ilupre_double.h" // Diagonal preconditioner
X
#include MATRIX_H // MV_Matrix dense matrix header
#include "gmres.h" // IML++ GMRES template
X
int
main(int argc, char * argv[])
{
X if (argc < 2) {
X cerr << "Usage: " << argv[0] << " HBfile " << endl;
X exit(-1);
X }
X
X double tol = 1.e-6; // Convergence tolerance
X int result, maxit = 150, restart = 32; // Maximum, restart iterations
X
X CompCol_Mat_double A; // Create a matrix
X readHB_mat(argv[1], &A); // Read matrix data
X VECTOR_double b, x(A.dim(1), 0.0); // Create rhs, solution vectors
X readHB_rhs(argv[1], &b); // Read rhs data
X
X MATRIX_double H(restart+1, restart, 0.0); // storage for upper Hessenberg H
X
X CompCol_ILUPreconditioner_double M(A); // Create ILU preconditioner
X
X result = GMRES(A, x, b, M, H, restart, maxit, tol); // Solve system
X
X cout << "GMRES flag = " << result << endl;
X cout << "iterations performed: " << maxit << endl;
X cout << "tolerance achieved : " << tol << endl;
X
X return result;
}
SHAR_EOF
chmod 0660 testing/tilugmre.cc ||
echo 'restore of testing/tilugmre.cc failed'
Wc_c="`wc -c < 'testing/tilugmre.cc'`"
test 1491 -eq "$Wc_c" ||
echo 'testing/tilugmre.cc: original size 1491, current size' "$Wc_c"
fi
# ============= testing/tir.cc ==============
if test -f 'testing/tir.cc' -a X"$1" != X"-c"; then
echo 'x - skipping testing/tir.cc (File already exists)'
else
echo 'x - extracting testing/tir.cc (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'testing/tir.cc' &&
#include <stdlib.h> // System includes
#include <iostream.h> //
X
#include "compcol_double.h" // Compressed column matrix header
#include "iohb_double.h" // Harwell-Boeing matrix I/O header
#include "mvblasd.h" // MV_Vector level 1 BLAS
#include "diagpre_double.h" // Diagonal preconditioner
X
#include "ir.h" // IML++ IR template
X
int
main(int argc, char * argv[])
{
X if (argc < 2) {
X cerr << "Usage: " << argv[0] << " HBfile " << endl;
X exit(-1);
X }
X
X double tol = 1.e-6; // Convergence tolerance
X int result, maxit = 300; // Maximum iterations
X
X CompCol_Mat_double A; // Create a matrix
X readHB_mat(argv[1], &A); // Read matrix data
X VECTOR_double b, x(A.dim(1), 0.0); // Create rhs, solution vectors
X readHB_rhs(argv[1], &b); // Read rhs data
X
X DiagPreconditioner_double D(A); // Create diagonal preconditioner
X
X result = IR(A, x, b, D, maxit, tol); // Solve system
X
X cout << "IR flag = " << result << endl;
X cout << "iterations performed: " << maxit << endl;
X cout << "tolerance achieved : " << tol << endl;
X
X return result;
}
SHAR_EOF
chmod 0660 testing/tir.cc ||
echo 'restore of testing/tir.cc failed'
Wc_c="`wc -c < 'testing/tir.cc'`"
test 1270 -eq "$Wc_c" ||
echo 'testing/tir.cc: original size 1270, current size' "$Wc_c"
fi
# ============= testing/tqmr.cc ==============
if test -f 'testing/tqmr.cc' -a X"$1" != X"-c"; then
echo 'x - skipping testing/tqmr.cc (File already exists)'
else
echo 'x - extracting testing/tqmr.cc (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'testing/tqmr.cc' &&
#include <stdlib.h> // System includes
#include <iostream.h> //
X
#include "compcol_double.h" // Compressed column matrix header
#include "iohb_double.h" // Harwell-Boeing matrix I/O header
#include "mvblasd.h" // MV_Vector level 1 BLAS
#include "diagpre_double.h" // Diagonal preconditioner
X
#include "qmr.h" // IML++ QMR template
X
int
main(int argc, char * argv[])
{
X if (argc < 2) {
X cerr << "Usage: " << argv[0] << " HBfile " << endl;
X exit(-1);
X }
X
X double tol = 1.e-6; // Convergence tolerance
X int result, maxit = 150; // Maximum iterations
X
X CompCol_Mat_double A; // Create a matrix
X readHB_mat(argv[1], &A); // Read matrix data
X VECTOR_double b, x(A.dim(1), 0.0); // Create rhs, solution vectors
X readHB_rhs(argv[1], &b); // Read rhs data
X
X DiagPreconditioner_double D(A); // Create diagonal preconditioner
X
X result = QMR(A, x, b, D, D, maxit, tol); // Solve system
X
X cout << "QMR flag = " << result << endl;
X cout << "iterations performed: " << maxit << endl;
X cout << "tolerance achieved : " << tol << endl;
X
X return result;
}
SHAR_EOF
chmod 0660 testing/tqmr.cc ||
echo 'restore of testing/tqmr.cc failed'
Wc_c="`wc -c < 'testing/tqmr.cc'`"
test 1317 -eq "$Wc_c" ||
echo 'testing/tqmr.cc: original size 1317, current size' "$Wc_c"
fi
exit 0