~ubuntu-branches/ubuntu/karmic/python-scipy/karmic

« back to all changes in this revision

Viewing changes to Lib/sandbox/spline/fitpack/fpchec.f

  • Committer: Bazaar Package Importer
  • Author(s): Ondrej Certik
  • Date: 2008-06-16 22:58:01 UTC
  • mfrom: (2.1.24 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080616225801-irdhrpcwiocfbcmt
Tags: 0.6.0-12
* The description updated to match the current SciPy (Closes: #489149).
* Standards-Version bumped to 3.8.0 (no action needed)
* Build-Depends: netcdf-dev changed to libnetcdf-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
      subroutine fpchec(x,m,t,n,k,ier)
2
 
c  subroutine fpchec verifies the number and the position of the knots
3
 
c  t(j),j=1,2,...,n of a spline of degree k, in relation to the number
4
 
c  and the position of the data points x(i),i=1,2,...,m. if all of the
5
 
c  following conditions are fulfilled, the error parameter ier is set
6
 
c  to zero. if one of the conditions is violated ier is set to ten.
7
 
c      1) k+1 <= n-k-1 <= m
8
 
c      2) t(1) <= t(2) <= ... <= t(k+1)
9
 
c         t(n-k) <= t(n-k+1) <= ... <= t(n)
10
 
c      3) t(k+1) < t(k+2) < ... < t(n-k)
11
 
c      4) t(k+1) <= x(i) <= t(n-k)
12
 
c      5) the conditions specified by schoenberg and whitney must hold
13
 
c         for at least one subset of data points, i.e. there must be a
14
 
c         subset of data points y(j) such that
15
 
c             t(j) < y(j) < t(j+k+1), j=1,2,...,n-k-1
16
 
c  ..
17
 
c  ..scalar arguments..
18
 
      integer m,n,k,ier
19
 
c  ..array arguments..
20
 
      real*8 x(m),t(n)
21
 
c  ..local scalars..
22
 
      integer i,j,k1,k2,l,nk1,nk2,nk3
23
 
      real*8 tj,tl
24
 
c  ..
25
 
      k1 = k+1
26
 
      k2 = k1+1
27
 
      nk1 = n-k1
28
 
      nk2 = nk1+1
29
 
      ier = 10
30
 
c  check condition no 1
31
 
      if(nk1.lt.k1 .or. nk1.gt.m) go to 80
32
 
c  check condition no 2
33
 
      j = n
34
 
      do 20 i=1,k
35
 
        if(t(i).gt.t(i+1)) go to 80
36
 
        if(t(j).lt.t(j-1)) go to 80
37
 
        j = j-1
38
 
  20  continue
39
 
c  check condition no 3
40
 
      do 30 i=k2,nk2
41
 
        if(t(i).le.t(i-1)) go to 80
42
 
  30  continue
43
 
c  check condition no 4
44
 
      if(x(1).lt.t(k1) .or. x(m).gt.t(nk2)) go to 80
45
 
c  check condition no 5
46
 
      if(x(1).ge.t(k2) .or. x(m).le.t(nk1)) go to 80
47
 
      i = 1
48
 
      l = k2
49
 
      nk3 = nk1-1
50
 
      if(nk3.lt.2) go to 70
51
 
      do 60 j=2,nk3
52
 
        tj = t(j)
53
 
        l = l+1
54
 
        tl = t(l)
55
 
  40    i = i+1
56
 
        if(i.ge.m) go to 80
57
 
        if(x(i).le.tj) go to 40
58
 
        if(x(i).ge.tl) go to 80
59
 
  60  continue
60
 
  70  ier = 0
61
 
  80  return
62
 
      end