using (faster) Horner evaluation
https://rosettacode.org/wiki/Horner%27s_rule_for_polynomial_evaluation
This commit is contained in:
parent
72c29f744c
commit
240426402c
|
@ -105,9 +105,9 @@ pure function eval(self,x) result(y)
|
||||||
integer :: i
|
integer :: i
|
||||||
|
|
||||||
|
|
||||||
y = self%coef(0)
|
y = 0.0_pReal
|
||||||
do i = 1, ubound(self%coef,1)
|
do i = ubound(self%coef,1), 0 , -1
|
||||||
y = y + self%coef(i) * (x-self%x_ref)**i
|
y = y*(x-self%x_ref) + self%coef(i)
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
end function eval
|
end function eval
|
||||||
|
|
Loading…
Reference in New Issue