      program Main
          use NewtonRaphsonFunctionClass_mod
          implicit none
          class(NewtonRaphsonFunctionClass) , pointer :: NRF
          double precision :: Y
          double precision, pointer :: gradY(:)
          double precision, pointer :: hessY(:,:)
          double precision, pointer :: X(:)
          
          !Create independent variable vector x of dimension 1 and init its component at 2.0d0
          allocate(x(1))
          x =2.0d0
          
          !Creates a Newton Raphson Function using the scalar function parabola
          NRF => New_NewtonRaphsonFunction(Fx, 1)
          
          Y     =  NRF.F(X)
          gradY => NRF.G(X)
          hessY => NRF.H(X)


      contains
      
       function Fx(x)
          implicit none
          
          double precision, intent(in) :: x(:)
          double precision Fx

          double precision :: a, b, c, x_
          
          !Coefficient of a parabola
          a = 1.0d0
          b = 2.0d0
          c = 3.0d0
          
          x_=x(1)
          
          Fx = a*x_**2 + b*x_ + c
          
        end function      
        
      end program
      
