#! /bin/sh
######################################
##### Model Transformation Tools #####
######################################
# Bourne shell script: ctf_r2tex
# Reduce constrained-state matrices to LaTex constrained-state matrices.
# P.J.Gawthrop January 8th 1997
# Copyright (c) P.J.Gawthrop, 1997
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
###############################################################
# Inform user
echo Creating $1_ctf.tex
# Remove the old log file
rm -f ctf_r2tex.log
# Use reduce to accomplish the transformation
reduce >ctf_r2tex.log<< EOF
%Read the definitions file
in "$1_def.r";
%Read the smconical-form matrices file
in "$1_ctf.r";
%Read the substitution file
in "$1_subs.r";
%Read the simplification file
in "$1_simp.r";
%Read the formatting function
in "$MTTPATH/trans/latex_matrix.r";
OFF Echo;
OFF Nat;
OFF EXP;
%ON Rounded;
%Precision 5;
OUT "$1_ctf.tex";
%Write out the canonical matrices
write "%Controler TF $1";
write "%File: $1_ctf.tex";
write"";
MTT_Matrix := MTTcTF$
MTT_Matrix_name := "MTTcTF"$
MTT_Matrix_n := MTTNu$
MTT_Matrix_m := MTTNy$
Latex_Matrix()$
SHUT "$1_ctf.tex";
quit;
EOF