This is a static copy of a profile reportHome
cond (1721 calls, 0.160 sec)
Generated 05-Nov-2014 07:53:01 using cpu time.
function in file /usr1/opt/matlab/7.13/toolbox/matlab/matfun/cond.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 |
42 | else | 1721 | 0.030 s | 18.8% |  |
40 | if any(s == 0) % Handle sing... | 1721 | 0.030 s | 18.8% |  |
43 | c = max(s)./min(s); | 1721 | 0.020 s | 12.5% |  |
39 | s = svd(A); | 1721 | 0.020 s | 12.5% |  |
44 | end | 1721 | 0.010 s | 6.2% |  |
All other lines | | | 0.050 s | 31.3% |  |
Totals | | | 0.160 s | 100% | |
Children (called functions)
No childrenCode Analyzer results
No Code Analyzer messages.Coverage results
[ Show coverage for parent directory ]
Total lines in function | 48 |
Non-code lines (comments, blank lines) | 24 |
Code lines (lines that can run) | 24 |
Code lines that did run | 11 |
Code lines that did not run | 13 |
Coverage (did run/can run) | 45.83 % |
Function listing
time calls line
1 function c = cond(A, p)
2 %COND Condition number with respect to inversion.
3 % COND(X) returns the 2-norm condition number (the ratio of the
4 % largest singular value of X to the smallest). Large condition
5 % numbers indicate a nearly singular matrix.
6 %
7 % COND(X,P) returns the condition number of X in P-norm:
8 %
9 % NORM(X,P) * NORM(INV(X),P).
10 %
11 % where P = 1, 2, inf, or 'fro'.
12 %
13 % Class support for input X:
14 % float: double, single
15 %
16 % See also RCOND, CONDEST, CONDEIG, NORM, NORMEST.
17
18 % Copyright 1984-2010 The MathWorks, Inc.
19 % $Revision: 5.15.4.4 $ $Date: 2010/08/23 23:11:19 $
20
1721 21 if nargin == 1, p = 2; end
22
0.01 1721 23 if isempty(A)
24 c = zeros(class(A));
25 return
26 end
1721 27 if issparse(A)
28 warning(message('MATLAB:cond:SparseNotSupported'))
29 c = condest(A);
30 return
31 end
32
0.01 1721 33 [m, n] = size(A);
0.01 1721 34 if m ~= n && ~isequal(p,2)
35 error(message('MATLAB:cond:normMismatchSizeA'))
36 end
37
1721 38 if p == 2
0.02 1721 39 s = svd(A);
0.03 1721 40 if any(s == 0) % Handle singular matrix
41 c = Inf(class(A));
0.03 1721 42 else
0.02 1721 43 c = max(s)./min(s);
0.01 1721 44 end
45 else
46 % We'll let NORM pick up any invalid p argument.
47 c = norm(A, p) * norm(inv(A), p);
48 end