Horner's method to compute B(x-c)
in terms of B(x)
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in), | dimension(0:6) | :: | B |
Polynomial |
|
real(kind=wp), | intent(in) | :: | c | |||
real(kind=wp), | intent(out), | dimension(0:6) | :: | BB |
Polynomial |
pure subroutine horner(B, c, BB) real(wp),dimension(0:6),intent(in) :: B !! Polynomial `B = B(6) x^6 + B(5) x^5 + ... + B(0)` real(wp),intent(in) :: c real(wp),dimension(0:6),intent(out) :: BB !! Polynomial `BB` such that `B(x-c) = BB(x)` integer :: i,j !! counters BB = B do i = 0,6 do j = 5,i,-1 BB(j) = BB(j) - BB(j+1)*c end do end do end subroutine horner