time   | Calls   |  line  | 
|---|
 |  |  696   | function [R, permB, spdB] = CHOLfactorB(B, cholB, permB, shiftAndInvert, spdB)
   | 
 |  |  697   | % Get the Cholesky factorization of B and determine if it is Hermitian
   | 
 |  |  698   | % Positive (semi) Definite
   | 
 |  |  699   | 
 
  | 
< 0.001   |       1   |  700  | if isempty(B) 
   | 
 |  |  701   |     % Standard problem, set values to flow through
   | 
< 0.001   |       1   |  702  |     R = []; 
   | 
< 0.001   |       1   |  703  |     permB = []; 
   | 
< 0.001   |       1   |  704  |     spdB = false; 
   | 
 |  |  705   | elseif cholB
   | 
 |  |  706   |     % We already have the Cholesky factor, store it in R
   | 
 |  |  707   |     R = B;
   | 
 |  |  708   |     spdB = true;
   | 
 |  |  709   | elseif ishermitian(B) && (isempty(spdB)|| (spdB && ~shiftAndInvert))
   | 
 |  |  710   |     % We need to see if B is SPD by using chol OR
   | 
 |  |  711   |     % We know B is SPD, and we need Cholesky decomposition
   | 
 |  |  712   |     if issparse(B)
   | 
 |  |  713   |         [R, idxB, permB] = chol(B);
   | 
 |  |  714   |     else
   | 
 |  |  715   |         [R, idxB] = chol(B);
   | 
 |  |  716   |     end
   | 
 |  |  717   |     
   | 
 |  |  718   |     if idxB == 0
   | 
 |  |  719   |         % B is SPD, no further check needed
   | 
 |  |  720   |         spdB = true;
   | 
 |  |  721   |     elseif shiftAndInvert && isreal(B)
   | 
 |  |  722   |         % Check whether B is positive SEMI-definite by checking D from the
   | 
 |  |  723   |         % whether the D LDL decomposition is positive semi-definite
   | 
 |  |  724   |         [~, D, ~] = ldl(B,'vector');
   | 
 |  |  725   |         % Check that diagonal elements are non-negative and 2x2 diagonal
   | 
 |  |  726   |         % blocks are positive semi-definite:
   | 
 |  |  727   |         alpha = diag(D);
   | 
 |  |  728   |         beta = diag(D,1);
   | 
 |  |  729   |         spdB = checkTridiagForHSD(alpha, beta);
   | 
 |  |  730   |     else
   | 
 |  |  731   |         if spdB
   | 
 |  |  732   |             error(message('MATLAB:eigs:IsSymmetricDefiniteNotPD'));
  | 
 |  |  733   |         else % spdB is false or []
   | 
 |  |  734   |             spdB = false;
   | 
 |  |  735   |         end
   | 
 |  |  736   |     end
   | 
 |  |  737   |     
   | 
 |  |  738   |     if shiftAndInvert || ~spdB
   | 
 |  |  739   |         % We do not actually need the Cholesky factor to solve the problem
   | 
 |  |  740   |         R = [];
   | 
 |  |  741   |         permB = [];
   | 
 |  |  742   |     end
   | 
 |  |  743   |     
   | 
 |  |  744   | else
   | 
 |  |  745   |     % We do not need chol
   | 
 |  |  746   |     R = [];
   | 
 |  |  747   |     permB = [];
   | 
 |  |  748   |     if isempty(spdB)
   | 
 |  |  749   |         % B is empty or not Hermitian
   | 
 |  |  750   |         spdB = false;
   | 
 |  |  751   |     end
   | 
 |  |  752   |     % else we take the user's input
   | 
 |  |  753   | end
   | 
< 0.001   |       1   |  754  | end 
   | 
Other subfunctions in this file are not included in this listing.