Statistiques
| Branche: | Révision :

meplib / 00model / prepareForPipCF.sh @ master

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

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