[comp.text.tex] Need help with circling elements in matrices!

dave@garfield.cs.mun.ca (Dave Fifield) (05/24/91)

A friend writes papers involving matrix computations and 
often needs to describe transformations from one matrix to another 
whereby a number of elements of a given row (or column) are combined
into one element in the resulting matrix.

For example:

2 5 7 9        2 9 7 9  
  3 4 5   ===>     4 5 
  4 7 8            7 8
    6 7            6 7 

Here the 5, 3 and 4 in column 2 have combined to produce the 9 column
2 of the resulting matrix.

This transformation is described notationaly in the first matrix
by circling the the 3 and 4 and pointing an arc from this circle (or 
oval or whatever) towards the 5 in the first row:  (please forgive the
crude grahics)

2   5   7   9
   ^
   |_
   |3|  4   5
   | |
   | |
   |4|  7   8
    -

		6   7

Note that this transformation can take place horizontally as well
and may encircle 1 or more elements (the above encircles 2 elements for 
example).

What I need is to be able to accomplish this in TeX. So far we have been
using the LaTeX array environment to do the matrices and then drawing the
circles (or ovals) and arrows in by hand, but this is no fun at all.

Any TeX hackers out there want to give this one a go?

Note that the encircling need not be oval; a good first cut would be
to have something that looks much like the above example with a rectangular
box surrounding the elements.

Any help is appreciated,
dave

--
Dave Fifield               Dept. of Computer Science
dave@garfield.cs.mun.ca    Memorial University of Newfoundland.
uunet!garfield!dave        St. John's, NFLD, Canada A1C 5S7