% determines adjunct matrix for a square matrix B = adjunctMatrix(A) inv(A) = adj(A)/det(A) holds. d det(A)/ dA = adj(A)' holds. author: J. Meidow, FGAN-FOM $Log: adj.m,v $ Revision 1.1 2007/09/26 06:33:52 meidow *** empty log message *** adapted Wolfgang Foerstner 1/2011 wfoerstn@uni-bonn.de
0001 %% determines adjunct matrix for a square matrix 0002 % 0003 % B = adjunctMatrix(A) 0004 % 0005 % inv(A) = adj(A)/det(A) holds. 0006 % d det(A)/ dA = adj(A)' holds. 0007 % 0008 % author: J. Meidow, FGAN-FOM 0009 % 0010 % $Log: adj.m,v $ 0011 % Revision 1.1 2007/09/26 06:33:52 meidow 0012 % *** empty log message *** 0013 % 0014 % adapted Wolfgang Foerstner 1/2011 0015 % wfoerstn@uni-bonn.de 0016 0017 function B = adjunctMatrix(A) 0018 0019 B = zeros(size(A)); 0020 for i=1:size(A,1) 0021 idx_i = setdiff( 1:size(A,1), i); 0022 for j=1:size(A,2) 0023 idx_j = setdiff( 1:size(A,2),j); 0024 B(i,j) = (-1)^(i+j)*det(A(idx_j,idx_i)); 0025 end 0026 end