Statistiques
| Branche: | Révision :

meplib / 00model / prepareForPipCH.sh @ master

Historique | Voir | Annoter | Télécharger (2,61 ko)

1
#! /bin/sh
2
#
3
# Prepare data for PIP
4
#
5
# Uses a list of Chebychev points built using the data from the first line 
6
# of the config file:
7
# -the lower bound;
8
# -the upper bound;
9
# -the number of points.
10
#
11
CONFIG_FILE=config.txt
12
DIGITS_FILE=digits.txt
13
PREPARE_POINTS_FILE=extractedPointsList.txt
14
INV_FILE=inv.txt
15
W_FILE=w.txt
16
MKLOOPS_FILE=mkloops.txt
17
BOUNDS_FILE=mkloops-bounds.txt
18
BIN_DIR=./bin
19
W_GENERATOR=$BIN_DIR/generate-w-vector-01
20
MKLOOPS_GENERATOR=$BIN_DIR/mkloops-with-w
21
ARGS_FOR_VANDERMONDE=`argsForVandermonde.sh`
22
ARGS_FOR_POINTS_LIST=`argsForPointsList.sh`
23
MAX_ERROR=`awk '{if(FNR==1) print $2}' < $CONFIG_FILE`
24
CREATE_VANDERMONDE=$BIN_DIR/createVandermonde.pl
25
INV_VANDERMONDE=$BIN_DIR/invVandermonde.pl
26
PRINT_GENERATOR_VECTOR=$BIN_DIR/printGeneratorVector.pl
27
PRINT_POINTS_LIST=$BIN_DIR/printTCPointsList.pl
28
ADD_BOUNDS_TO_MKLOOPS=$BIN_DIR/addBoundsToMkloops-01.pl
29
COMPUTE_BOUNDS_FOR_MKLOOPS=$BIN_DIR/computeBoundsForMkloops-01.pl
30
CREATE_DIGITS_FILE=createDigitsFile.sh
31
#
32
#
33
#
34
#echo $MAX_ERROR $ARGS_FOR_VANDERMONDE
35
$CREATE_DIGITS_FILE $CONFIG_FILE $DIGITS_FILE
36
if [ $? != 0 ]
37
 then
38
   echo
39
   echo
40
   echo The creation of the digits file failed.
41
   echo Aborting the program!
42
   echo
43
   exit 1
44
fi
45
$CREATE_VANDERMONDE $ARGS_FOR_VANDERMONDE | $INV_VANDERMONDE > $INV_FILE
46
if [ $? != 0 ]
47
 then
48
   echo
49
   echo
50
   echo The creation and the inversion of the Vandermonde matrix failed.
51
   echo Aborting the program!
52
   echo
53
   exit 1
54
fi
55
ARGS=`$PRINT_GENERATOR_VECTOR $ARGS_FOR_VANDERMONDE`
56
if [ $? != 0 ]
57
 then
58
   echo
59
   echo
60
   echo Could not create the generator for the offset vector.
61
   echo Aborting the program!
62
   echo
63
   exit 1
64
fi
65
ARGS="$INV_FILE $DIGITS_FILE $MAX_ERROR $ARGS"
66
$W_GENERATOR $ARGS > $W_FILE
67
if [ $? != 0 ]
68
 then
69
   echo
70
   echo
71
   echo Could not compute the offset vector.
72
   echo Aborting the program!
73
   echo
74
   exit 1
75
fi
76
$PRINT_POINTS_LIST $ARGS_FOR_POINTS_LIST > $PREPARE_POINTS_FILE
77
if [ $? != 0 ]
78
 then
79
   echo
80
   echo
81
   echo Could not generate the data for PIP.
82
   echo Aborting the program!
83
   echo
84
   exit 1
85
fi
86
ARGS=`cat $PREPARE_POINTS_FILE`
87
ARGS="$W_FILE $DIGITS_FILE $MAX_ERROR $ARGS"
88
$MKLOOPS_GENERATOR $ARGS > $MKLOOPS_FILE
89
if [ $? != 0 ]
90
 then
91
   echo
92
   echo
93
   echo Could not generate the data for PIP.
94
   echo Aborting the program!
95
   echo
96
   exit 1
97
fi
98
$ADD_BOUNDS_TO_MKLOOPS $MKLOOPS_FILE
99
if [ $? != 0 ]
100
 then
101
   echo
102
   echo
103
   echo Could not add the bounds to data for PIP.
104
   echo Aborting the program!
105
   echo
106
   exit 1
107
fi
108
$COMPUTE_BOUNDS_FOR_MKLOOPS $MKLOOPS_FILE
109
if [ $? != 0 ]
110
  then
111
    echo
112
    echo
113
    echo Could not compute valid loops.
114
    echo Aborting the program!
115
    echo
116
    cat $BOUNDS_FILE
117
    exit 1
118
fi