This is a static copy of a profile report

Home

spmak>chckknt (608 calls, 0.090 sec)
Generated 05-Nov-2014 07:53:25 using cpu time.
subfunction in file /usr1/opt/matlab/7.13/toolbox/curvefit/splines/spmak.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
spmakfunction608
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
94
if knots{j}(1)==knots{j}(end)
8100.030 s33.3%
101
index = find(knots{j}(k(j)+(1:...
8100.020 s22.2%
109
end
8100.010 s11.1%
89
n = sizec(j+1); k(j) = length(...
8100.010 s11.1%
102
if length(index)<n
8100 s0%
All other lines  0.020 s22.2%
Totals  0.090 s100% 
Children (called functions)
No children
Code Analyzer results
Line numberMessage
89The variable 'k' appears to change size on every loop iteration. Consider preallocating for speed.
Coverage results
[ Show coverage for parent directory ]
Total lines in function25
Non-code lines (comments, blank lines)7
Code lines (lines that can run)18
Code lines that did run9
Code lines that did not run9
Coverage (did run/can run)50.00 %
Function listing
   time   calls  line
85 function [knots,coefs,k,sizec] = chckknt(knots,coefs,sizec)
86 %CHCKKNT check knots, omit trivial B-splines
87
608 88 for j=1:length(sizec)-1
0.01 810 89 n = sizec(j+1); k(j) = length(knots{j})-n;
810 90 if k(j)<=0, error(message('SPLINES:SPMAK:knotsdontmatchcoefs')), end
810 91 if any(diff(knots{j})<0)
92 error(message('SPLINES:SPMAK:knotdecreasing'))
93 end
0.03 810 94 if knots{j}(1)==knots{j}(end)
95 error(message('SPLINES:SPMAK:extremeknotssame'))
96 end
97
98 % make sure knot sequence is a row matrix:
810 99 knots{j} = reshape(knots{j},1,n+k(j));
100 % throw out trivial B-splines:
0.02 810 101 index = find(knots{j}(k(j)+(1:n))-knots{j}(1:n)>0);
810 102 if length(index)<n
103 oldn = n; n = length(index);
104 knots{j} = reshape(knots{j}([index oldn+(1:k(j))]),1,n+k(j));
105 coefs = ...
106 reshape(coefs, [prod(sizec(1:j)),sizec(j+1),prod(sizec(j+2:end))]);
107 sizec(j+1) = n; coefs = reshape(coefs(:,index,:),sizec);
108 end
0.01 810 109 end