https://github.com/cran/fields
Raw File
Tip revision: fd0fd2f186c7b6b0721880f6a0061ec076e1be79 authored by Douglas Nychka on 28 February 2015, 06:50:20 UTC
version 8.2-1
Tip revision: fd0fd2f
evlpoly.f
c fields, Tools for spatial data
c Copyright 2004-2013, Institute for Mathematics Applied Geosciences
c University Corporation for Atmospheric Research
c Licensed under the GPL -- www.gpl.org/licenses/gpl.html
 


      subroutine evlpoly(x,n,coef,j,result)

c evaluates a polynomial: coef(1) + sum_i= 2,j coef(i)x**i

      integer j,n, i
      double precision x(n), result(n), coef(j)
      double precision temp, tempx, temp2
      
      do 10 i = 1,n

         temp= coef(1)
         tempx= x(i)
         temp2= tempx 

c      temp is set to constant now loop over powers

         do 20 kk= 2, j
           temp= temp + coef(kk)* temp2
           temp2= temp2*tempx
   20    continue

      result(i)= temp

   10 continue
 
      return
      end
back to top