Commit 1567d06 1 parent 0131cad commit 1567d06 Copy full SHA for 1567d06
File tree 1 file changed +25
-0
lines changed
1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,31 @@ function fit(model::Polynomial, data)
43
43
FittedPolynomial (model, state)
44
44
end
45
45
46
+ function fit! (fitted:: FittedPolynomial , newdata)
47
+ model = fitted. model
48
+ state = fitted. state
49
+
50
+ # check compatibility of data size
51
+ checkdatasize (fitted, newdata)
52
+
53
+ # update state data
54
+ state. data = newdata
55
+
56
+ # set coordinate matrix
57
+ setproj! (model, state. proj, newdata)
58
+
59
+ nothing
60
+ end
61
+
62
+ function checkdatasize (fitted:: FittedPolynomial , data)
63
+ proj = fitted. state. proj
64
+ nproj = size (proj, 2 )
65
+ nobs = nrow (data)
66
+ if nobs > nproj
67
+ throw (ArgumentError (" in-place fit called with $nobs data row(s) and $nproj maximum size" ))
68
+ end
69
+ end
70
+
46
71
function prealloc (model:: Polynomial , data)
47
72
# retrieve parameters
48
73
deg = model. degree
You can’t perform that action at this time.
0 commit comments