function spl_con

% SPL_CON Show the help for the functions in this toolbox.

% This file is automatically generated.  Matthew Simoneau, 09-04-98
% Copyright (c) 1984-98 by The MathWorks, Inc. All Rights Reserved
% $Revision: 1.11 $ $Date: 1998/10/16 23:19:40 $

helpwin('spl_con/Contents');

function Contents
%MATLAB Tour Partial Function Help:  spl_con
%
%Double click on any function for more information
%
%  Spline Toolbox.
%  Version 2.0.1 (R11) 14-Aug-1998
% 
%  New Features.
%    Readme      - Important release information about the Spline Toolbox
%                  (double click on Readme, or type "whatsnew directoryname",
%                   i.e. "whatsnew splines" to display this file).
% 
%  Operations on functions (in whatever form, B-form, ppform, BBform, ...
%                           univariate or multivariate)
%    fnbrk    - Name and part(s) of a form.
%    fncmb    - Arithmetic with function(s).
%    fn2fm    - Convert to specified form.
%    fnder    - Differentiate a function.
%    fndir    - Directional derivative of a function.
%    fnint    - Integrate a function.
%    fnjmp    - Jumps, i.e., f(x+) - f(x-) .
%    fnplt    - Plot a function.
%    fnrfn    - Insert additional points into the partition for  f .
%    fnval    - Evaluate a function.
% 
%  Creation of cubic splines
%    csape    - Cubic spline interpolation with various end-conditions.
%    csapi    - Cubic spline interpolant with not-a-knot end condition.
%    csaps    - Cubic smoothing spline.
%    cscvn    - `Natural' or periodic cubic spline curve.
%    getcurve - Interactive creation of a cubic spline curve.
% 
%  Creation of, and work with, splines specifically in ppform
%    pplst    - Summary of available operations on splines in ppform.
%    ppmak    - Put together a spline in ppform.
%    ppual    - Evaluate function in ppform, possibly continuous from the left.
% 
%  Creation of, and work with, splines specifically in B-form
%    splst    - Summary of available operations on splines in B-form.
%    spmak    - Put together a spline in B-form.
%    spap2    - Least squares spline approximation.
%    spapi    - Spline interpolation.
%    spaps    - Smoothing spline.
%    spcol    - B-spline collocation matrix.
%    spcrv    - Spline curve from control points by uniform subdivision.
% 
%  Work on knots and breaks
%    augknt   - Augment knot sequence.
%    aveknt   - Knot averages.
%    brk2knt  - Breaks with multiplicities into knots.
%    knt2brk  - From knots to breaks and their multiplicities.
%    knt2mlt  - Knot multiplicities.
%    newknt   - New break distribution.
%    optknt   - Optimal knot distribution.
%    sorted   - Locate points with respect to meshpoints.
% 
%  Customized linear equation solver
%    slvblk   - Solve almost block-diagonal linear system.
%    bkbrk    - Part(s) of an almost block-diagonal matrix.
% 
%  Demonstrations
%    spdemos  - List of spline toolbox demonstrations.
%    splexmpl - Some simple examples.
%    spalldm2 - Intro to B-form.
%    ppalldm2 - Intro to ppform.
%    bspline  - Plots a B-spline and its polynomial pieces.
%    bsplidem - Show some B-splines.
%    pckkntdm - Knot choices.
%    csapidem - Cubic spline interpolation demo.
%    csapsdem - Cubic smoothing spline demo.
%    chebdem  - Equioscillating spline demo.
%    difeqdem - ODE solved by collocation at Gauss points.
%    spcrvdem - Spline curve demo.
%    tspdem   - Demo of bivariate tensor product spline work.
% 
%  Obsolete functions
%    ppalldem - Intro to ppform.
%    spapidem - Spline interpolation demo.
% 
%  Utilities
%    franke   - Franke's bivariate test function.
%    subplus  - Positive part.
%    titanium - Test data.
%    chebloop - Used in chebdem.
%    difeqite - Used in difeqdem.
%    difeqset - Used in difeqdem.
%    splpp    - Left Taylor coefficients from local B-coefficients.
%    sprpp    - Right Taylor coefficients from local B-coefficients.
%

function Readme
%MATLAB Tour Partial Function Help:  spl_con
%
%  Update information for Spline Toolbox Versions 2.0 and 2.01
% 
%  Spline Toolbox version 2.01 is a MATLAB 5.3 compliant version and otherwise
%  very close to version 2.0.  
%  The functionality is similar to Spline Toolbox version 1.1.3 with the 
%  following additions/exceptions: 
% 
%  The object-oriented programming aspect of the toolbox has been
%  strengthened, in hopes that users will use the generic fn... commands
%  (like fnval or fnbrk) rather than the corresponding form-specific commands
%  (like spval or ppbrk) which the generic commands call upon in accordance 
%  with the specific form of the function being operated on.
% 
%  For this reason, the Contents.m file does not list explicitly the following
%  M-files, even though they still exist, for backward compatibility and
%  because they are used in the fn... commands: pp2sp, ppbrk, pprfn,
%  sp2bb, sp2pp, spbrk, sprfn, spval
% 
%  In addition, all M-files for the construction of splines have been expanded
%  to handle also tensor-product splines in any number of dimensions.
%  For example, the basic cubic spline interpolator csapi(X,Y) continues to 
%  provide the cubic spline  f  that satisfies  f(X(j)) = Y(j), all j, in case 
%  X and Y are just scalar sequences. But, in addition, if X is the cell 
%  array {X1,...,Xm} and Y, correspondingly, is an m-dimensional array, then  
%  csapi(X,Y) provides the m-cubic spline  f  that satisfies  
%  f(X1(j1),...,Xm(jm)) = Y(j1,...,jm) for all relevant  (j1,...,jm). Moreover, 
%  csapi, along with all the other spline fitting M-files, responds to 
%  vector-valued data by providing a vector-valued spline approximant. This 
%  makes it easy, for example, to construct surfaces as parametric bivariate 
%  tensor product splines.  
% 
%  Correspondingly, all the fn... files (except for fncmb and fnjmp) have been 
%  expanded to handle also multivariate (tensor-product) splines. In particular, 
%  the two standard forms, the B-form and the ppform, also are available for 
%  multivariate (tensor product) splines. Along with this, all specifically
%  bivariate features introduced in versions 1.1.3 and 1.1.4 have been dropped. 
% 
%  The various forms (chiefly the B-form and the ppform, for univariate and
%  multivariate splines) are now implemented as structures.  Still, the use of 
%  fnbrk to obtain parts of a form has been retained for backward compatibility. 
%  For the same reason of backward compatibility, fn2fm has been updated to
%  convert any form into its current version and, starting with version 2.01,
%  all fn... files will accept all versions of a form.
%  
%  The cubic spline constructing M-files (csape, csapi, csaps) now use sparse
%  matrices; also, it has been made easy to use sparse matrices in the general
%  spline-constructing M-files (spapi, spaps, spap2) by providing slvblk with
%  the option to use sparse matrix operations.
% 
% 
%  New M-files since version 2.0
% 
%   fndir     computes directional derivatives, hence Jacobians and gradients.
% 
%  Enhancements since version 2.0
% 
%   fn2fm     has been updated to convert any version of a form into the
%             current version.
% 
%  New M-files (since version 1.1.3)
% 
%   fnbrk     now handles all calls for parts of a form using the old but 
%             updated helper functions spbrk and ppbrk).  
%   fn2fm     now handles all calls for conversion from one form to another,
%             with each of the three forms, B-form, ppform, and BBform,
%             convertible to any of the other two (using the new helper files
%             pp2sp and sp2bb in addition to the older one, sp2pp).
%   fnrfn     now handles all calls for re-expressing a spline in the same
%             form but on a finer partition (using the new helper files sprfn
%             and pprfn).
% 
%   spaps     smoothest (linear, cubic, or quintic) spline within a specified 
%             distance from the data.  
% 
%   brk2knt   gets knot sequence from breaks and multiplicities.
%   knt2brk   extracts breaks from knot sequence.
%   knt2mlt   extracts multiplicities from knot sequence.
% 
%   getcurve  puts a spline curve through points obtained by mouse clicks.
% 
%   pckkntdm  demo on ways to choose knots.
% 
%  Enhancements (since version 1.1.3)
% 
%   fncmb     permit adding and multiplying of functions of different forms;
%             also composition with any linear map defined on the target, i.e.,
%             multiplication by a matrix (of the appropriate size).
%   fnint     optional input of constant of integration.
%   fnplt     has more options, including specification of linewidth,
%             and permits inputs in any order; also handles vector-valued
%             univariate and multivariate functions properly;
%             also, doesn't plot if nargout>0; also, in case of parametric
%             functions (i.e., curves and surfaces), can return the parameter 
%             values corresponding to the plotted points.
%   csape     can now handle vector-valued data, uses sparse, and now permits 
%             alternate end condition specification via a string command. 
%   csapi     can now handle vector-valued data, uses sparse.
%   csaps     can now handle vector-valued data, uses sparse.
%   cscvn     now uses a periodic spline in case first and last point coincide;
%             also introduces a corner at a repeated point.
%   pplst     updated to reflect changes.
%   spap2     can now handle repeated abscissae properly,
%             and also do *weighted* least squares.
%   spcol     may suppress derivatives in case of multiplicities;
%             this option is needed for doing spap2 properly when abscissae are
%             repeated; added tests of input; optional output of collocation
%             matrix in MATLAB's sparse matrix format; options may be specified
%             by a string.
%   splst     updated to reflect changes.
%   augknt    can now specify different multiplicities for different interior
%             knots; also will now sort a disordered input knot sequence.
%   newknt    handles flat spots better, can also work from a spline in B-form.
%   optknt    now uses sparse.
%   slvblk    allows for weights; changed to make it more efficient when dealing
%             with approximation to vector-valued function; can also handle
%             MATLAB's sparse matrix format.
% 
% 
%  Updated demos
% 
%   bspline
%   bsplidem
%   chebdem
%   csapidem
%   difeqdem
%   ppalldm2
%   spalldm2
%   tspdem

function fnbrk
%MATLAB Tour Partial Function Help:  spl_con
%
% FNBRK Name and part(s) of a form.
% 
%    OUT1 = FNBRK(FN,PART)
% 
%    returns the 'form' of the form contained in FN or any other
%    specified PART (thus obviating direct use of SPBRK, PPBRK, ... ).
% 
%    If FN is in B-form, then the part returned is specified by the string PART 
%    which may be (the beginning character(s)) of one of the following strings:
% 
%       'knots' or 't', 'coefs', 'number', 'order', 'dim'ension, 'interval'
% 
%    corresponding to the knot sequence, the B-spline coefficient array, the 
%    number of coefficients, the (polynomial) order, the dimension of the 
%    function's target, and the basic interval.
% 
%    If FN is in ppform, then the part returned is specified by the string PART 
%    which may be (the beginning character(s)) of one of the following strings:
% 
%       'breaks, 'coefs', 'pieces' or 'l', 'order', 'dim'ension, 'interval'
% 
%    corresponding to the break sequence, the array of local polynomial
%    coefficients, the number of polynomial pieces, the (polynomial) order, the 
%    dimension of the function's target, and the basic interval.
%    For a while, there is also the choice
%       'guide'
%    that returns the coefficient array in the form required in the ppform used
%    in `A Practical Guide to Splines', especially for PPVALU there. This is not
%    available for vector-valued and/or tensor product splines.
% 
%    In addition, in the ppform case, 
% 
%    PJ = FNBRK(PP,J)
% 
%    returns the ppform of the J-th polynomial piece of the function in PP, and
% 
%    PC = PPBRK(PP,[A B])
% 
%    returns the restriction to the interval  [A .. B]  of the function in PP.
% 
%    If FN contains an m-variate spline with m>1 and PART is not a string, then 
%    it must be a cell-array, of length m .
% 
%    FNBRK(FN)
% 
%    prints the 'form' along with all the parts if available.
%  
%    For example,
% 
%       coefs = fnbrk( fn, 'coef' );
% 
%    returns the coefficients (from its B-form or its ppform) of the spline
%    in fn.
%    As another example, if p1 and p2 contain the B-form of two splines of the 
%    same order, with the same knot sequence, and the same target dimension, then
% 
%       p1plusp2 = spmak( fnbrk(p1,'k'), fnbrk(p1,'c')+fnbrk(p2,'c') );
% 
%    provides the (pointwise) sum of those two functions.
% 
%    If pp contains the ppform of a bivariate spline with at least 4 polynomial
%    pieces in the first variable, then 
% 
%       ppp = fnbrk(pp,{4,[-1 1]});
% 
%    gives the spline which agrees with the spline in pp on the rectangle 
%    [b4 .. b5] x [-1 ..  1] , where b4, b5 are the 4th and 5th point in the 
%    break sequence for the first variable.
% 
%    

function fncmb
%MATLAB Tour Partial Function Help:  spl_con
%
% FNCMB Arithmetic with function(s).
% 
%    FNCMB(function, matrix )  function  multiplied by the matrix/scalar
%    FNCMB(function,function)  sum of the two  functions  of same form
%    FNCMB(function,matrix,function)  matrix/scalar multiple of the first
%                              function added to the second of same form
%    FNCMB(function,matrix,function,matrix)  linear combination of the two
%                              functions (of the same form) with the given
%                              matrix/scalar weights
% 
%    FNCMB(function,'op',function)  ppform of the sum (op=+), difference
%                              (op=-), or pointwise product (op=*) of the two
%                              functions possibly of different forms.
%                              In particular, in case of addition/subtraction,
%                              the second function may be just a point in
%                              the target of the first.
% 
%    At present, all functions must be UNIVARIATE except for the call
%    FNCMB(function,matrix).
% 
%    For example,
% 
%       fncmb( sp1, '+' , sp2 );
% 
%    returns the (pointwise) sum of the function in SP1 and that in SP2, while
% 
%       fncmb( spmak( augknt(4:9,4), eye(8) ), [1:8] )
% 
%    is a complicated way to construct a certain linear combination of certain
%    cubic B-splines.
%    If fn contains a 3-vector-valued function (i.e., a map into R^3), then
% 
%       fncmb( fn, [1 0 0; 0 0 1] )
% 
%    provides the projection onto the (x,z)-plane.

function fn2fm
%MATLAB Tour Partial Function Help:  spl_con
%
% FN2FM Convert to specified form.
% 
%    FN2FM(F,FORM)  converts the function in F to the specified FORM.
%    Present choices for FORM are: 'pp', 'sp'='B-', 'bb'='BB' . 
% 
%    If FORM is 'B-' (and F is in ppform), then the actual smoothness of the
%    function in F across each of its interior breaks has to be guessed. This is
%    done by looking, for each interior break, for the derivative of smallest
%    order whose jump across that break is not `small' compared to the size of 
%    that derivative nearby. The default tolerance used in this is 1.e-12. 
%    But the user can assist by supplying a tolerance (strictly between 0 and 1) 
%    in the the optional third argument SCONDS in the command
% 
%    FN2FM(F,FORM,SCONDS)
% 
%    Alternatively, the user can supply, in SCONDS(i), the correct number of 
%    smoothness conditions to be used across the i-th *interior* break, but must
%    then do so for all interior breaks. If the function in F is a tensor
%    product, then SCONDS, if given, must be a cell array. 
% 
%    Also, for a while, the choice 'MA' for FORM is allowed, for a conversion
%    from structured form to the present ppform in MATLAB. In the same
%    spirit, the choice 'ol' is allowed, for a reversion from the
%    structured form, pp or B-, to the corresponding former, nonstructured
%    way of storing the ppform or the B-form. Such a reversion is not
%    available for tensor products.
%    Finally,
% 
%    FN2FM(F)  converts a possibly old version of a form into its present 
%    version.
% 
%    For example, 
%    
%        sp = fn2fm(spline(x,y),'sp');
% 
%    will give the interpolating cubic spline provided by MATLAB's SPLINE,
%    but in B-form (i.e., described as a linear combination of B-splines).
% 
%    As another example,
% 
%     p0 = ppmak([0 1],[3 0 0]); p1 = fn2fm(fn2fm(fnrfn(p0,[.4 .6]),'B-'),'pp');
% 
%    gives p1 identical to p0 (up to round-off) since the spline has no
%    discontinuity in any derivative across the additional breaks introduced
%    by FNRFN, hence conversion to B-form ignores these additional breaks, and 
%    conversion to ppform does not retain any knot multiplicities (like 
%    the knot multiplicities introduced, by conversion to B-form, at the 
%    endpoints of the spline's basic interval).
% 
%    

function fnder
%MATLAB Tour Partial Function Help:  spl_con
%
% FNDER Differentiate a function.
% 
%    FNDER(F)
% 
%    returns the (representation of the) first derivative of the
%    univariate function contained in F (and in the same form).  
% 
%    FNDER(F,DORDER) returns the DORDER-th derivative, with DORDER expected
%    to be of the form [d1,...,dm] in case the function in F is m-variate,
%    and, for each i=1,..,m,  di  an integer to indicate that the function
%    in F is to be differentiated di-fold with respect to its i-th argument.
%    Here, di may be negative, resulting in di-fold integration with respect
%    to the i-th argument.
% 
%    For example,
% 
%    fnval( fnder( sp, 2), 3.14 );
%  
%    gives the value at 3.14 of the function in sp, while
% 
%    sp0 = fnint( fnder( sp ) );
% 
%    gives a function which differs from sp by some constant only (namely, by
%    its value at 0).
% 
%    

function fndir
%MATLAB Tour Partial Function Help:  spl_con
%
% FNDIR Directional derivative of a function.
% 
%    FNDIR(F,DIRECTION)  returns the (ppform of the) derivative in the given 
%    DIRECTION(s) of the function contained in F (and of the same order).
%    If the function in F is d-variate, then DIRECTION must be a (list of)
%    d-vector(s), i.e., of size [d,nd] for some nd. 
% 
%    Assuming the function in F to be d-variate and m-vector-valued, FDIR 
%    describes the (m*dn)-valued function whose value at a point, reshaped 
%    as a matrix of size [m,dn], provides in its j-th column the directional 
%    derivative, of the function in F, in the direction DIRECTION(:,j), j=1:nd.
% 
%    For example, if  f  describes a d-variate m-vector-valued function and 
%     x  is some point in its domain, then
%   
%       reshape(fnval(fndir(f,eye(d)),x),m,d)
% 
%    is the Jacobian of that function at that point. 
%    As a related example, the next statements plot the gradients of (a good 
%    approximation to) the Franke function at a regular mesh: 
% 
%       xx = linspace(-.1,1.1,13); yy = linspace(0,1,11);
%       [x,y] = ndgrid(xx,yy); z = franke(x,y);
%       pp2dir = fndir(csapi({xx,yy},z),eye(2));
%       grads = reshape(fnval(pp2dir,[x(:) y(:)].'),[2,length(xx),length(yy)]);
%       quiver(x,y,squeeze(grads(1,:,:)),squeeze(grads(2,:,:)))
% 
%    

function fnint
%MATLAB Tour Partial Function Help:  spl_con
%
% FNINT Integrate a function.
% 
%    FNINT(F)  returns the (representation of the) indefinite integral that 
%    at the left end point of the basic interval for (the function in) F.
% 
%    FNINT(F,IFA)  provides the indefinite integral whose value at the 
%    left end point of the basic interval is IFA.
% 
%    For example,
% 
%       fnder(fnint(f));
% 
%    is the same as F (except for round-off and, possibly, the multiplicity of
%    end knots).
% 
%    

function fnjmp
%MATLAB Tour Partial Function Help:  spl_con
%
% FNJMP Jumps, i.e., f(x+) - f(x-) .
% 
%    JUMPS = FNJMP(F,X)
% 
%    returns the matrix JUMPS containing the jump  f(X+) - f(X-)  at
%    the point(s) in X in the function  f  specified by F.
% 
%    For example,  fnjmp( ppmak( 1:4 , 1:3), 1:4 )  returns the vector
%    [ 0, 1, 1, 0]  (since the pp function here is 1 on [1 .. 2], 2 on [2 .. 3]
%    and 3 on [3 .. 4], hence has zero jump at 1 and 4 and a jump of 1 across
%    both 2 and 3).

function fnplt
%MATLAB Tour Partial Function Help:  spl_con
%
% FNPLT Plot a function.
% 
%    FNPLT(F)  plots the function in F on its basic interval.
% 
%    FNPLT(F,SYMBOL,INTERV,LINEWIDTH) plots the function F on the specified
%    INTERV = [a,b] (default is the basic interval), using the specified
%    plotting SYMBOL (default is '-'), and the specified 
%    LINEWIDTH (default is 1).
%    The three optional arguments may appear in any order, with INTERV
%    the one of size [1 2], SYMBOL the string, and LINEWIDTH the
%    scalar.
% 
%    If the function in F is 2-vector-valued, the planar curve is
%    plotted.  If the function in F is d-vector-valued with d>2, the
%    space curve given by the first three components of F is plotted.
% 
%    If the function is multivariate, it is plotted as a bivariate function
%    at the midpoint of its basic intervals in additional variables, if any.
% 
%    POINTS = FNPLT(F,...)   does not plot, but returns instead the sequence 
%    of 2D-points or 3D-points it would have plotted.
% 
%    [POINTS,T] = FNPLT(F,...)  also returns, for a vector-valued F, the 
%    corresponding vector T of parameter values.
% 
%    For example, fnplt(f,'r',3,[1 3]) plots the graph of the function in F,
%    restricted to the interval [1 .. 3], in red with linewidth 3 (assuming
%    that F describes a univariate function).

function fnrfn
%MATLAB Tour Partial Function Help:  spl_con
%
% FNRFN Insert additional points into the partition for F
% 
%    FNRFN(F,ADDPTS) inserts the specified ADDPTS into the partition 
%    (knots or breaks) for F.  
% 
%    For example, if one wants to add the cubic polynomial with coefficient
%    vector [1,-1,1,2] to the cubic spline in F in ppform, then FNRFN is of 
%    help in the following way (taken, more or less, from FNCMB):
%       pp = fnrfn(ppmak([0 1],[1,-1,1,2]),fnbrk(f,'br'));
%       ff = fnrfn(f,[0 1]);
%       pplusf = ppmak(fnbrk(pp,'br'),fnbrk(pp,'c')+fnbrk(ff,'c'),1);
% 
%    

function fnval
%MATLAB Tour Partial Function Help:  spl_con
%
% FNVAL Evaluate a function.
% 
%    FNVAL(F,X)  evaluates the function  f  in F at the specified points. 
% 
%    The output is a matrix of size [d*m,n] if the function in F is
%    univariate, d-vector valued and [m,n] = size(X) .
% 
%    If the function in F is d-vector valued and m-variate with m>1, then
% 
%                          [d*m,n],       if X is of size [m,n]
%    the output is of size [d,n1,...,nm], if d>1  and X is {X1,...,Xm} 
%                          [n1,...,nm],   if d==1 and X is {X1,...,Xm} 
% 
% 
%    

function csape
%MATLAB Tour Partial Function Help:  spl_con
%
% CSAPE Cubic spline interpolation with various end-conditions.
% 
%    PP  = CSAPE(X,Y)
% 
%    returns the cubic spline interpolant (in ppform) to the given
%    data (X,Y) using Lagrange end-conditions (see default in table below).
% 
%    PP  = CSAPE(X,Y,CONDS) uses the end-conditions specified in CONDS, with
%    default values (which depend on the particular conditions).
% 
%    PP  = CSAPE(X,Y,CONDS,VALCONDS) uses the end-conditions specified 
%    in CONDS, with particular values as specified in VALCONDS.
% 
%    CONDS may be a *string* whose first character matches one of the
%    following: 'complete' or 'clamped', 'not-a-knot', 'periodic',
%    'second', 'variational', with the following meanings:
% 
%    'complete'    : match endslopes (as given in VALCONDS, with
%                    default as under *default*)
%    'not-a-knot'  : make spline C^3 across first and last interior
%                    break (ignoring VALCONDS if given)
%    'periodic'    : match first and second derivatives at first data
%                    point with those at last data point
%                    (ignoring VALCONDS if given)
%    'second'      : match end second derivatives (as given in VALCONDS,
%                    with default [0 0], i.e., as in variational)
%    'variational' : set end second derivatives equal to zero
%                    (ignoring VALCONDS if given)
%    The *default* : match endslopes to the slope of the cubic which
%                    matches the first four data at the respective end.
% 
%    By giving CONDS as a 1-by-2 matrix instead, it is possible to
%    specify *different* conditions at the two endpoints, namely
%    CONDS(i) with value VALCONDS(:,i), with i=1 (i=2) referring to the
%    left (right) endpoint.
% 
%    CONDS(i)=j  means that the j-th derivative is being specified to
%    be VALCONDS(:,i) , j=1,2.  CONDS(1)=0=CONDS(2)  means periodic end
%    conditions.
% 
%    If CONDS(i) is not specified or is different from 0, 1 or 2, then
%    the default value for CONDS(i) is  1  and the default value of
%    VALCONDS(:,i) is taken.  If VALCONDS is not specified, then the
%    default value for VALCONDS(:,i) is taken to be
% 
%     deriv. of cubic interpolant to nearest four points, if   CONDS(i)=1;
%                      0                                  if   CONDS(i)=2.
% 
%    It is possible (and, in the case of gridded data required) to specify
%    VALCONDS as part of Y. Specifically, if size(Y) == [d,ny] and ny ==
%    length(X)+2, then VALCONDS is taken to be Y(:,[1 end]), and Y(:,i+1)
%    is matched at X(i), i=1:length(X).
% 
%    It is also possible to handle gridded data, by having X be a cell array
%    containing m univariate meshes and, correspondingly, having Y be an
%    m-dimensional array (or an m+1-dimensional array if the function is to be
%    vector-valued). Correspondingly, CONDS is a cell array with m entries, but
%    the information normally specified by VALCONDS is now expected to be part
%    of Y. 
% 
%    For example,
% 
%       fnplt(csape( [0:4], [1 0 -1 0 1;0 1 0 -1 0], 'periodic')), axis equal
% 
%    plots a circle, while
% 
%       pp = csape( [0:4]*(pi/2), [0 1 0 -1 0], [1 2], [1 0] );
% 
%    gives a good approximation to the sine function on the interval [0 .. 2*pi]
%    (matching its slope at 0 and its second derivative at 2*pi in addition 
%    to its value at 0:pi/2:2*pi).
% 
%    As a multivariate vector-valued example, here is a sphere, done as a 
%    parametric bicubic spline, using prescribed slopes in one direction and
%    periodic side conditions in the other:
% 
%       x = 0:4; y=-2:2; s2 = 1/sqrt(2);
%       clear v
%       v(3,:,:) = [0 1 s2 0 -s2 -1 0].'*[1 1 1 1 1];
%       v(2,:,:) = [1 0 s2 1 s2 0 -1].'*[0 1 0 -1 0];
%       v(1,:,:) = [1 0 s2 1 s2 0 -1].'*[1 0 -1 0 1];
%       sph = csape({x,y},v,{'clamped','periodic'});
%       values = fnval(sph,{0:.1:4,-2:.1:2});
%       surf(squeeze(values(1,:,:)),squeeze(values(2,:,:)),squeeze(values(3,:,:)))
%       % the previous two lines could have been replaced by: fnplt(sph) 
%       axis equal, axis off
% 
%    

function csapi
%MATLAB Tour Partial Function Help:  spl_con
%
% CSAPI Cubic spline interpolant with not-a-knot end condition.
% 
%    VALUES  = CSAPI(X,Y,XX)
% 
%    returns the values at XX of the cubic spline interpolant to the
%    given data (X,Y) (using the not-a-knot end condition).  The
%    ordinates may be vector-valued, in which case Y(:,j) is the j-th
%    ordinate.
% 
%    The alternative call
% 
%    PP  = CSAPI(X,Y)
% 
%    returns the ppform of the cubic spline interpolant instead, for
%    later use with FNVAL, FNDER, FNPLT, etc.
% 
%    For example, 
% 
%       values = csapi([-1:5]*(pi/2),[0 1 0 -1 0], linspace(0,2*pi));
% 
%    gives a surprisingly good fine sequence of values for the sine over its
%    period.
% 
%    It is also possible to interpolate to data on a rectangular grid and
%    obtain values of the interpolant on a rectangular grid or at scattered
%    points, by the calls
% 
%    VALUES = CSAPI({X1, ...,Xm},Y,XX)
%    or
%    PP = CSAPI({X1, ...,Xm},Y)
% 
%    in which Y is expected to have size [d,length(X1),...,.length(Xm)]
%    (or [length(X1),...,.length(Xm)] if the function is to be scalar-valued),
%    and XX is either a list of m-vectors XX(:,j) or else a cell-array 
%    {XX1,...,XXm} specifying the m-dimensional grid at which to evaluate
%    the interpolant.
% 
%    

function csaps
%MATLAB Tour Partial Function Help:  spl_con
%
% CSAPS Cubic smoothing spline.
% 
%    CSAPS(X,Y,P)  returns the ppform of the cubic smoothing spline for the
%    given data (X,Y)  and depending on the smoothing parameter P from 
%    [0 .. 1].  This smoothing spline  f  minimizes
% 
%    P * sum_i W(i)(Y(i) - f(X(i)))^2  +  (1-P) * integral (D^2 f)^2
% 
%    with W = ones(length(X),1) the default value for  W .
%    For  P=0, the smoothing spline is the least-squares straight line fit to
%    the data, while, at the other extreme, i.e., for  P=1, it is
%    the `natural' or variational cubic spline interpolant.  The
%    transition region between these two extremes is usually only a
%    rather small range of values for P and its location strongly
%    depends on the data.
%    If you have difficulty choosing  P , but have some feeling for the size
%    of the noise in  Y , consider using instead  spaps(X,Y,tol)  which, in
%    effect, chooses  P  in such a way that
%            sum_i W(i)(Y(i) - f(X(i)))^2  =  tol  .
% 
%    CSAPS(X,Y,P,XX) returns instead the value(s) at XX of the cubic smoothing
%    spline, unless XX is empty, in which case the ppform of the cubic smoothing
%    spline is returned. This latter option is important when the user wants
%    to supply the weights W, as in the following:
% 
%    CSAPS(X,Y,P,XX,W) returns, depending on whether or not XX is empty, the
%    ppform, or the values at XX,  of the cubic smoothing spline for the 
%    specified weights W.
%    
%    For example, 
% 
%       x = linspace(0,2*pi,21); y = sin(x)+(rand(1,21)-.5)*.1;
%       pp = csaps(x,y,.4,[],[ones(1,11), repmat(5,1,10)]);
% 
%    returns a smoothed version of the data that is much closer to the data
%    in the right half, because of the much larger weight there.
% 
%    It is in general difficult to choose the parameter P without
%    experimentation. For that reason, use of SPAPS is recommended instead
%    since there P is chosen so as to produce the smoothest spline within a
%    specified tolerance of the data.
% 
%    It is also possible to smooth data on a rectangular grid and
%    obtain smoothed values on a rectangular grid or at scattered
%    points, by the calls
%    VALUES = CSAPS({X1, ...,Xm},Y,P,XX)
%    VALUES = CSAPS({X1, ...,Xm},Y,P,XX,W)
%    or the ppform of the corresponding cubic smoothing spline by the calls
%    PP = CSAPS({X1, ...,Xm},Y,P)
%    PP = CSAPS({X1, ...,Xm},Y,P,[],W)
%    in which Y is expected to have size [d,length(X1),...,.length(Xm)]
%    (or [length(X1),...,.length(Xm)] if the function is to be scalar-valued),
%    and P is either a scalar or an m-vector,
%    and XX is either a list of m-vectors XX(:,j) or else a cell-array 
%    {XX1, ..., XXm} specifying the m-dimensional grid at which to evaluate
%    the interpolant, and, correspondingly, W, if given, is a cell array of
%    weight sequences for the m dimensions (with an empty Wi indicating the
%    default choice).
% 
%    

function cscvn
%MATLAB Tour Partial Function Help:  spl_con
%
% CSCVN `Natural' or periodic cubic spline curve.
% 
%    CS  = CSCVN(POINTS)
% 
%    returns a parametric `natural' cubic spline which interpolates to
%    the given points POINTS(:,i)  at parameter values  t(i) ,
%    i=1,2,..., with  t(i)  chosen by Eugene Lee's centripetal scheme,
%    i.e., as accumulated squareroot of chord-length.
% 
%    When first and last point coincide and there are no double points,
%    then a parametric *periodic* cubic spline is constructed instead. 
%    However, double points result in corners.
% 
%    For example,
% 
%       fnplt(cscvn( [1 0 -1    0 1;0 1 0   -1 0] ))
% 
%    shows a (circular) curve through the four vertices of the standard diamond
%    (because of the periodic boundary conditions enforced), while
% 
%       fnplt(cscvn( [1 0 -1 -1 0 1;0 1 0 0 -1 0] ))
% 
%    shows a corner at the double point as well as at the curve endpoint.
% 
%    

function getcurve
%MATLAB Tour Partial Function Help:  spl_con
%
% GETCURVE  Interactive creation of a cubic (spline) curve.
%    The points picked are available in the array XY.
%    The spline curve is available in SPCV.
%    A closed curve will be drawn if the first and last point are
%    sufficiently close to each other.
%    Repeated points create a corner in the curve.

function pplst
%MATLAB Tour Partial Function Help:  spl_con
%
% PPLST Summary of available operations on splines in ppform.

function ppmak
%MATLAB Tour Partial Function Help:  spl_con
%
% PPMAK Put together a spline in ppform.
% 
%    PPMAK(BREAKS,COEFS)  puts together a spline in ppform from the breaks
%    BREAKS(1:L+1) and coefficient matrix COEFS input. Each column of COEFS is
%    taken to be one coefficient, i.e., the spline is taken to be D-vectorvalued
%    if COEFS has D rows. Further, with L taken as  length(BREAKS)-1, the order
%    K of the spline is computed as (# cols(COEFS))/L, and COEFS is
%    interpreted as a three-dimensional array of size [D,K,L], with 
%    COEFS(:,:,j) containing the local polynomial coefficients for the j-th
%    polynomial piece, from highest to lowest.
% 
%    PPMAK  will prompt for BREAKS and COEFS.
% 
%    PPMAK(BREAKS,COEFS,D) is the way ppforms are put together inside this
%    toolbox. It expects the matrix COEFS to be in the form internally used, 
%    namely as the matrix of size [D*L,K] that, taken as a three-dimensional 
%    array of size [D,L,K], has the local polynomial coefficients of the j-th 
%    polynomial piece, from highest to lowest, in COEFS(:,j,:). In particular, 
%    the order K is taken to be the column number of COEFS, and L is taken to
%    be (# rows(COEFS))/D.
% 
%    For example,  ppmak([1 3 4],[1 2 5 6;3 4 7 8])  and
%                  ppmak([1 3 4],[1 2;3 4;5 6;7 8],2)
%    specify the same function (2-vector-valued, of order 2).
%    The toolbox uses internally only the second format.
% 
%    PPMAK({BREAKS1,...,BREAKSm},COEFS)  puts together an m-variate 
%    tensor-product spline in ppform. In this case, COEFS is expected to be of 
%    size [D,lk], with  lk := [l1*k1,...,lm*km]  and  li = length(BREAKS{i})-1, 
%    all i , and this defines  D  and  k :=[k1,...,km] .  If, instead, COEFS is 
%    only an m-dimensional array, then  D  is taken to be 1.
% 
%    

function ppual
%MATLAB Tour Partial Function Help:  spl_con
%
% PPUAL Evaluate function in ppform.
% 
%    PPUAL(PP,X)  returns the value at X of the function whose ppform is in PP.
% 
%    PPUAL(PP,X,<anything>)  takes the function to be left-continuous.
%    If the function in PP is m-variate and the third argument is actually an
%    m-cell, LEFT say, then, continuity from the left is enforced in the i-th 
%    variable if and only if  LEFT{i}  is not empty.  
% 
%    The output is a matrix of size [d*m,n] if the function in PP is
%    univariate and d-vector valued, and [m,n] == size(X) .
% 
%    If the function in PP is m-variate with m>1 and d-vector valued, then
% 
%                          [d*m,n],       if X is of size [m,n]
%    the output is of size [d,n1,...,nm], if d>1  and X is {X1,...,Xm} 
%                          [n1,...,nm],   if d==1 and X is {X1,...,Xm} 
% 
%    

function splst
%MATLAB Tour Partial Function Help:  spl_con
%
% SPLST Summary of available operations on splines in B-form.

function spmak
%MATLAB Tour Partial Function Help:  spl_con
%
% SPMAK Put together a spline in B-form.
% 
%    SPLINE = SPMAK(KNOTS,COEFS) puts together a spline from the knots 
%    and coefficients input or requested. COEFS is expected in the form  
%    COEFS(d,n)  with  d the number of components in each of the  n  
%    spline coefficient supplied.  The  order of the spline is inferred as  
%    k := length(KNOTS) - n.  Knot multiplicity is held to <= k , with the 
%    coefficients corresponding to a B-spline with trivial support ignored.
% 
%    If KNOTS is an m-dimensional cell array, then COEFS is expected to
%    be an m- or (m+1)-dimensional array, and the corresponding tensor product
%    spline is returned. FEWER CHECKS ARE CARRIED OUT in this case.
% 
%    

function spap2
%MATLAB Tour Partial Function Help:  spl_con
%
% SPAP2 Least squares spline approximation.
% 
%    SPAP2(KNOTS,K,X,Y) returns the spline  f  of order K with knot sequence 
%    KNOTS for which
% 
%    (*)    Y = f(X)
% 
%    in the mean-square sense, i.e.,  the one that minimizes
% 
%    (**)   sum_j W(j) ( Y(j) - f(X(j)) )^2 .
% 
%    with  W = ones(size(X)). Other weights can be specified by an optional
%    additional argument, i.e., by using
% 
%    SPAP2(KNOTS,K,X,Y,W) which returns the spline  f  of order K with knot
%    sequence KNOTS that minimizes (**). A better choice than the default
%    W = ones(size(X))  would be the composite trapezoid rule weights 
%    W = ([dx;0]+[0;dx]).'/2 , with dx = diff(X(:)) .
% 
%    If the abscissae satisfy the Schoenberg-Whitney conditions
% 
%    (***)   KNOTS(j) < X(j) < KNOTS(j+K) ,
%                                j=1:length(X)=length(KNOTS)-K ,
% 
%    (with equality permitted at knots of multiplicity K), then  f  is
%    the unique spline of that order satisfying  (*)  exactly.  No
%    spline is returned unless (***) is satisfied for some subsequence
%    of X.
% 
%    It is also possible to fit to gridded data:
% 
%    SPAP2( {KNOTS1,...,KNOTSm}, [K1,...,Km], {X1,...,Xm}, Y ) returns
%    the m-variate tensor-product spline of coordinate order Ki and with knot 
%    sequence KNOTSi in the i-th variable, i=1,...,m, for which
% 
%    Y(:,i1,...,im) = f(X1(i1),...,Xm(im)),  all i := (i1,...,im) 
% 
%    in the (possibly weighted) mean-square sense.
%    Note the possibility of fitting to vector-valued data. However,
%    in contrast to the univariate case, if the data to be fitted is
%    scalar-valued, then the input array Y is permitted to be m-dimensional,
%    in which case
%    Y(i1,...,im) = f(X1(i1),...,Xm(im)),  all i := (i1,...,im) 
%    in the (possibly weighted) mean-square sense.
% 
%    For example, 
% 
%       spap2(augknt(x([1 end]),2),2,x,y);
% 
%    provides the least-squares straight-line fit to data x,y (assuming that 
%    x(1) <= x(i) <= x(end) ), while
%       w = ones(size(x)); w([1 end]) = 100;
%       spap2(augknt(x([1 end]),2),2,x,y,w);
%    forces that fit to come very close to the first and last data point.
% 
%    

function spapi
%MATLAB Tour Partial Function Help:  spl_con
%
% SPAPI Spline interpolation.
% 
%    SPAPI(KNOTS,X,Y)      (with both KNOTS and X vectors)
% 
%    returns in SP the spline  f  (if any) of order
%          k := length(KNOTS) - length(X)
%    with knot sequence KNOTS for which  Y(:,j) = f(X(j)) , all j.
%    This is taken in the osculatory sense in case some X are repeated,
%    i.e., in the sense that  D^m(i) f(X(i)) = Y(:,i)  in case the X are
%    in nondecreasing order, with  m(i) := #{ j<i : X(j) = X(i) }.
% 
%    SPAPI({KNOTS1,...,KNOTSm},{X1,...,Xm},Y)
% 
%    returns in SP the m-variate tensor-product spline of coordinate order
%       ki := length(KNOTSi) - length(Xi)
%    with knot sequence KNOTSi in the i-th variable, i=1,...,m, for which
%    Y(:,j1,...,jm) = f(X1(j1),...,Xm(jm)),  all j := (j1,...,jm) 
%    Note the possibility of interpolating to vector-valued data. However,
%    in contrast to the univariate case, if the data to be interpolated are
%    scalar-valued, then the input array Y is permitted to be m-dimensional,
%    in which case
%    Y(j1,...,jm) = f(X1(j1),...,Xm(jm)),  all j := (j1,...,jm) 
%    Multiplicities in the sequences Xi lead to osculatory interpolation just
%    as in the univariate case.
% 
%    For example, if the points in the vector  t  are all distinct, then
% 
%       sp = spapi(augknt(t,4,2),[t t],[cos(t) -sin(t)]);
% 
%    provides the C^1 piecewise cubic Hermite interpolant to the function 
%    f(x) = cos(x)  at the points in  t , while
% 
%       sp = spapi({[0 0 1 1],[0 0 1 1]},{[0 1],[0 1]},[0 0;0 1]);
% 
%    constructs the bilinear interpolant to values at the corners of a square.
% 
%    

function spaps
%MATLAB Tour Partial Function Help:  spl_con
%
% SPAPS Smoothing spline.
% 
%    [SP,VALUES] = SPAPS(X,Y,TOL)  returns the B-form and, if asked, the values 
%    at  X , of the smoothest d-valued function  f , in the sense that
% 
%        F(D^M f) := sum integral { (D^M f(t))^2 : X(1) < t < X(n) }
% 
%    is smallest, for which
% 
%        E(f) :=  sum sum_j {W(j)*(Y(:,j) - f(X(j)))^2 : j=1,...,n }
% 
%    is no bigger than TOL, with the weights W chosen so that  E(f)  is
%    the Composite Trapezoid Rule approximation to  F(y - f), and with 
%    M = 2,   i.e.,  f  is a  c u b i c  smoothing spline. This is so because
%    f is constructed as the unique minimizer of
%                      rho*E(f) + F(D^2 f) ,
%    with the smoothing parameter RHO (optionally returned as a third output
%    argument) so chosen that  E(f) == TOL . Hence, after conversion to ppform
%    (and up to roundoff), the result should be the same as obtained by
%    cpaps(x,y,RHO/(1+RHO)).
% 
%    Here, the default for d is 1 and, for that case, the extra summation in
%    the definition of F and E(f) does nothing. However, if Y is not just a 
%    vector, then Y is expected to have length(X) columns, and then d is the 
%    number of rows in Y, and, correspondingly, the output is a d-vector-valued 
%    function, and the sum in the definition of F and the first sum in the 
%    definition of E(f) is the sum over the d rows.  
%    See below for the case of  g r i d d e d  data.
% 
%    SPAPS(X,Y,TOL,W)
%    SPAPS(X,Y,TOL,M)
%    SPAPS(X,Y,TOL,W,M)
%    SPAPS(X,Y,TOL,M,W)
%    provide W and/or M explicitly, with M presently restricted to
%    M = 1 (linear) and M = 3 (quintic).
% 
%    If X is not increasing, both X and Y will be reordered in unison to
%    make it so. After that, X must be  s t r i c t l y  increasing.
%    Also, Y must be of size d-by-length(X).
% 
%    If X is a cell-array, of length  r , then Y is expected to supply
%    correspondingly gridded data, with Y of size [length(X{i}): i=1:r]
%    for scalar data, and of size [ d, [length(X{i}): i=1:r] ]  for 
%    d-vector-valued data. In this case of gridded data, the optional
%    argument M is either an integer or else an r-vector of integers 
%    (from the set  {1,2,3} ), and the optional argument W is expected
%    to be a cell array of length r with W{i} either empty (to get the
%    default choice) or else a vector of the same length as X{i}, i=1:r.
% 
%    For example, the statements
% 
%       w = ones(size(x)); w([1 end]) = 100;
%       sp = spaps(x,y,1.e-2,w,3);
% 
%    give a quintic smoothing spline approximation to the given data which
%    close-to-interpolates the first and last datum, while being within about
%    1.e-2 of the rest.
% 
%    

function spcol
%MATLAB Tour Partial Function Help:  spl_con
%
% SPCOL B-spline collocation matrix.
% 
%    SPCOL(KNOTS,K,TAU)  returns the matrix   (D^m(i)B_j(TAU_i)) , with B_j
%    the j-th B-spline of order K for the knot sequence KNOTS, TAU a
%    sequence of points, both assumed to be  n o n d e c r e a s i n g ,
%    and   m(i) := #{ j<i : TAU(j) = TAU(i) }.
% 
%    If one of the optional arguments is a string with the same first two
%    characters as 'slvblk', the matrix is returned in the almost block-
%    diagonal format (specialised for splines) required  by SLVBLK.m .
%    (For backward compatibility, this also happens if the fourth argument is
%    present and is not a string).
% 
%    If one of the optional arguments is a string with the same first two
%    characters as 'sparse', the matrix is returned as a sparse matrix.
% 
%    If one of the optional arguments is a string with the same first character
%    as 'noderiv', then multiplicities are ignored, i.e., m(i) := 1 for all i.
%    (For backward compatibility, this also happens if the fifth argument is
%    present and is not a string).
% 
%    The recurrence relations are used to generate the entries of the
%    matrix.
% 
%    For example, the statement
% 
%       x = linspace(t(1),t(end),101); c = spcol(t,3,x);
% 
%    provides, in c(:,j), a fine sequence of values of the j-th quadratic 
%    B-spline for the given knot sequence t .
% 
%    

function spcrv
%MATLAB Tour Partial Function Help:  spl_con
%
% SPCRV Spline curve by uniform subdivision.
% 
%    CURVE = SPCRV(X)  uses repeated midpoint knot insertion to generate a fine 
%    sequence of successive values CURVE(:,i) of the spline
% 
%    t |-->  sum  B(t-K/2;j,...,j+k)*X(j)  for  t  in  [K/2 .. n-K/2]
%             j
% 
%    from the input (d,n)-array X.  The insertion process stops
%    as soon as there are >= MAXPNT knots. The default for  K  is 4, and for
%    MAXKNT it is 100, but both can be explicitly supplied as optional 
%    arguments, as in
%    CURVE = SPCRV(X,K,MAXPNT)
% 
%    For example, with k equal to 3,
% 
%      c = spcrv([1 0;0 1;-1 0;0 -1; 1 0].',k); plot(c(1,:),c(2,:))
% 
%    plots three quarters of an approximate circle, while, with k=4, only
%    half an approximate circle is plotted.
% 
%    

function augknt
%MATLAB Tour Partial Function Help:  spl_con
%
% AUGKNT Augment knot sequence.
% 
%    AUGKNT(KNOTS,K) returns a nondecreasing and augmented knot 
%    sequence which has the first and last knot with exact multiplicity K .  
%    (This may actually shorten the knot sequence.)  
% 
%    [AUGKNOT,ADDL] = AUGKNT(KNOTS,K) also returns the number of knots
%    added on the left.  (This may be negative.)
% 
%    AUGKNOT = AUGKNT(KNOTS,K,MULTS) returns an augmented knot sequence
%    that, in addition, contains each interior knot MULTS times.  If
%    MULTS has exactly as many entries as there are interior knots,
%    then the j-th one (in the ordered sequence) will be repeated MULTS(j)
%    times.  Otherwise, the uniform multiplicity MULTS(1) is used, whose
%    default value is 1 .  If the sequence of interior knots in KNOTS is
%    *strictly* increasing, then this ensures that the splines of order K
%    with knot sequence AUGKNOT satisfy K-MULTS(j) smoothness conditions
%    across the j-th interior break, all j .
% 
%    For example, the statement
% 
%       ch = spapi(augknt(x,4,2), [x x], [y dy]);
% 
%    constructs the piecewise cubic Hermite interpolant, i.e., the function  s
%    in ch satisfies  s(x(i)) = y(i),  (Ds)(x(i)) = dy(i), all i (assuming 
%    that  x  is strictly increasing).
% 
%    

function aveknt
%MATLAB Tour Partial Function Help:  spl_con
%
% AVEKNT Knot averages.
% 
%    AVEKNT(T,K)  returns the averages of successive  K-1  knots, i.e., 
%    the points 
% 
%        TSTAR(i) = ( T_{i+1} + ... + T_{i+K-1} ) / (K-1)
% 
%    recommended as good interpolation point choices when interpolating
%    from  S_{K,T} .
% 
%    For example, with  k  and the increasing sequence  breaks  given,
%    the statements
% 
%       t = augknt(breaks,k); x = aveknt(t);
%       sp = spapi( t , x, sin(x) );
% 
%    provide a spline interpolant to the sine function on the interval
%    [breaks(1) .. breaks(end)] .
% 
%    

function brk2knt
%MATLAB Tour Partial Function Help:  spl_con
%
% BRK2KNT Breaks with multiplicities into knots.
% 
%    T = BRK2KNT(BREAKS,MULTS)
%    returns the sequence T in which, for each i, BREAKS(i) is repeated
%    MULTS(i) times. If BREAKS is strictly increasing, then T is the
%    knot sequence in which each BREAKS(i) occurs exactly MULTS(i) times.
% 
%    If MULTS is to be constant, then only that constant value need
%    be given.
% 
%    [T,INDEX] = BRK2KNT(BREAKS,MULTS)
%    also returns INDEX = [1 find(diff(T)>0)-1] . If all multiplicities are
%    positive, then, for all j, INDEX(j) is the first place in T at which
%    BREAKS(j) appears.
% 
%    For example,
% 
%       t = [1 1 2 2 2 3 4 5 5];  [xi,m] = knt2brk(t);  tt = brk2knt(xi,m);
% 
%    gives  [1 2 3 4 5]  for xi , [2 3 1 1 2] for m , and t for tt.
% 
%    

function knt2brk
%MATLAB Tour Partial Function Help:  spl_con
%
% KNT2BRK From knots to breaks and their multiplicities.
% 
%         [XI,M] = KNT2BRK(T)
% 
%    returns the increasing list XI of distinct entries of T along with their
%    multiplicities  M(i) := #{ j : T(j) = XI(i) }, i=1:length(XI) .
% 
%    For example, [xi,m] = knt2brk( [ 1 2 3 3 1 3] ) returns [1 2 3] for xi
%    and [2 1 3] for m .
% 
%    

function knt2mlt
%MATLAB Tour Partial Function Help:  spl_con
%
% KNT2MLT Knot multiplicities.
% 
%    KNT2MLT(T) returns the vector M of knot multiplicities. Precisely,
% 
%    M(i) = # { j<i : T(j) = T(i) },  i=1:length(T),
% 
%    with T here first sorted if the input is not.
% 
%    [M,T] = KNT2MLT(T) also returns the sorted knot sequence.
% 
%    For example, [m,t] = knt2mlt([ 1 2 3 3 1 3]) returns 
%    [0 1 0 0 1 2] for m and [1 1 2 3 3 3] for t.
% 
%    

function newknt
%MATLAB Tour Partial Function Help:  spl_con
%
% NEWKNT New break distribution.
% 
%    [NEWBRK,DISTFN] = NEWKNT(F,NEWL)
% 
%    returns the break sequence NEWBRK which cuts the basic
%    interval for F into NEWL pieces in such a way that a certain
%    p.linear monotone function (whose ppform is in DISTFN) related
%    to the high derivative of F is equidistributed.
% 
%    The intent is to choose a break sequence suitable to the fine
%    approximation of a function  g  whose rough approximation in F
%    is assumed to contain enough information about  g  to make this
%    feasible.
% 
%    For example, after obtaining the least-squares approximation to given
%    data X,Y by splines of order K with M-1 equally spaced interior knots via
% 
%       sp = spap2(augknt(linspace(X(1),X(end),M+1),K),K,X,Y);
% 
%    one could hope for a better approximation by
% 
%       sp = spap2(augknt(newknt(sp,M),K),K,X,Y);
% 
%    

function optknt
%MATLAB Tour Partial Function Help:  spl_con
%
% OPTKNT Optimal knot distribution.
% 
%    OPTKNT(TAU,K)  returns the (interior) optimal knots (according to the 
%    optimal recovery theory of Micchelli/Rivlin/Winograd and Gaffney/Powell)
%    for interpolation at data points TAU(1), ..., TAU(n) by splines
%    of order K.
% 
%    These are the  n-K  sign-changes in the absolutely constant
%    function  h  that satisfies
% 
%           integral{ f(x)h(x) : TAU(1) < x < TAU(n) } = 0
% 
%    for all splines  f  of order K with knot sequence TAU.
% 
%    For example, Micchelli/Rivlin/Winograd and Gaffney/Powell would 
%    approve of the following way of constructing a spline interpolant
%    of order k to given data  x, y :
% 
%       sp = spapi(augknt([x([1 end]) optknt(x,k)],k),x,y);
% 
%    

function sorted
%MATLAB Tour Partial Function Help:  spl_con
%
% SORTED Locate points with respect to meshpoints.
% 
%    Given sequences MESHPOINTS and POINTS, returns the index sequence
%    POINTER  (a  r o w  vector)  for which
% 
%    POINTER(j) = #{ i : MESHPOINTS(i)  <=  sort(POINTS)(j) },  all  j .
% 
%    Thus, if both MESHPOINTS and POINTS are nondecreasing, then
% 
%    MESHPOINTS(POINTER(j))  <= POINTS(j) < MESHPOINTS(POINTER(j)+1) ,
% 
%    with the obvious interpretations when  POINTER(j) = 0  or
%    POINTER(j)+1 = length(MESHPOINTS) + 1 .
% 
%    For example, if [1 2 3 4] is MESHPOINTS and [0 1 2.1 2.99 3.5 4 5] is
%    POINTS, then [0 1 2 2 3 4 4] is the output.
% 
%    

function slvblk
%MATLAB Tour Partial Function Help:  spl_con
%
% SLVBLK Solve almost block-diagonal linear system.
% 
%    SLVBLK(BLOKMAT,B)  returns the solution (if any) of the linear system  
%    A*X=B, with the matrix A stored in BLOKMAT in the spline almost block
%    diagonal form (as generated, e.g., in SPCOL).
% 
%    If the system is overdetermined (i.e., has more equations than
%    unknowns), the least-squares solution is returned.  In that case, it
%    may be useful to use the optional third argument, i.e., to use the
%    following:
% 
%    SLVBLK(BLOKMAT,B,W)  returns the vector X that minimizes the 
%    w e i g h t e d  l_2 sum
% 
%       sum_j W(j)*( (A*X-B)(j) )^2 .
% 
%    The default for W is the sequence [1,1,1,...].
% 
%    

function bkbrk
%MATLAB Tour Partial Function Help:  spl_con
%
% BKBRK Part(s) of an almost block-diagonal matrix.
% 
%    [NB,ROWS,NCOLS,LAST,BLOCKS] = BKBRK(BLOKMAT)
% 
%    returns the details of the almost block diagonal matrix contained
%    in BLOKMAT, with ROWS and LAST NB-vectors, and BLOCKS a matrix
%    of size  SUM(ROWS)-by-NCOLS.
% 
%    BKBRK(BLOKMAT)
% 
%    returns nothing, but all parts are printed.
% 
%    

function spdemos
%MATLAB Tour Partial Function Help:  spl_con
%
% SPDEMOS List of spline toolbox demonstrations.
% 
%                1) some simple examples
% 
%                2) piecewise polynomials, form and usage
%                3) splines, form and usage
%                4) some B-splines
%                5) cubic spline interpolation
%                6) spline interpolation
%                7) cubic smoothing spline
%                8) choice of knots
%                9) make a curve
%               10) spline curves
%               11) a simple nonlinear ordinary differential equation
%               12) construction of the Chebyshev spline
%               13) bivariate approximation by tensor products
% 
%                0) quit

function splexmpl
%MATLAB Tour Partial Function Help:  spl_con
%
% SPLEXMPL This is a slideshow file for use with playshow.m and makeshow.m
%    To see it run, type 'playshow splexmpl', 

function spalldm2
%MATLAB Tour Partial Function Help:  spl_con
%
% SPALLDM2  An Introduction to the B-form
%    This is a slideshow file for use with playshow.m and makeshow.m
%    To see it run, type 'playshow spalldm2'

function ppalldm2
%MATLAB Tour Partial Function Help:  spl_con
%
% PPALLDM2 This is a slideshow file for use with playshow.m and makeshow.m
%    To see it run, type 'playshow ppalldm2', 

function bspline
%MATLAB Tour Partial Function Help:  spl_con
%
% BSPLINE Plots a B-spline and its polynomial pieces.
% 
%    BSPLINE(T)  plots the B-spline with knot sequence T as well as the 
%    polynomial pieces of which it is composed.
% 
%    BSLINE(T,WINDOW) does the plotting in the WINDOW specified, then PAUSEs.
% 
%    PP = BSPLINE(T) plots nothing, but returns the ppform of the specified
%    B-spline.
% 
%    

function bsplidem
%MATLAB Tour Partial Function Help:  spl_con
%
% BSPLIDEM Show some B-splines.

function pckkntdm
%MATLAB Tour Partial Function Help:  spl_con
%
% PCKKNTDM Knot choices demo.

function csapidem
%MATLAB Tour Partial Function Help:  spl_con
%
% CSAPIDEM Cubic spline interpolation demo.

function csapsdem
%MATLAB Tour Partial Function Help:  spl_con
%
% CSAPSDEM Cubic smoothing spline demo.

function chebdem
%MATLAB Tour Partial Function Help:  spl_con
%
% CHEBDEM equioscillating spline demo.

function difeqdem
%MATLAB Tour Partial Function Help:  spl_con
%
% DIFEQDEM singularly perturbed ODE solved by collocation at Gauss points

function spcrvdem
%MATLAB Tour Partial Function Help:  spl_con
%
% SPCRVDEM Spline curve demo.

function tspdem
%MATLAB Tour Partial Function Help:  spl_con
%
% TSPDEM Demo of bivariate tensor product spline work.

function franke
%MATLAB Tour Partial Function Help:  spl_con
%
% FRANKE Franke's bivariate test function.
% 
%    FRANKE(X,Y)  returns the values  f(X,Y)  of Franke's test function; cf.
%    Richard Franke, A critical comparison of some methods for
%    interpolation of scattered data, Naval Postgraduate School
%    Tech.Rep.  NPS-53-79-003, March 1979.
% 
%    VALUES has the same size as X and Y.

function subplus
%MATLAB Tour Partial Function Help:  spl_con
%
% SUBPLUS Positive part.
% 
%                                   x , if  x>=0
%    y  = subplus(x) := (x)_{+}  =               ,
%                                   0 , if  x<=0
% 
%   returns the positive part of X. Used for computing truncated powers.

function titanium
%MATLAB Tour Partial Function Help:  spl_con
%
% TITANIUM Test data.
% 
%    [X,Y] = TITANIUM
% 
%    returns the data points of the Titanium Heat data which give a
%    certain property of titanium as a function of temperature and
%    which have been used extensively as test data for fitting by
%    splines with variable knots.

function chebloop
%MATLAB Tour Partial Function Help:  spl_con
%
% CHEBLOOP Used in chebdem.

function difeqite
%MATLAB Tour Partial Function Help:  spl_con
%
% DIFEQITE Used in difeqdem.

function difeqset
%MATLAB Tour Partial Function Help:  spl_con
%
% DIFEQSET Used in difeqdem.

function splpp
%MATLAB Tour Partial Function Help:  spl_con
%
% SPLPP Left Taylor coefficients from local B-coefficients.
% 
%    [V,B] = SPLPP(TX,A)
% 
%    uses knot insertion to derive from the B-spline coefficients
%    A(.,:) relevant for the interval [TX(.,k-1) .. TX(.,k)]  (with
%    respect to the knot sequence TX(.,1:2k-2) )  the B-spline
%    coefficients B(.,1:k) relevant for the interval  [TX(.,k-1) .. 0]
%    (with respect to the knot sequence [TX(.,1:k-1),0,...,0] ), with
%    [ ,k]:=size(A) .
% 
%    It is assumed that  TX(.,k-1) < 0 <= TX(.,k) .
% 
%    From this, computes V(j) := D^{k-j}s(0-)/(k-j)!  , j=1,...,k ,
%    with  s  the spline described by the given knots and coefficients.
% 
%    

function sprpp
%MATLAB Tour Partial Function Help:  spl_con
%
% SPRPP Right Taylor coefficients from local B-coefficients.
% 
%    [V,B] = SPRPP(TX,A)
% 
%    uses knot insertion to derive from the B-spline coefficients
%    A(.,:) relevant for the interval  [TX(.,k-1) .. TX(.,k)]  (with
%    respect to the knot sequence  TX(.,1:2k-2) )  the polynomial
%    coefficients V(.,1:k) relevant for the interval  [0 .. TX(.,k)] .
%    Here,    [ ,k] := size(A) .
%    Also, it is assumed that  TX(.,k-1) <= 0 < TX(.,k) .
% 
%    In the process, uses repeated insertion of  0  to derive, in
%    B(.,1:k) , the B-spline coefficients relevant for the interval
%    [0 .. TX(.,k)]  (with respect to the knot sequence
%    [0,...,0,TX(.,k:2*(k-1))]) .
% 
%    

