没太看懂,先留着
代码:
create_matrix(|hTuple1|,1,hTuple1,y)
create_matrix(|yTuple1|,2,1,x)
set_value_matrix(x, [0:|yTuple1|-1], gen_tuple_const(|yTuple1|, 0),yTuple1)
* x beta = y
* xT x beta = xT y
* beta = inv( xT x) xT y
mult_matrix(x,x,'ATB',xtx)
mult_matrix(x,y,'ATB',xty)
invert_matrix(xtx,'general', 0, invxtx)
mult_matrix(invxtx,xty,'AB', beta)
get_full_matrix(beta, lineParam)
c1:=60
c2:=4000.
r1:=c1*lineParam[0] + lineParam[1]
r2:=c2*lineParam[0] + lineParam[1]
gen_contour_polygon_xld(Contour, [r1,r2], [c1,c2])