File indexing completed on 2023-05-28 05:10:57 UTC
view on githubraw file Latest commit b4daa243 on 2023-05-28 03:53:22 UTC
b4daa24319 Shre*0001
0002
0003 if [ ! $
0004 then
0005 echo "contextAD.sh: missing file operand"
0006 exit 1
0007 fi
0008
0009 TRACE=$1
0010
0011 if [ ! -f $TRACE ]
0012 then
0013 echo "contextAD.sh: "$TRACE": No such file "
0014 exit 1
0015 fi
0016
0017 INITVAR=`grep init $TRACE | sort -u | grep of | awk '{print $3}' | awk 'BEGIN{FS=","} {print $1}' `
0018 CONCVAR=`grep conclude $TRACE | sort -u | awk '{print $3}' | awk 'BEGIN{FS=":"} {print $1}' `
0019
0020 PERTURBED_RESULT=`grep "Condensed perturbed result" $TRACE | tail -1 | awk '{print $6}' `
0021 RESULT=`grep "Condensed result" $TRACE | tail -1 | awk '{print $5}' `
0022 TANGENT=`grep "Condensed tangent" $TRACE | tail -1 | awk '{print $4}' `
0023 ADJOINT=`grep "Condensed adjoint" $TRACE | tail -1 | awk '{print $4}' `
0024
0025
0026 echo "RESULT " $RESULT
0027 echo "PERTURBED_RESULT" $PERTURBED_RESULT
0028 echo "TANGENT " $TANGENT
0029 echo "ADJOINT " $ADJOINT
0030
0031 EPSILON=`grep run $TRACE | tail -1 | grep epsilon | awk 'BEGIN{FS="="} {print $3}'`
0032
0033 FEP=${PERTURBED_RESULT/[eE][+]/*10^}
0034 FEP=${FEP/[eE][-]/*10^-}
0035 F=${RESULT/[eE][+]/*10^}
0036 F=${F/[eE][-]/*10^-}
0037 TGT=${TANGENT/[eE][+]/*10^}
0038 TGT=${TGT/[eE][-]/*10^-}
0039 ADJ=${ADJOINT/[eE][+]/*10^}
0040 ADJ=${ADJ/[eE][-]/*10^-}
0041
0042 EPS_INV=${EPSILON/[eE][-][0]/*10^}
0043
0044 echo "Derivatives of " $CONCVAR " with respect to " $INITVAR
0045 echo -n "Divided differences "
0046 echo "(("$FEP - $F")" "*" $EPS_INV ")" | bc -l
0047
0048 echo -n "Condensed tangent "
0049 echo $TGT | bc -l
0050
0051 echo -n "Condensed adjoint "
0052 echo $ADJ | bc -l