Subroutine TinneyOne applied Tinney 1 optimal ordering to the input data in order to reduce the fills generated in the partial LU factorization process. [PivOrd,PivInd] = TinneyOne(ERP,PivInd,PivOrd,ExBus) INPUT DATA: ERP: 1*n array, includes end of row pointer of input addmittance matrix PivInd: 1*n array, includes bus ordering after pivotting PivOrd: 1*n array, includes bus indices after pivotting ExBus: 1*n array, includes bus indices of external buses OUTPUT DATA: PivInd: 1*n array, includes bus ordering after pivotting by Tinney 1 ordering PivOrd: 1*n array, includes bus indices after pivotting by Tinney 1 ordering NOTE: This subroutine does not pivot any data but output an array includes ordering of buses. Pivoting will be done in the subroutine PivotData.
0001 function [PivOrd,PivInd] = TinneyOne(ERP,PivInd,PivOrd,ExBus) 0002 % Subroutine TinneyOne applied Tinney 1 optimal ordering to the input data 0003 % in order to reduce the fills generated in the partial LU factorization 0004 % process. 0005 % 0006 % [PivOrd,PivInd] = TinneyOne(ERP,PivInd,PivOrd,ExBus) 0007 % 0008 % INPUT DATA: 0009 % ERP: 1*n array, includes end of row pointer of input addmittance matrix 0010 % PivInd: 1*n array, includes bus ordering after pivotting 0011 % PivOrd: 1*n array, includes bus indices after pivotting 0012 % ExBus: 1*n array, includes bus indices of external buses 0013 % 0014 % OUTPUT DATA: 0015 % PivInd: 1*n array, includes bus ordering after pivotting by Tinney 1 0016 % ordering 0017 % PivOrd: 1*n array, includes bus indices after pivotting by Tinney 1 0018 % ordering 0019 % 0020 % NOTE: 0021 % This subroutine does not pivot any data but output an array includes 0022 % ordering of buses. Pivoting will be done in the subroutine PivotData. 0023 0024 % MATPOWER 0025 % Copyright (c) 2014-2016, Power Systems Engineering Research Center (PSERC) 0026 % by Yujia Zhu, PSERC ASU 0027 % 0028 % This file is part of MATPOWER. 0029 % Covered by the 3-clause BSD License (see LICENSE file for details). 0030 % See http://www.pserc.cornell.edu/matpower/ for more info. 0031 0032 %% Extract the external bus part 0033 ExLen = length(ExBus); 0034 ERP_E = ERP(1:ExLen+1); 0035 %% 0036 RowLen = ERP_E; 0037 for i = 1:ExLen 0038 RowLen(i)=ERP_E(i+1)-ERP_E(i); % calculate the number of non-zero entry in each row 0039 end 0040 RowLen(end)=[]; 0041 [RowLen,RowOrd] = sort(RowLen); 0042 for i =1:ExLen 0043 RowOrdO(RowOrd(i))=i; 0044 end 0045 PivInd(1:ExLen)=PivInd(RowOrdO); 0046 for i = 1:ExLen 0047 PivOrd(PivInd(i))=i; 0048 end 0049 0050 end