Eval1DPoly Function

public pure function Eval1DPoly(nCoefs, Coefs, x)

evalute monomial polynomial c_1+c_2x+c_3x^2 ...

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: nCoefs

number of coefficients

real(kind=wp), intent(in) :: Coefs(nCoefs)

coefficients

real(kind=wp), intent(in) :: x

evaluation position

Return Value real(kind=wp)


Source Code

PURE FUNCTION Eval1DPoly(nCoefs,Coefs,x)
! MODULES
IMPLICIT NONE
!-----------------------------------------------------------------------------------------------------------------------------------
! INPUT VARIABLES
INTEGER,  INTENT(IN)  :: nCoefs                   !! number of coefficients
REAL(wp), INTENT(IN)  :: Coefs(nCoefs)            !! coefficients
REAL(wp), INTENT(IN)  :: x                        !! evaluation position
!-----------------------------------------------------------------------------------------------------------------------------------
! OUTPUT VARIABLES
REAL(wp)              :: Eval1DPoly
!-----------------------------------------------------------------------------------------------------------------------------------
! LOCAL VARIABLES
INTEGER               :: i
!===================================================================================================================================
Eval1DPoly=0.
DO i=nCoefs,1,-1
  Eval1DPoly=Eval1DPoly*x+Coefs(i)
END DO

END FUNCTION Eval1DPoly