Path: utzoo!utgpu!watmath!maytag!watstat!dmurdoch From: dmurdoch@watstat.waterloo.edu (Duncan Murdoch) Newsgroups: comp.lang.pascal Subject: Re: Runtime dimensioning and Pascal Message-ID: <795@maytag.waterloo.edu> Date: 9 Nov 89 14:24:40 GMT References: <6354@merlin.usc.edu> Sender: daemon@maytag.waterloo.edu Reply-To: dmurdoch@watstat.waterloo.edu (Duncan Murdoch) Organization: U. of Waterloo, Ontario Lines: 23 In article <6354@merlin.usc.edu> ajayshah@aludra.usc.edu () writes: > >Pascal is the prettiest language in the universe, but declaring five >matrix inversion routines is a little tedious. Any ideas on how to >get around this? I haven't actually done this, but it looks as though it shouldn't be too onerous to declare all your arrays as big one dimensional ones, and do the indexing yourself. For example, to pass an n by m array to a routine, pass a vector of the data, and pass n and m. Then when you want to access element x[i,j], instead access x[e(i,j)], where "e" is defined to be a little function to do the indexing. It'll be a little tedious because you'll either need a separate "e" function for each value of m, or you'll have to pass m to the routine, but that's not so bad. Most linear algebra routines only need one or two column sizes anyways. If you're using TP and you take the time to code e as an inline assembler routine there won't even be much of a speed penalty. You could also do something like x(i,j), but I think that would incur more overhead, or at least make for more complicated inlines. Duncan Murdoch