LeastSq.mesa
Last Edited by: McCreight, April 12, 1985 11:29:34 am PST
LeastSq: CEDAR DEFINITIONS =
BEGIN
PointSet: TYPE = REF PointSetRec ← NIL;
PointSetRec: TYPE = RECORD [
count: INT ← 0,
rows: SEQUENCE rowDim: NAT OF Row
];
Row: TYPE = REF RowRec ← NIL;
RowRec: TYPE = RECORD [
entries: SEQUENCE colDim: NAT OF REAL
];
An input point is the row [1.0, firstIndependentVar, secondIndependentVar,..., dependentVar].
The parameter dim is the dimensionality of the input point.
The output eq is of the form [coef of 1.0, coef of firstIndependentVar, coef ofsecondIndependentVar,..., 1.0]
NewPointSet: PROC [ dim: NAT ] RETURNS [ ps: PointSet ];
AddPoint: PROC [ ps: PointSet, pt: Row ];
LeastSqFit: PROC [ ps: PointSet ] RETURNS [ eq: Row ];
END.