From: Eric S. Raymond Date: Thu, 19 Feb 2004 01:58:17 +0000 (+0000) Subject: Better flowchart promitives. X-Git-Tag: 1.0~71 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=3a65eb90e1c223e58d267b37c2bcb71462d4a57e;p=mad.git Better flowchart promitives. --- diff --git a/doc/flowchart.pic b/doc/flowchart.pic index 4c2b1f7..d4aac19 100644 --- a/doc/flowchart.pic +++ b/doc/flowchart.pic @@ -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 line from last line.end to 0.8 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 HILEFT: 0.9 HIRIGHT: 0.9 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{[ diff --git a/doc/mad-manual.xml b/doc/mad-manual.xml index 50efb05..f68ff3e 100644 --- a/doc/mad-manual.xml +++ b/doc/mad-manual.xml @@ -10,6 +10,7 @@ + @@ -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-6 are called +notation", such as 3.1 × 10-6 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)D, i.e., Z5 raised to the power D. Negation, written as "-", e.g., -ALOHA, meaning the -"negative of ALOHA." Thus-X.P.-.5 -means-(X-.5). +"negative of ALOHA." Thus -X.P.-.5 +means -(X-.5). @@ -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. Two dimensional matrices are stored internally by rows, i.e., an -m x n matrix will be stored in the order: a11, +m × n matrix will be stored in the order: a11, a12, a13, ..., a1n, a21, ..., a2n, ... amn. 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: +× n × p × q matrix would be stored in the order: a1111, a1112, ..., a111q, a1121, a1122, ... a112q, ..., @@ -3249,9 +3250,8 @@ READ READ FORMAT INPUTS,A,B,N,R TRANSFER TO READ FUNCTION NAME S - - + Example 4 @@ -3285,6 +3285,70 @@ program deck. *DATA 1. 2. .01 + + +Example 5 + +Problem: Find the transpose A' of an n×n +matrix A = (aij). + +Analysis: If we write A' = +(bij) then bij = +aji. We challe inter­change +symmetrically-placed pairs of elements, leaving untouched elements on +the main diagonal. The program will be in the form of an external +function. + +Flow diagram: + +There are two minor errors in this flow diagram, +reproduced faithfully from the original. Can you spot them? + + + + + + + +Program: + + +&transfunc; + + +Note: No dimension information is needed for A, since it is an +argument in a function definition program. The +function would be called with a statement of the +form EXECUTE TRANS.(A, N). + + +Example 6 + +Problem: Multiply the matrix A = +(aij) by the matrix B = +(bij) to produce the matrix X = +(cij), i.e. C = A · B. Assume tha A has +dimensions m × n with m · n ≤ 1500, B has dimensions n +× p with n · p ≤ 1500, and C has dimensions m × +p with m · p ≤ 1500. + +Analysus: An element cij +of C is computed by the formula + + + + + + + +Flow diagram: + + + + + + +