This is a static copy of a profile report

Home

pinv (20 calls, 0.039 sec)
Generated 04-Aug-2014 13:05:22 using cpu time.
function in file /share/apps/matlabr2014a/toolbox/matlab/matfun/pinv.m
Copy to new window for comparing multiple runs

Parents (calling functions)

Function NameFunction TypeCalls
FluidsSolver2_DO3function20
Lines where the most time was spent

Line NumberCodeCallsTotal Time% TimeTime Plot
18
[U,S,V] = svd(A,'econ');
200.039 s100.0%
28
X = bsxfun(@times,V,s.')*U';
200 s0%
27
s = 1./s(:);
200 s0%
26
s(r1:end) = [];
200 s0%
25
U(:,r1:end) = [];
200 s0%
All other lines  0 s0%
Totals  0.039 s100% 
Children (called functions)
No children
Code Analyzer results
No Code Analyzer messages.
Coverage results
Show coverage for parent directory
Total lines in function28
Non-code lines (comments, blank lines)17
Code lines (lines that can run)11
Code lines that did run9
Code lines that did not run2
Coverage (did run/can run)81.82 %
Function listing
time 
calls 
 line
   1 
function X = pinv(A,tol)
   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-2013 The MathWorks, Inc. 
  17 

  0.04 
     20 
  18 
[U,S,V] = svd(A,'econ'); 
     20 
  19 
s = diag(S); 
     20 
  20 
if nargin < 2  
  21 
    tol = max(size(A)) * eps(norm(s,inf));
  22 
end
     20 
  23 
r1 = sum(s > tol)+1; 
     20 
  24 
V(:,r1:end) = []; 
     20 
  25 
U(:,r1:end) = []; 
     20 
  26 
s(r1:end) = []; 
     20 
  27 
s = 1./s(:); 
     20 
  28 
X = bsxfun(@times,V,s.')*U';