File mttroot/mtt/bin/trans/dm_r2tex artifact acd65c348e part of check-in 66bb5feadf


#! /bin/sh

     ###################################### 
     ##### Model Transformation Tools #####
     ######################################

# Bourne shell script: dm_r2tex
# Reduce descriptor matrices to LaTex descriptor matrices.
# P.J.Gawthrop 9 June 1990, 8th July 1990, 14 Feb 1991, 10th May 1991, 4th June 1991
# Copyright (c) P.J.Gawthrop, 1990, 1991.

#Inform user
echo Creating $1_dm.tex

# Remove the old log file
rm -f dm_r2tex.log

# Use reduce to accomplish the transformation
reduce >dm_r2tex.log << EOF

%Read the definitions file
in "$1_def.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";

%Number of descriptor variables
MTTN := MTTNx + 2*MTTNz + MTTNyz;

%Read the descriptor matrices file
in "$1_dm.r";

OFF Echo;
OFF Nat;

OUT "$1_dm.tex";

%Write out the descriptor matrices.
write "%Descriptor matrices $1";
write "%File: $1_dm.tex";
write"";

write "%Descriptor matrices";

%IF (MTTNz+MTTNyz) NEQ 0 THEN
%BEGIN
%  write "%  - E matrix";
%  write "\begin{equation}";
%  write "MTTE = MTTI_0(", MTTNx+MTTNz, ",", MTTNz+MTTNyz, ")";
%  write "\end{equation}";
%END;


IF MTTN NEQ 0 THEN
IF (MTTNz+MTTNyz) > 0 THEN
BEGIN
write "%  - E matrix";
write "\begin{equation}";
write "MTTE = \begin{pmatrix}";
	FOR Row := 1:MTTN DO
	BEGIN
		FOR Col := 1:MTTN DO
		BEGIN
			Write "{", MTTE(Row,Col), "}";
			IF Col<MTTN THEN Write "&"
		END;

	IF Row<MTTN THEN Write "\cr";
	END;
	Write "\end{pmatrix}";
write "\end{equation}";
END;



IF MTTN NEQ 0 THEN
BEGIN
write "%  - A matrix";
write "\begin{equation}";
write "MTTA = \begin{pmatrix}";
	FOR Row := 1:MTTN DO
	BEGIN
		FOR Col := 1:MTTN DO
		BEGIN
			Write "{", MTTA(Row,Col), "}";
			IF Col<MTTN THEN Write "&"
		END;

	IF Row<MTTN THEN Write "\cr";
	END;
	Write "\end{pmatrix}";
write "\end{equation}";
END;

IF MTTN NEQ 0 THEN IF MTTNu NEQ 0 THEN
BEGIN
write "%  - B matrix";
write "\begin{equation}";
write "MTTB = \begin{pmatrix}";
	FOR Row := 1:MTTN DO
	BEGIN
		FOR Col := 1:MTTNu DO
		BEGIN
			Write "{", MTTB(Row,Col), "}";
			IF Col<MTTNu THEN Write "&"
		END;

	IF Row<MTTN THEN Write "\cr";
	END;
	Write "\end{pmatrix}";
write "\end{equation}";
END;

IF MTTN NEQ 0 THEN IF MTTNy NEQ 0 THEN
BEGIN
write "%  - C matrix";
write "\begin{equation}";
write "MTTC = \begin{pmatrix}";
	FOR Row := 1:MTTNy DO
	BEGIN
		FOR Col := 1:MTTN DO
		BEGIN
			Write "{", MTTC(Row,Col), "}";
			IF Col<MTTN THEN Write "&"
		END;

	IF Row<MTTNy THEN Write "\cr";
	END;
	Write "\end{pmatrix}";
write "\end{equation}";
END;

IF MTTNy NEQ 0 THEN IF MTTNu NEQ 0 THEN
BEGIN
write "%  - D matrix";
write "\begin{equation}";
write "MTTD = \begin{pmatrix}";
	FOR Row := 1:MTTNy DO
	BEGIN
		FOR Col := 1:MTTNu DO
		BEGIN
			Write "{", MTTD(Row,Col), "}";
			IF Col<MTTNu THEN Write "&"
		END;

	IF Row<MTTNy THEN Write "\cr";
	END;
	Write "\end{pmatrix}";
write "\end{equation}";
END;




SHUT "$1_dm.tex";
quit;
EOF


MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]