#! /bin/sh
######################################
##### Model Transformation Tools #####
######################################
# Bourne shell script: sm_r2tex
# Reduce constrained-state matrices to LaTex constrained-state matrices.
# P.J.Gawthrop 9 Sep 1991, May 1994
# Copyright (c) P.J.Gawthrop, 1991, May 1994, 1996.
###############################################################
## Version control history
###############################################################
## $Id$
## $Log$
## Revision 1.4 1998/02/18 08:25:36 peterg
## Now uses latex_matrix for formatting
##
## Revision 1.3 1997/06/13 13:50:11 peterg
## Matrices in amstex format
##
# Revision 1.2 1997/04/18 12:54:00 peterg
# No longer does labels.
#
# Revision 1.1 1996/08/19 15:19:23 peter
# Initial revision
#
###############################################################
# Inform user
echo Creating $1_$2.tex
# Remove the old log file
rm -f sm_r2tex.log
# Use reduce to accomplish the transformation
reduce >sm_r2tex.log << EOF
%Read the definitions file
in "$1_def.r";
%Read the constrained-state matrices file
in "$1_$2.r";
%Read the symbolic parameters file
%%in "$1_sympar.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;
MATRIX MTT_Matrix(MTTNx,MTTNx);
OUT "$1_$2.tex";
%Write out the state matrices.
write "%state matrices $1";
write "%File: $1_$2.tex";
write"";
MTT_Matrix := MTTA$
MTT_Matrix_name := "MTTA"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$
MTT_Matrix := MTTB$
MTT_Matrix_name := "MTTB"$
MTT_Matrix_n := MTTNx$
MTT_Matrix_m := MTTNu$
LaTeX_Matrix()$
MTT_Matrix := MTTC$
MTT_Matrix_name := "MTTC"$
MTT_Matrix_n := MTTNy$
MTT_Matrix_m := MTTNx$
LaTeX_Matrix()$
MTT_Matrix := MTTD$
MTT_Matrix_name := "MTTD"$
MTT_Matrix_n := MTTNu$
MTT_Matrix_m := MTTNu$
LaTeX_Matrix()$
SHUT "$1_$2.tex";
quit;
EOF