LeastSq.mesa
Last Edited by: McCreight, April 23, 1985 6:30:26 pm 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, weight: REAL ← 1.0 ];
LeastSqFit: PROC [ ps: PointSet ] RETURNS [ eq: Row ];
END.