This is a static copy of a profile report

Home

ppbrk (1 call, 0.000 sec)
Generated 05-Nov-2014 07:53:55 using cpu time.
function in file /usr1/opt/matlab/7.13/toolbox/curvefit/splines/ppbrk.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
ppualfunction1
Lines where the most time was spent
No measurable time spent in this function

Line NumberCodeCallsTotal Time% TimeTime Plot
149
end
10 s0%
148
end
10 s0%
147
varargout = {pp.breaks, pp.coe...
10 s0%
146
else
10 s0%
134
if nargout==0
10 s0%
All other lines  0 s0%
Totals  0 s0% 
Children (called functions)
No children
Code Analyzer results
Line numberMessage
70IF might not be aligned with its matching END (line 72).
Coverage results
[ Show coverage for parent directory ]
Total lines in function149
Non-code lines (comments, blank lines)57
Code lines (lines that can run)92
Code lines that did run9
Code lines that did not run83
Coverage (did run/can run)9.78 %
Function listing
   time   calls  line
1 function varargout = ppbrk(pp,varargin)
2 %PPBRK Part(s) of a ppform.
3 %
4 % [BREAKS,COEFS,L,K,D] = PPBRK(PP) breaks the ppform in PP into its parts
5 % and returns as many of them as are specified by the output arguments.
6 %
7 % PPBRK(PP) returns nothing, but prints all parts.
8 %
9 % OUT1 = PPBRK(PP,PART) returns the particular part specified by the string
10 % PART, which may be (the beginning character(s) of) one of the following
11 % strings:
12 % 'breaks', 'coefs', 'pieces' or 'l', 'order', 'dim', 'interval'.
13 % For a while, there is also the choice
14 % 'guide'
15 % that returns the coefficient array in the form required in the ppform used
16 % in `A Practical Guide to Splines', especially for PPVALU there. This is not
17 % available for vector-valued and/or tensor product splines.
18 %
19 % PJ = PPBRK(PP,J) returns the ppform of the J-th polynomial piece of the
20 % function in PP.
21 %
22 % PC = PPBRK(PP,[A B]) returns the restriction/extension of the function
23 % in PP to the interval [A .. B], with [] causing PP to be returned as is.
24 %
25 % If PP contains an m-variate spline and PART is not a string, then it
26 % must be a cell-array, of length m .
27 %
28 % [OUT1,...,OUTo] = PPBRK(PP, PART1,...,PARTi) returns in OUTj the part
29 % specified by the string PARTj, j=1:o, provided o<=i.
30 %
31 % Example: If PP contains a bivariate spline with at least 4 pieces
32 % in the first variable, then
33 %
34 % ppp = ppbrk(pp,{4,[-1 1]});
35 %
36 % gives the bivariate spline that agrees with the given one on the
37 % rectangle [pp.breaks{1}(4) .. [pp.breaks{1}(5)] x [-1 1] .
38 %
39 % See also SPBRK, FNBRK.
40
41 % Copyright 1987-2010 The MathWorks, Inc.
42 % $Revision: 1.1.6.4 $
43
1 44 if ~isstruct(pp)
45 if pp(1)~=10
46 error(message('SPLINES:PPBRK:unknownfn'))
47 else
48 ppi = pp;
49 di=ppi(2); li=ppi(3); ki=ppi(5+li);
50
51 pp = struct('breaks',reshape(ppi(3+(1:li+1)),1,li+1), ...
52 'coefs',reshape(ppi(5+li+(1:di*li*ki)),di*li,ki), ...
53 'form','pp', 'dim',di, 'pieces',li, 'order',ki);
54 end
55 end
56
1 57 if ~strcmp(pp.form,'pp')
58 error(message('SPLINES:PPBRK:notpp'))
59 end
1 60 if nargin>1 % we have to hand back one or more parts
61 np = max(1,nargout);
62 if np>length(varargin)
63 error(message('SPLINES:PPBRK:moreoutthanin'))
64 end
65 varargout = cell(1,np);
66 for jp=1:np
67 part = varargin{jp};
68
69 if ischar(part)
70 if isempty(part)
71 error(message('SPLINES:PPBRK:partemptystr'))
72 end
73 switch part(1)
74 case 'f', out1 = [pp.form,'form'];
75 case 'd', out1 = pp.dim;
76 case {'l','p'}, out1 = pp.pieces;
77 case 'b', out1 = pp.breaks;
78 case 'o', out1 = pp.order;
79 case 'c', out1 = pp.coefs;
80 case 'v', out1 = length(pp.order);
81 case 'g', % if the spline is univariate, scalar-valued,
82 % return the coefs in the form needed in the ppform
83 % used in PGS.
84 if length(pp.dim)>1||pp.dim>1||iscell(pp.order)
85 error(message('SPLINES:PPBRK:onlyuniscalar', part))
86 else
87 k = pp.order;
88 out1 = (pp.coefs(:,k:-1:1).').* ...
89 repmat(cumprod([1 1:k-1].'),1,pp.pieces);
90 end
91 case 'i'
92 if iscell(pp.breaks)
93 for i=length(pp.order):-1:1
94 out1{i} = pp.breaks{i}([1 end]); end
95 else
96 out1 = pp.breaks([1 end]);
97 end
98 otherwise
99 error(message('SPLINES:PPBRK:unknownpart', part))
100 end
101 elseif isempty(part)
102 out1 = pp;
103 else % we are to restrict PP to some interval or piece
104 sizeval = pp.dim; if length(sizeval)>1, pp.dim = prod(sizeval); end
105 if iscell(part) % we are dealing with a tensor-product spline
106
107 [breaks,c,l,k,d] = ppbrk(pp); m = length(breaks);
108 sizec = [d,l.*k]; %size(c);
109 if length(sizec)~=m+1
110 error(message('SPLINES:PPBRK:inconsistentfn')),
111 end
112 for i=m:-1:1
113 dd = prod(sizec(1:m));
114 ppi = ppbrk1(ppmak(breaks{i},reshape(c,dd*l(i),k(i)),dd),...
115 part{i}) ;
116 breaks{i} = ppi.breaks; sizec(m+1) = ppi.pieces*k(i);
117 c = reshape(ppi.coefs,sizec);
118 if m>1
119 c = permute(c,[1,m+1,2:m]);
120 sizec(2:m+1) = sizec([m+1,2:m]);
121 end
122 end
123 out1 = ppmak(breaks,c, sizec);
124
125 else % we are dealing with a univariate spline
126
127 out1 = ppbrk1(pp,part);
128 end
129 if length(sizeval)>1, out1 = fnchg(out1,'dz',sizeval); end
130 end
131 varargout{jp} = out1;
132 end
1 133 else
1 134 if nargout==0
135 if iscell(pp.breaks) % we have a multivariate spline and, at present,
136 % I can't think of anything clever to do; so...
137 disp(pp)
138 else
139 disp('breaks(1:l+1)'), disp(pp.breaks)
140 disp('coefficients(d*l,k)'), disp(pp.coefs)
141 disp('pieces number l'), disp(pp.pieces)
142 disp('order k'), disp(pp.order)
143 disp('dimension d of target'),disp(pp.dim)
144 % disp('dimension v of domain'),disp(length(pp.order))
145 end
1 146 else
1 147 varargout = {pp.breaks, pp.coefs, pp.pieces, pp.order, pp.dim};
1 148 end
1 149 end

Other subfunctions in this file are not included in this listing.