home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.pascal
- Path: sparky!uunet!sun-barr!cs.utexas.edu!torn!news.ccs.queensu.ca!dmurdoch
- From: dmurdoch@QueensU.CA (Duncan Murdoch)
- Subject: Re: Matrix routines in pascal
- Message-ID: <Bs6M0B.BK6@knot.ccs.queensu.ca>
- Sender: news@knot.ccs.queensu.ca (Netnews control)
- Organization: Queen's University, Kingston, Canada
- References: <1992Jul29.162918.13707@csi.jpl.nasa.gov> <Bs5wKs.3pE@knot.ccs.queensu.ca> <1992Jul30.010006.19073@reed.edu>
- Distribution: usa
- Date: Thu, 30 Jul 1992 03:07:23 GMT
- Lines: 38
-
- In article <1992Jul30.010006.19073@reed.edu> orpheus@reed.edu (P. Hawthorne) writes:
-
- > QMatrix = object(QContent)
- > EntrySize: Longint;
- > EntriesAcross: Longint;
- > EntriesDown: Longint;
- > Entries: EntryArray;
- >
- > function QMatrix.Construct: Boolean;
- > override;
- >
- > procedure QMatrix.SetEntry (x, y: Longint; aPtr: univ Ptr);
- > procedure QMatrix.GetEntry (x, y: Longint; aPtr: univ Ptr);
- > end;
-
- That's more general than what I did (I decided to specialize from the
- beginning on "float" entries, in the hope of getting some efficiency
- benefits), but suffers from the same problems as mine:
-
- Simple statements like
-
- prod[j,k] := prod[j,k] + factor1[j,i]*factor2[i,k];
-
- become ugly messes like:
-
- prod^.setval(j,k, prod^.val(j,k)
- + factor1^.val(j,i)*factor2^.val(i,k));
-
- and handling expressions like
-
- prod := MatrixProduct(factor1, MatrixSum(term1, term2));
-
- becomes a real pain. This is one area that's made me think seriously of
- switching to C++; luckily I tried reading Stroustrup's book, which
- brought me back to my senses :-).
-
- Duncan Murdoch
- dmurdoch@mast.queensu.ca
-