This is a static copy of a profile reportHome
fnval (1 call, 0.100 sec)
Generated 05-Nov-2014 07:53:55 using cpu time.
function in file /usr1/opt/matlab/7.13/toolbox/curvefit/splines/fnval.m
Copy to new window for comparing multiple runs
Parents (calling functions)
Lines where the most time was spent
Line Number | Code | Calls | Total Time | % Time | Time Plot |
96 | v = reshape(feval(ff,f,varargi... | 1 | 0.090 s | 90.0% |  |
58 | [m, sizeval] = fnbrk(f,'var','... | 1 | 0.010 s | 10.0% |  |
88 | case 'B', ff = @spval; | 1 | 0 s | 0% |  |
87 | switch f.form(1) | 1 | 0 s | 0% |  |
85 | end | 1 | 0 s | 0% |  |
All other lines | | | 0 s | 0% |  |
Totals | | | 0.100 s | 100% | |
Children (called functions)
Function Name | Function Type | Calls | Total Time | % Time | Time Plot |
spval | function | 1 | 0.090 s | 90.0% |  |
fnbrk | function | 1 | 0.010 s | 10.0% |  |
Self time (built-ins, overhead, etc.) | | | 0 s | 0% |  |
Totals | | | 0.100 s | 100% | |
Code Analyzer results
Line number | Message |
59 | Best practice is for CATCH to be followed by an identifier that gets the error information. |
71 | IF might not be aligned with its matching END (line 73). |
Coverage results
[ Show coverage for parent directory ]
Total lines in function | 96 |
Non-code lines (comments, blank lines) | 52 |
Code lines (lines that can run) | 44 |
Code lines that did run | 17 |
Code lines that did not run | 27 |
Coverage (did run/can run) | 38.64 % |
Function listing
time calls line
1 function v = fnval(f,varargin)
2 %FNVAL Evaluate a function.
3 %
4 % V = FNVAL(F,X) or FNVAL(X,F) provides the value at the points
5 % in X of the function described by F .
6 %
7 % Roughly speaking, V is obtained by replacing each entry of X by the
8 % value of f there. This is exactly true in case f is scalar-valued
9 % and univariate, and is the intent in all other cases, except that, for a
10 % d-valued m-variate function, this means replacing m-vectors by d-vectors.
11 % The full details follow.
12 %
13 % For a univariate f :
14 % If f is scalar-valued, then V is of the same size as X.
15 % If f is [d1,...,dr]-valued, and X has size [n1,...,ns], then V has size
16 % [d1,...,dr, n1,...,ns], with V(:,...,:, j1,...,js) the value of f at
17 % X(j1,...,js), -- except that
18 % (1) n1 is ignored if it is 1 and s is 2, i.e., if X is a row vector; and
19 % (2) MATLAB ignores any trailing singleton dimensions of X.
20 %
21 % For an m-variate f with m>1 , with f [d1,...,dr]-valued, X may be
22 % either an array, or else a cell array {X1,...,Xm}.
23 % If X is an array, of size [n1,...,ns] say, then n1 must equal m, and V has
24 % size [d1,...,dr, n2,...,ns], with V(:,...,:, j2,...,js) the value of f
25 % at X(:,j2,...,js), -- except that
26 % (1) d1, ..., dr is ignored in case f is scalar-valued, i.e., r==1==d1;
27 % (2) MATLAB ignores any trailing singleton dimensions of X.
28 % If X is a cell array, then it must be of the form {X1,...,Xm}, with Xj
29 % a vector, of length nj, and, in that case, V has size
30 % [d1,...,dr, n1,...,nm], with V(:,...,:, j1,...,jm) the value of f
31 % at (X1(j1), ..., Xm(jm)), -- except that
32 % d1, ..., dr is ignored in case f is scalar-valued, i.e., r==1==d1.
33 %
34 % By agreement, all piecewise polynomial functions in this toolbox are
35 % continuous from the right. But FNVAL can be made to treat them as
36 % continuous from the left by calling it with an optional third argument,
37 % as follows.
38 %
39 % FNVAL(F,X,LEFT) or FNVAL(X,F,LEFT) takes the function to be
40 % left-continuous if LEFT is a string that begins with 'l'.
41 % If the function is m-variate and LEFT is an m-cell, then continuity
42 % from the left is enforced in the i-th variable if LEFT{i}(1) is 'l'.
43 %
44 % See also PPUAL, RSVAL, SPVAL, STVAL, PPVAL.
45
46 % Copyright 1987-2010 The MathWorks, Inc.
47 % $Revision: 1.1.6.4 $
48
1 49 if ~isstruct(f)
50 if isstruct(varargin{1})
51 temp = f; f = varargin{1}; varargin{1} = temp;
52 else
53 f = fn2fm(f);
54 end
55 end
56
1 57 try
0.01 1 58 [m, sizeval] = fnbrk(f,'var','dim');
59 catch
60 error(message('SPLINES:FNVAL:unknownform', f.form))
61 end
62 % record, then adjust, size of site array and of function values.
1 63 sizex = size(varargin{1});
1 64 if ~iscell(varargin{1})
1 65 if m>1
1 66 if sizex(1)~=m
67 error(message('SPLINES:FNVAL:wrongsizex', num2str( m )))
68 end
1 69 sizex(1) = [];
1 70 end
1 71 if length(sizex)>2
72 varargin{1} = reshape(varargin{1},sizex(1),prod(sizex(2:end)));
1 73 elseif length(sizex)==2&&sizex(1)==1, sizex = sizex(2); end
74 else
75 if sizex(2)~=m
76 if sizex(2)==1&&sizex(1)==m, varargin{1}=varargin{1}.';
77 else
78 error(message('SPLINES:FNVAL:wrongsizecellx', num2str( m )))
79 end
80 end
81 sizex = cellfun('length',varargin{1});
82 end
1 83 if length(sizeval)>1, f = fnchg(f,'dz',prod(sizeval));
1 84 else if sizeval==1&&length(sizex)>1; sizeval = []; end
1 85 end
86
1 87 switch f.form(1)
1 88 case 'B', ff = @spval;
89 case 'p', ff = @ppual;
90 case 'r', ff = @rsval;
91 case 's', ff = @stval;
92 otherwise
93 error(message('SPLINES:FNVAL:unknownfn'))
94 end
95
0.09 1 96 v = reshape(feval(ff,f,varargin{:}),[sizeval,sizex]);