| [abd,lda,n,m,det]=spbdi(abd,lda,n,m,det); |
function [abd,lda,n,m,det]=spbdi(abd,lda,n,m,det);
%***BEGIN PROLOGUE SPBDI
%***PURPOSE Compute the determinant of a symmetric positive definite
% band matrix using the factors computed by SPBCO or SPBFA.
%***LIBRARY SLATEC (LINPACK)
%***CATEGORY D3B2
%***TYPE SINGLE PRECISION (SPBDI-S, DPBDI-D, CPBDI-C)
%***KEYWORDS BANDED, DETERMINANT, INVERSE, LINEAR ALGEBRA, LINPACK,
% MATRIX, POSITIVE DEFINITE
%***AUTHOR Moler, C. B., (U. of New Mexico)
%***DESCRIPTION
%
% SPBDI computes the determinant
% of a real symmetric positive definite band matrix
% using the factors computed by SPBCO or SPBFA.
% If the inverse is needed, use SPBSL N times.
%
% On Entry
%
% ABD REAL(LDA, N)
% the output from SPBCO or SPBFA.
%
% LDA INTEGER
% the leading dimension of the array ABD .
%
% N INTEGER
% the order of the matrix A .
%
% M INTEGER
% the number of diagonals above the main diagonal.
%
% On Return
%
% DET REAL(2)
% determinant of original matrix in the form
% Determinant = DET(1) * 10.0**DET(2)
% with 1.0 .LE. DET(1) .LT. 10.0
% or DET(1) .EQ. 0.0 .
%
%***REFERENCES J. J. Dongarra, J. R. Bunch, C. B. Moler, and G. W.
% Stewart, LINPACK Users' Guide, SIAM, 1979.
%***ROUTINES CALLED (NONE)
%***REVISION HISTORY (YYMMDD)
% 780814 DATE WRITTEN
% 890831 Modified array declarations. (WRB)
% 890831 REVISION DATE from Version 3.2
% 891214 Prologue converted to Version 4.0 format. (BAB)
% 900326 Removed duplicate information from DESCRIPTION section.
% (WRB)
% 920501 Reformatted the REFERENCES section. (WRB)
%***end PROLOGUE SPBDI
persistent i s ;
abd_shape=size(abd);abd=reshape([abd(:).',zeros(1,ceil(numel(abd)./prod([lda])).*prod([lda])-numel(abd))],lda,[]);
%
if isempty(s), s=0; end;
if isempty(i), i=0; end;
%***FIRST EXECUTABLE STATEMENT SPBDI
%
% COMPUTE DETERMINANT
%
det(1) = 1.0e0;
det(2) = 0.0e0;
s = 10.0e0;
for i = 1 : n;
det(1) = abd(m+1,i).^2.*det(1);
if( det(1)==0.0e0 )
break;
end;
while( det(1)<1.0e0 );
det(1) = s.*det(1);
det(2) = det(2) - 1.0e0;
end;
while( det(1)>=s );
det(1) = det(1)./s;
det(2) = det(2) + 1.0e0;
end;
end;
abd_shape=zeros(abd_shape);abd_shape(:)=abd(1:numel(abd_shape));abd=abd_shape;
end %subroutine spbdi
%DECK SPBFA
|
|