This is a static copy of a profile reportHome
pinv (9 calls, 0.011 sec)
Generated 05-Aug-2011 13:03:16 using cpu time.
function in file /usr/local/MATLAB/R2011a/toolbox/matlab/matfun/pinv.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 |
29 | [U,S,V] = svd(A,0); | 9 | 0.011 s | 100.0% |  |
46 | end | 9 | 0 s | 0% |  |
45 | end | 9 | 0 s | 0% |  |
44 | X = V(:,1:r)*s*U(:,1:r)'; | 9 | 0 s | 0% |  |
43 | s = diag(ones(r,1)./s(1:r)); | 9 | 0 s | 0% |  |
All other lines | | | 0 s | 0% |  |
Totals | | | 0.011 s | 100% | |
Children (called functions)
No childrenCode Analyzer results
No Code Analyzer messages.Coverage results
[ Show coverage for parent directory ]
Total lines in function | 46 |
Non-code lines (comments, blank lines) | 20 |
Code lines (lines that can run) | 26 |
Code lines that did run | 17 |
Code lines that did not run | 9 |
Coverage (did run/can run) | 65.38 % |
Function listing
time calls line
1 function X = pinv(A,varargin)
2 %PINV Pseudoinverse.
3 % X = PINV(A) produces a matrix X of the same dimensions
4 % as A' so that A*X*A = A, X*A*X = X and A*X and X*A
5 % are Hermitian. The computation is based on SVD(A) and any
6 % singular values less than a tolerance are treated as zero.
7 % The default tolerance is MAX(SIZE(A)) * NORM(A) * EPS(class(A)).
8 %
9 % PINV(A,TOL) uses the tolerance TOL instead of the default.
10 %
11 % Class support for input A:
12 % float: double, single
13 %
14 % See also RANK.
15
16 % Copyright 1984-2004 The MathWorks, Inc.
17 % $Revision: 5.12.4.2 $ $Date: 2004/12/06 16:35:27 $
18
9 19 if isempty(A) % quick return
20 X = zeros(size(A'),class(A));
21 return
22 end
23
9 24 [m,n] = size(A);
25
9 26 if n > m
27 X = pinv(A',varargin{:})';
9 28 else
0.01 9 29 [U,S,V] = svd(A,0);
9 30 if m > 1, s = diag(S);
31 elseif m == 1, s = S(1);
32 else s = 0;
33 end
9 34 if nargin == 2
35 tol = varargin{1};
9 36 else
9 37 tol = max(m,n) * eps(max(s));
9 38 end
9 39 r = sum(s > tol);
9 40 if (r == 0)
41 X = zeros(size(A'),class(A));
9 42 else
9 43 s = diag(ones(r,1)./s(1:r));
9 44 X = V(:,1:r)*s*U(:,1:r)';
9 45 end
9 46 end