]> thyrsus.com Git - mad.git/commitdiff
Better flowchart promitives.
authorEric S. Raymond <esr@thyrsus,com>
Thu, 19 Feb 2004 01:58:17 +0000 (01:58 +0000)
committerEric S. Raymond <esr@thyrsus,com>
Thu, 19 Feb 2004 01:58:17 +0000 (01:58 +0000)
doc/flowchart.pic
doc/mad-manual.xml

index 4c2b1f742d755be70e17b6780cd11c35ee83f6d0..d4aac1960a14a954ab68da5ea0bcc08e68450843 100644 (file)
@@ -47,27 +47,24 @@ define iter {[
 define downbend {line right 0.1 $1; arrow down}
 
 define read {[
-  FRAME: box ht 0.5 wid 1.0 $1 invis
+  FRAME: box invis ht 0.5 wid 1.0 $1 
   line from FRAME.ne to 0.8<FRAME.ne,FRAME.nw>
   line from last line.end to 0.8<FRAME.sw,FRAME.nw>
   line from last line.end to FRAME.sw
   line from FRAME.se to FRAME.ne
   line from FRAME.se to FRAME.sw
-  "READ" at FRAME.n - (0, 0.1)
 ]}
 
 define printme {[
-  FRAME: box wid $1 ht $2 invis
+  FRAME: box invis $1
   line from FRAME.ne to FRAME.nw
-  $3 at FRAME.c
   L: line from FRAME.nw to FRAME.sw
   R: line from FRAME.ne to 0.85<FRAME.ne,FRAME.se>
   HILEFT: 0.9<FRAME.sw,FRAME.nw>
   HIRIGHT: 0.9<FRAME.se,FRAME.ne>
   MID: FRAME.s
-  arc from L.end to MID
-  arc from R.end to MID rad 0.5*$1
-  "PRINT" at FRAME.n - (0, 0.1)
+  arc from L.end to MID rad FRAME.width*0.75
+  arc from R.end to MID rad FRAME.width*0.75
 ]} 
 
 define throughbox{[
index 50efb05273f3a43521c1b412eb0855720f70d218..f68ff3ecafe6bc6366161d3b043f774c9c44483f 100644 (file)
@@ -10,6 +10,7 @@
 <!ENTITY simpsfunc SYSTEM "../madhouse/simpsfunc.mad">
 <!ENTITY simpsmain SYSTEM "../madhouse/simpsmain.mad">
 <!ENTITY findroot SYSTEM "../madhouse/findroot.mad">
+<!ENTITY transfunc SYSTEM "../madhouse/transfunc.mad">
 <!ENTITY scope1 SYSTEM "scope1.xml">
 <!ENTITY scope2 SYSTEM "scope2.xml">
 <!ENTITY scope3 SYSTEM "scope3.xml">
@@ -702,7 +703,7 @@ modification and counting.  The reason for this is that integer
 arithmetic can be done more simply and efficiently, usually with less
 round-off error, than arithmetic on non-integers.  [Numbers which may
 have fractional parts are usually written in the so-called "scientific
-notation", such as 3.1 x 10<superscript>-6</superscript> are called
+notation", such as 3.1 &times; 10<superscript>-6</superscript> are called
 floating point numbers.]  Numbers are assumed to be in the
 floating-point mode unless otherwise declared, as in the INTEGER
 statement in the example.  The WHENEVER statement above is to be
@@ -1202,8 +1203,8 @@ meaning (Z5)<superscript>D</superscript>, i.e., Z5 raised to the power
 D.</para></listitem>
 
 <listitem><para>Negation, written as "-", e.g., -ALOHA, meaning the
-"negative of ALOHA."  Thus-X.P.-.5
-means-(X<superscript>-.5</superscript>).
+"negative of ALOHA."  Thus -X.P.-.5
+means -(X<superscript>-.5</superscript>).
 <!-- in the original, 'graph continued with ", the negative of the" -->
 </para></listitem>
 </orderedlist>
@@ -2876,13 +2877,13 @@ name A is equivalent to A(0), e.e., the name A written without a
 subscript is assumed to have a subscript of zero.</para>
 
 <para>Two dimensional matrices are stored internally by rows, i.e., an
-m x n matrix will be stored in the order: a<subscript>11</subscript>,
+m &times; n matrix will be stored in the order: a<subscript>11</subscript>,
 a<subscript>12</subscript>, a<subscript>13</subscript>, ...,
 a<subscript>1n</subscript>, a<subscript>21</subscript>, ...,
 a<subscript>2n</subscript>, ... a<subscript>mn</subscript>.  In
 general, matrices are stroed in the order determined by varying the
 right-most subscript first, then the next right-most, etc. Thus, an m
-x n x p x q matrix would be stored in the order:
+&times; n &times; p &times; q matrix would be stored in the order:
 a<subscript>1111</subscript>, a<subscript>1112</subscript>, ...,
 a<subscript>111q</subscript>, a<subscript>1121</subscript>,
 a<subscript>1122</subscript>, ... a<subscript>112q</subscript>, ...,
@@ -3249,9 +3250,8 @@ READ      READ FORMAT INPUTS,A,B,N,R
        TRANSFER TO READ
        FUNCTION NAME S
 </programlisting>
-<!-- beginpage -->
-
 </sect2>
+<!-- beginpage -->
 <sect2><title>Example 4</title>
 
 <!-- FIXME -->
@@ -3285,6 +3285,70 @@ program deck.</para></note>
 *DATA
           1.          2.          .01
 </programlisting>
+</sect2>
+<!-- pagebreak -->
+<sect2><title>Example 5</title>
+
+<para><emphasis>Problem:</emphasis> Find the transpose A' of an n&times;n
+matrix A = (a<subscript>ij</subscript>).</para>
+
+<para><emphasis>Analysis:</emphasis> If we write A' =
+(b<subscript>ij</subscript>) then b<subscript>ij</subscript> =
+a<subscript>ji</subscript>.  We challe inter&shy;change
+symmetrically-placed pairs of elements, leaving untouched elements on
+the main diagonal. The program will be in the form of an external
+function.</para>
+
+<para><emphasis>Flow diagram:</emphasis></para>
+
+<note><para>There are two minor errors in this flow diagram,
+reproduced faithfully from the original.  Can you spot them?</para></note>
+
+<mediaobject>
+  <imageobject>
+    <imagedata fileref='fig11.png'/>
+  </imageobject>
+</mediaobject>
+
+<para><emphasis>Program:</emphasis></para>
+
+<programlisting>
+&transfunc;
+</programlisting>
+
+<para>Note: No dimension information is needed for A, since it is an
+argument in a function <emphasis>definition</emphasis> program.  The
+function would be <emphasis>called</emphasis> with a statement of the
+form EXECUTE TRANS.(A, N).</para>
+</sect2>
+<!-- pagebreak -->
+<sect2><title>Example 6</title>
+
+<para><emphasis>Problem:</emphasis> Multiply the matrix A =
+(a<subscript>ij</subscript>) by the matrix B =
+(b<subscript>ij</subscript>) to produce the matrix X =
+(c<subscript>ij</subscript>), i.e. C = A &middot; B.  Assume tha A has
+dimensions m &times; n with m &middot; n &le; 1500, B has dimensions n
+&times; p with n &middot; p &le; 1500, and C has dimensions m &times;
+p with m &middot; p &le; 1500.</para>
+
+<para><emphasis>Analysus:</emphasis>  An element c<subscript>ij</subscript>
+of C is computed by the formula</para>
+
+<mediaobject>
+  <imageobject>
+    <imagedata fileref='equation6.png'/>
+  </imageobject>
+</mediaobject>
+
+<para><emphasis>Flow diagram:</emphasis></para>
+
+<mediaobject>
+  <imageobject>
+    <imagedata fileref='fig12.png'/>
+  </imageobject>
+</mediaobject>
+
 <!-- pagebreak -->
 
 </sect2>