File: fpadpo.f

package info (click to toggle)
python-scipy 0.18.1-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 75,464 kB
  • ctags: 79,406
  • sloc: python: 143,495; cpp: 89,357; fortran: 81,650; ansic: 79,778; makefile: 364; sh: 265
file content (70 lines) | stat: -rw-r--r-- 1,760 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
      subroutine fpadpo(idim,t,n,c,nc,k,cp,np,cc,t1,t2)
c  given a idim-dimensional spline curve of degree k, in its b-spline
c  representation ( knots t(j),j=1,...,n , b-spline coefficients c(j),
c  j=1,...,nc) and given also a polynomial curve in its b-spline
c  representation ( coefficients cp(j), j=1,...,np), subroutine fpadpo
c  calculates the b-spline representation (coefficients c(j),j=1,...,nc)
c  of the sum of the two curves.
c
c  other subroutine required : fpinst
c
c  ..
c  ..scalar arguments..
      integer idim,k,n,nc,np
c  ..array arguments..
      real*8 t(n),c(nc),cp(np),cc(nc),t1(n),t2(n)
c  ..local scalars..
      integer i,ii,j,jj,k1,l,l1,n1,n2,nk1,nk2
c  ..
      k1 = k+1
      nk1 = n-k1
c  initialization
      j = 1
      l = 1
      do 20 jj=1,idim
        l1 = j
        do 10 ii=1,k1
          cc(l1) = cp(l)
          l1 = l1+1
          l = l+1
  10    continue
        j = j+n
        l = l+k1
  20  continue
      if(nk1.eq.k1) go to 70
      n1 = k1*2
      j = n
      l = n1
      do 30 i=1,k1
        t1(i) = t(i)
        t1(l) = t(j)
        l = l-1
        j = j-1
  30  continue
c  find the b-spline representation of the given polynomial curve
c  according to the given set of knots.
      nk2 = nk1-1
      do 60 l=k1,nk2
        l1 = l+1
        j = 1
        do 40 i=1,idim
          call fpinst(0,t1,n1,cc(j),k,t(l1),l,t2,n2,cc(j),n)
          j = j+n
  40    continue
        do 50 i=1,n2
          t1(i) = t2(i)
  50    continue
        n1 = n2
  60  continue
c  find the b-spline representation of the resulting curve.
  70  j = 1
      do 90 jj=1,idim
        l = j
        do 80 i=1,nk1
          c(l) = cc(l)+c(l)
          l = l+1
  80    continue
        j = j+n
  90  continue
      return
      end