GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing netlib.org — netlib.org subroutine sphere(iopt,m,teta,phi,r,w,s,ntest,npest,eps,
* nt,tt,np,tp,c,fp,wrk1,lwrk1,wrk2,lwrk2,iwrk,kwrk,ier)
c subroutine sphere determines a smooth bicubic spherical spline
c approximation s(teta,phi), 0 <= teta <= pi ; 0 <= phi <= 2*pi
c to a given set of data points (teta(i),phi(i),r(i)),i=1,2,...,m.
c such a spline has the following specific properties
c
c (1) s(0,phi) = constant 0 <=phi<= 2*pi.
c
c (2) s(pi,phi) = constant 0 <=phi<= 2*pi
c
c j j
c d s(teta,0) d s(teta,2*pi)
c (3) ----------- = ------------ 0 <=teta<=pi, j=0,1,2
c j j
c d phi d phi
c
c d s(0,phi) d s(0,0) d s(0,pi/2)
c (4) ---------- = -------- *cos(phi) + ----------- *sin(phi)
c d teta d teta d teta
c
c d s(pi,phi) d s(pi,0) d s(pi,pi/2)
c (5) ----------- = ---------*cos(phi) + ------------*sin(phi)
c d teta d teta d teta
c
c if iopt =-1 sphere calculates a weighted least-squares spherical
c spline according to a given set of knots in teta- and phi- direction.
c if iopt >=0, the number of knots in each direction and their position
c tt(j),j=1,2,...,nt ; tp(j),j=1,2,...,np are chosen automatically by
c the routine. the smoothness of s(teta,phi) is then achieved by mini-
c malizing the discontinuity jumps of the derivatives of the spline
c at the knots. the amount of smoothness of s(teta,phi) is determined
c by the condition that fp = sum((w(i)*(r(i)-s(teta(i),phi(i))))**2)
c be <= s, with s a given non-negative constant.
c the spherical spline is given in the standard b-spline representation
c of bicubic splines and can be evaluated by means of subroutine bispev
c
c calling sequence:
c call sphere(iopt,m,teta,phi,r,w,s,ntest,npest,eps,
c * nt,tt,np,tp,c,fp,wrk1,lwrk1,wrk2,lwrk2,iwrk,kwrk,ier)
c
c parameters:
c iopt : integer flag. on entry iopt must specify whether a weighted
c least-squares spherical spline (iopt=-1) or a smoothing
c spherical spline (iopt=0 or 1) must be determined.
c if iopt=0 the routine will start with an initial set of knots
c tt(i)=0,tt(i+4)=pi,i=1,...,4;tp(i)=0,tp(i+4)=2*pi,i=1,...,4.
c if iopt=1 the routine will continue with the set of knots
c found at the last call of the routine.
c attention: a call with iopt=1 must always be immediately pre-
c ceded by another call with iopt=1 or iopt=0.
c unchanged on exit.
c m : integer. on entry m must specify the number of data points.
c m >= 2. unchanged on exit.
c teta : real array of dimension at least (m).
c phi : real array of dimension at least (m).
c r : real array of dimension at least (m).
c before entry,teta(i),phi(i),r(i) must be set to the spherical
c co-ordinates of the i-th data point, for i=1,...,m.the order
c of the data points is immaterial. unchanged on exit.
c w : real array of dimension at least (m). before entry, w(i) must
c be set to the i-th value in the set of weights. the w(i) must
c be strictly positive. unchanged on exit.
c s : real. on entry (in case iopt>=0) s must specify the smoothing
c factor. s >=0. unchanged on exit.
c for advice on the choice of s see further comments
c ntest : integer. unchanged on exit.
c npest : integer. unchanged on exit.
c on entry, ntest and npest must specify an upper bound for the
c number of knots required in the teta- and phi-directions.
c these numbers will also determine the storage space needed by
c the routine. ntest >= 8, npest >= 8.
c in most practical situation ntest = npest = 8+sqrt(m/2) will
c be sufficient. see also further comments.
c eps : real.
c on entry, eps must specify a threshold for determining the
c effective rank of an over-determined linear system of equat-
c ions. 0 < eps < 1. if the number of decimal digits in the
c computer representation of a real number is q, then 10**(-q)
c is a suitable value for eps in most practical applications.
c unchanged on exit.
c nt : integer.
c unless ier=10 (in case iopt >=0), nt will contain the total
c number of knots with respect to the teta-variable, of the
c spline approximation returned. if the computation mode iopt=1
c is used, the value of nt should be left unchanged between
c subsequent calls.
c in case iopt=-1, the value of nt should be specified on entry
c tt : real array of dimension at least ntest.
c on succesful exit, this array will contain the knots of the
c spline with respect to the teta-variable, i.e. the position
c of the interior knots tt(5),...,tt(nt-4) as well as the
c position of the additional knots tt(1)=...=tt(4)=0 and
c tt(nt-3)=...=tt(nt)=pi needed for the b-spline representation
c if the computation mode iopt=1 is used, the values of tt(1),
c ...,tt(nt) should be left unchanged between subsequent calls.
c if the computation mode iopt=-1 is used, the values tt(5),
c ...tt(nt-4) must be supplied by the user, before entry.
c see also the restrictions (ier=10).
c np : integer.
c unless ier=10 (in case iopt >=0), np will contain the total
c number of knots with respect to the phi-variable, of the
c spline approximation returned. if the computation mode iopt=1
c is used, the value of np should be left unchanged between
c subsequent calls.
c in case iopt=-1, the value of np (>=9) should be specified
c on entry.
c tp : real array of dimension at least npest.
c on succesful exit, this array will contain the knots of the
c spline with respect to the phi-variable, i.e. the position of
c the interior knots tp(5),...,tp(np-4) as well as the position
c of the additional knots tp(1),...,tp(4) and tp(np-3),...,
c tp(np) needed for the b-spline representation.
c if the computation mode iopt=1 is used, the values of tp(1),
c ...,tp(np) should be left unchanged between subsequent calls.
c if the computation mode iopt=-1 is used, the values tp(5),
c ...tp(np-4) must be supplied by the user, before entry.
c see also the restrictions (ier=10).
c c : real array of dimension at least (ntest-4)*(npest-4).
c on succesful exit, c contains the coefficients of the spline
c approximation s(teta,phi).
c fp : real. unless ier=10, fp contains the weighted sum of
c squared residuals of the spline approximation returned.
c wrk1 : real array of dimension (lwrk1). used as workspace.
c if the computation mode iopt=1 is used the value of wrk1(1)
c should be left unchanged between subsequent calls.
c on exit wrk1(2),wrk1(3),...,wrk1(1+ncof) will contain the
c values d(i)/max(d(i)),i=1,...,ncof=6+(np-7)*(nt-8)
c with d(i) the i-th diagonal element of the reduced triangular
c matrix for calculating the b-spline coefficients. it includes
c those elements whose square is less than eps,which are treat-
c ed as 0 in the case of presumed rank deficiency (ier<-2).
c lwrk1 : integer. on entry lwrk1 must specify the actual dimension of
c the array wrk1 as declared in the calling (sub)program.
c lwrk1 must not be too small. let
c u = ntest-7, v = npest-7, then
c lwrk1 >= 185+52*v+10*u+14*u*v+8*(u-1)*v**2+8*m
c wrk2 : real array of dimension (lwrk2). used as workspace, but
c only in the case a rank deficient system is encountered.
c lwrk2 : integer. on entry lwrk2 must specify the actual dimension of
c the array wrk2 as declared in the calling (sub)program.
c lwrk2 > 0 . a save upper bound for lwrk2 = 48+21*v+7*u*v+
c 4*(u-1)*v**2 where u,v are as above. if there are enough data
c points, scattered uniformly over the approximation domain
c and if the smoothing factor s is not too small, there is a
c good chance that this extra workspace is not needed. a lot
c of memory might therefore be saved by setting lwrk2=1.
c (see also ier > 10)
c iwrk : integer array of dimension (kwrk). used as workspace.
c kwrk : integer. on entry kwrk must specify the actual dimension of
c the array iwrk as declared in the calling (sub)program.
c kwrk >= m+(ntest-7)*(npest-7).
c ier : integer. unless the routine detects an error, ier contains a
c non-positive value on exit, i.e.
c ier=0 : normal return. the spline returned has a residual sum of
c squares fp such that abs(fp-s)/s <= tol with tol a relat-
c ive tolerance set to 0.001 by the program.
c ier=-1 : normal return. the spline returned is a spherical
c interpolating spline (fp=0).
c ier=-2 : normal return. the spline returned is the weighted least-
c squares constrained polynomial . in this extreme case
c fp gives the upper bound for the smoothing factor s.
c ier<-2 : warning. the coefficients of the spline returned have been
c computed as the minimal norm least-squares solution of a
c (numerically) rank deficient system. (-ier) gives the rank.
c especially if the rank deficiency which can be computed as
c 6+(nt-8)*(np-7)+ier, is large the results may be inaccurate
c they could also seriously depend on the value of eps.
c ier=1 : error. the required storage space exceeds the available
c storage space, as specified by the parameters ntest and
c npest.
c probably causes : ntest or npest too small. if these param-
c eters are already large, it may also indicate that s is
c too small
c the approximation returned is the weighted least-squares
c spherical spline according to the current set of knots.
c the parameter fp gives the corresponding weighted sum of
c squared residuals (fp>s).
c ier=2 : error. a theoretically impossible result was found during
c the iteration proces for finding a smoothing spline with
c fp = s. probably causes : s too small or badly chosen eps.
c there is an approximation returned but the corresponding
c weighted sum of squared residuals does not satisfy the
c condition abs(fp-s)/s < tol.
c ier=3 : error. the maximal number of iterations maxit (set to 20
c by the program) allowed for finding a smoothing spline
c with fp=s has been reached. probably causes : s too small
c there is an approximation returned but the corresponding
c weighted sum of squared residuals does not satisfy the
c condition abs(fp-s)/s < tol.
c ier=4 : error. no more knots can be added because the dimension
c of the spherical spline 6+(nt-8)*(np-7) already exceeds
c the number of data points m.
c probably causes : either s or m too small.
c the approximation returned is the weighted least-squares
c spherical spline according to the current set of knots.
c the parameter fp gives the corresponding weighted sum of
c squared residuals (fp>s).
c ier=5 : error. no more knots can be added because the additional
c knot would (quasi) coincide with an old one.
c probably causes : s too small or too large a weight to an
c inaccurate data point.
c the approximation returned is the weighted least-squares
c spherical spline according to the current set of knots.
c the parameter fp gives the corresponding weighted sum of
c squared residuals (fp>s).
c ier=10 : error. on entry, the input data are controlled on validity
c the following restrictions must be satisfied.
c -1<=iopt<=1, m>=2, ntest>=8 ,npest >=8, 0 |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |