REGRESSFILE UNIT
Josh Mitteldorf
6800 Scotforth Rd
Philadelphia, PA 19119
70441,1305 }
Performs a linear regression (best line fit) on an
ASCII-formatted file. File should be organized in columns, with
only whitespace between the columns. You may specify at run time
which column contains the dependent variable and which contains
the independent variables. Columns which are not specified as
either are read in and skipped. They may contain non-numeric
data without causing an error. However, non-numeric data in any
variable cell will cause an entire row of numbers to be skipped
over, with a message to the user.
If a row is found with more or less than the specified number of
columns, the program attempts to skip that row and move on.}
MATRIX UNIT
Josh Mitteldorf
6800 Scotforth Rd
Philadelphia, PA 19119
70441,1305 }
You can change the definition of float above, to real or single
or extended, and all computations will be to the specified
precision. You must change to float = real in order to run this
unit without a coprocessor.
In all these procedures and functions, the last argument d is the
dimension. All matrices are square, of dimension d x d.
Everything is accessed as a pointer in order to facilitate the
flexibility of being able to specify d when the procedure is
called. Thus matrix and vector are just two different names for
the same thing, namely a pointer to array of type float.
The calling unit may be structured as follows:
const n=4;
type float=real;
vector=array[1..n] of float;
matrix=array[1..n] of vector;
var x,y :vector;
z :matrix;
...
Prod(addr(z),addr(x),addr(y));
...
Then the element z[i,j] in the calling unit becomes
|