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-2015 by Power System Engineering Research Center (PSERC) 0026 % by Yujia Zhu, PSERC ASU 0027 % 0028 % $Id: TinneyOne.m 2655 2015-03-18 16:40:32Z ray $ 0029 % 0030 % This file is part of MATPOWER. 0031 % Covered by the 3-clause BSD License (see LICENSE file for details). 0032 % See http://www.pserc.cornell.edu/matpower/ for more info. 0033 0034 %% Extract the external bus part 0035 ExLen = length(ExBus); 0036 ERP_E = ERP(1:ExLen+1); 0037 %% 0038 RowLen = ERP_E; 0039 for i = 1:ExLen 0040 RowLen(i)=ERP_E(i+1)-ERP_E(i); % calculate the number of non-zero entry in each row 0041 end 0042 RowLen(end)=[]; 0043 [RowLen,RowOrd] = sort(RowLen); 0044 for i =1:ExLen 0045 RowOrdO(RowOrd(i))=i; 0046 end 0047 PivInd(1:ExLen)=PivInd(RowOrdO); 0048 for i = 1:ExLen 0049 PivOrd(PivInd(i))=i; 0050 end 0051 0052 end