This is a static copy of a profile reportHome
spap2>spap21 (404 calls, 2.253 sec)
Generated 05-Nov-2014 07:52:38 using cpu time.
subfunction in file /usr1/opt/matlab/7.13/toolbox/curvefit/splines/spap2.m
Copy to new window for comparing multiple runs
Parents (calling functions)
Function Name | Function Type | Calls |
spap2 | function | 404 |
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
175 | sp = spmak(knots,slvblk(spcol(... | 202 | 1.302 s | 57.8% |  |
173 | sp = spmak(knots,slvblk(spcol(... | 202 | 0.491 s | 21.8% |  |
162 | knots = aptknt(x(round(linspac... | 404 | 0.240 s | 10.7% |  |
146 | if isempty(w), [x,y,sizeval] ... | 404 | 0.120 s | 5.3% |  |
147 | else [x,y,sizeval,w]... | 202 | 0.090 s | 4.0% |  |
All other lines | | | 0.010 s | 0.4% |  |
Totals | | | 2.253 s | 100% | |
Children (called functions)
Function Name | Function Type | Calls | Total Time | % Time | Time Plot |
slvblk | function | 404 | 1.112 s | 49.3% |  |
spcol | function | 404 | 0.501 s | 22.2% |  |
aptknt | function | 404 | 0.190 s | 8.4% |  |
chckxywp | function | 404 | 0.180 s | 8.0% |  |
spmak | function | 404 | 0.170 s | 7.6% |  |
linspace | function | 404 | 0 s | 0% |  |
Self time (built-ins, overhead, etc.) | | | 0.100 s | 4.4% |  |
Totals | | | 2.253 s | 100% | |
Code Analyzer results
Line number | Message |
178 | FINDSTR will be removed in a future release. Use STRFIND instead. |
Coverage results
[ Show coverage for parent directory ]
Total lines in function | 42 |
Non-code lines (comments, blank lines) | 10 |
Code lines (lines that can run) | 32 |
Code lines that did run | 19 |
Code lines that did not run | 13 |
Coverage (did run/can run) | 59.38 % |
Function listing
time calls line
143 function sp = spap21(knots,k,x,y,w)
144 %SPAP21 Univariate least squares spline approximation.
145
0.12 404 146 if isempty(w), [x,y,sizeval] = chckxywp(x,y,1);
0.09 202 147 else [x,y,sizeval,w] = chckxywp(x,y,1,w);
202 148 end
404 149 nx = length(x);
150
404 151 if length(knots)==1 % we are to use a spline with KNOTS pieces
404 152 k = min(k,nx); maxpieces = nx-k+1;
0.01 404 153 if knots<1||knots>maxpieces
154 warning(message('SPLINES:SPAP2:wrongknotnumber', sprintf( '%g', maxpieces )))
155 knots = max(1,min(maxpieces,knots));
156 end
404 157 if knots==1&&k==1
158 if nx==1, knots = [x(1) x(1)+1];
159 else knots = x([1 end]).';
160 end
404 161 else
0.24 404 162 knots = aptknt(x(round(linspace(1,nx,knots-1+k))),k);
404 163 end
404 164 end
165
166 % Generate the collocation matrix and divide it into the possibly reordered
167 % sequence of given values to generate the B-spline coefficients of the
168 % interpolant, then put it all together into SP. But trap any error from
169 % SLVBLK, in order to provide a more helpful error message.
170
404 171 try
404 172 if isempty(w)
0.49 202 173 sp = spmak(knots,slvblk(spcol(knots,k,x,'slvblk','noderiv'),y).');
202 174 else
1.30 202 175 sp = spmak(knots,slvblk(spcol(knots,k,x,'slvblk','noderiv'),y,w).');
202 176 end
177 catch laster
178 if ~isempty(findstr('SLVBLK',laster.identifier))
179 error(message('SPLINES:SPAP2:noSWconds'))
180 else
181 rethrow(laster.message)
182 end
183 end
404 184 if length(sizeval)>1, sp = fnchg(sp,'dz',sizeval); end