This is a static copy of a profile report

Home

condest (240 calls, 0.164 sec)
Generated 05-Aug-2011 13:03:33 using cpu time.
function in file /usr/local/MATLAB/R2011a/toolbox/matlab/matfun/condest.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
polyfit>warnIfLargeConditionNumbersubfunction240
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
66
[Ainv_norm, ~, v] = normest1(@...
2400.077 s46.7%
85
end
2400.022 s13.3%
54
temp = onCleanup(@()warning(wa...
2400.022 s13.3%
67
A_norm = norm(A,1);
2400.011 s6.7%
53
warns = warning('query','all')...
2400.011 s6.7%
All other lines  0.022 s13.3%
Totals  0.164 s100% 
Children (called functions)

Function NameFunction TypeCallsTotal Time% TimeTime Plot
normest1function2400.066 s40.0%
onCleanup>onCleanup.onCleanupsubfunction2400.011 s6.7%
onCleanup>onCleanup.deletesubfunction2400 s0%
condest>create@()warning(warns)anonymous function2400 s0%
Self time (built-ins, overhead, etc.)  0.087 s53.3%
Totals  0.164 s100% 
Code Analyzer results
No Code Analyzer messages.
Coverage results
[ Show coverage for parent directory ]
Total lines in function85
Non-code lines (comments, blank lines)55
Code lines (lines that can run)30
Code lines that did run19
Code lines that did not run11
Coverage (did run/can run)63.33 %
Function listing
   time   calls  line
1 function [c, v] = condest(A,t)
2 %CONDEST 1-norm condition number estimate.
3 % C = CONDEST(A) computes a lower bound C for the 1-norm condition
4 % number of a square matrix A.
5 %
6 % C = CONDEST(A,T) changes T, a positive integer parameter equal to
7 % the number of columns in an underlying iteration matrix. Increasing the
8 % number of columns usually gives a better condition estimate but increases
9 % the cost. The default is T = 2, which almost always gives an estimate
10 % correct to within a factor 2.
11 %
12 % [C,V] = CONDEST(A) also computes a vector V which is an approximate null
13 % vector if C is large. V satisfies NORM(A*V,1) = NORM(A,1)*NORM(V,1)/C.
14 %
15 % Note: CONDEST invokes RAND. If repeatable results are required, then
16 % see RAND for details on how to set the default stream state.
17 %
18 % CONDEST is based on the 1-norm condition estimator of Hager [1] and a
19 % block oriented generalization of Hager's estimator given by Higham and
20 % Tisseur [2]. The heart of the algorithm involves an iterative search
21 % to estimate ||A^{-1}||_1 without computing A^{-1}. This is posed as the
22 % convex, but nondifferentiable, optimization problem:
23 %
24 % max ||A^{-1}x||_1 subject to ||x||_1 = 1.
25 %
26 % See also NORMEST1, COND, NORM, RAND.
27
28 % Reference:
29 % [1] William W. Hager, Condition estimates,
30 % SIAM J. Sci. Stat. Comput. 5, 1984, 311-316, 1984.
31 %
32 % [2] Nicholas J. Higham and Fran\c{c}oise Tisseur,
33 % A Block Algorithm for Matrix 1-Norm Estimation
34 % with an Application to 1-Norm Pseudospectra,
35 % SIAM J. Matrix Anal. App. 21, 1185-1201, 2000.
36 %
37 % Nicholas J. Higham
38 % Copyright 1984-2010 The MathWorks, Inc.
39 % $Revision: 5.18.4.6 $ $Date: 2010/11/22 02:46:32 $
40
240 41 if size(A,1) ~= size(A,2)
42 error(message('MATLAB:condest:NonSquareMatrix'))
43 end
240 44 if isempty(A), c = 0; v = []; return, end
240 45 if nargin < 2, t = []; end
46
240 47 if issparse(A)
48 [L,U,~,~] = lu(A,'vector');
240 49 else
240 50 [L,U,~] = lu(A,'vector');
240 51 end
240 52 k = find(abs(diag(U))==0);
0.01 240 53 warns = warning('query','all');
0.02 240 54 temp = onCleanup(@()warning(warns));
240 55 warning('off','all');
240 56 if ~isempty(k)
57 c = Inf;
58 n = length(A);
59 v = zeros(n,1);
60 k = min(k);
61 v(k) = 1;
62 if k > 1
63 v(1:k-1) = -U(1:k-1,1:k-1)\U(1:k-1,k);
64 end
240 65 else
0.08 240 66 [Ainv_norm, ~, v] = normest1(@condestf,t);
0.01 240 67 A_norm = norm(A,1);
240 68 c = Ainv_norm*A_norm;
240 69 end
240 70 v = v/norm(v,1);
71
72 function f = condestf(flag, X)
73 %CONDESTF Function used by CONDEST.
74 if isequal(flag,'dim')
75 f = max(size(L));
76 elseif isequal(flag,'real')
77 f = isreal(L) && isreal(U);
78 elseif isequal(flag,'notransp')
79 f = U\(L\X);
80 elseif isequal(flag,'transp')
81 f = L'\(U'\X);
82 end
83 end
84
0.02 240 85 end

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