Home > matpower7.1 > extras > reduction > EQRODAssignment.m

EQRODAssignment

PURPOSE ^

FUNCTION SUMMARY:

SYNOPSIS ^

function [CindxU,ERPU,MinNod,Switch,ChainFlag] = EQRODAssignment(ERP,CIndx,CindxU,ERPU,MinNod,Switch,SelfRef,RowIndex,Chain,MinNod1)

DESCRIPTION ^

FUNCTION SUMMARY:
   Subroutine EQRODAssignment is called in symbolic LU factorization, this
   subroutine is specifically used to identify the pointers of equivalent
   branches spanning the boundary buses. The equivalent branches are the
   fills in the factorization process of rows and columns of the external
   buses.

   [CindxU,ERPU,MinNod,Switch,ChainFlag] = EQRODAssignment(ERP,CIndx,CindxU,ERPU,MinNod,Switch,SelfRef,RowIndex,Chain,MinNod1)

 INPUT DATA:
   ERP - (N_node+1)*1 array containning the end of row pointer data
   CIndx - N*1 array containning the column index of the rows, N is the
           number of non-zeros elements in the input data
   CIndxU- N*1 array containning the column index of rows in the U matrix.
           The length N dedpends on the number of non-zero elements in
           previous rows on right of diagonal.
   ERPU -  N_dim*1 array containing end of row pointer of all rows except
           the last row which doesn have any off diagonal element, N_dim is
           the dimension of the input matrix A in the original Ax = b
           problem
   Switch- N*1 array which is used to record the index off diagonal
           element in CIndxU and avoid keep the indices disjoint
   SelfRef-scalar, data value in the self refertial link also is the pointer 
           point to next position in the self referential link
   RowIndex-scalar, the index of the row in processing   
   Chain- 1*n array, if the MinNod got from this cycle (MinNod1) is
       different to the previous one and the previous one is not inf, then Chain(MinNod1) will
       record the value of Link(MinNod1)
   MinNod -scalar, store the minimum index of non-zero element on the 
           right of the diagonal
   MinNod1 -scalar, MinNod value recorded in the last cycle

 OUTPUT DATA:
   ERPU -   N_dim*1 array containing end of row pointer of all rows except
            the last row which doesn have any off diagonal element, N_dim is
            the dimension of the input matrix A in the original Ax = b
            problem
   CIndxU - N*1 array containing the column index of off diagonal element
            in each row in the U matrix. The length N depends on the
            number of native plus filled non-zero elements in the off
            diagonal position in U matrix. CIndxU is ordered.
   MinNod - scalar, store the minimum index of non-zero element on the 
            right of the diagonal
   Switch- N*1 array which is used to record the index off diagonal
           element in CIndxU and avoid keep the indices disjoint
   ChainFlag- scalar, indicate if the MinNod is changed
  NOTE: in output data, ERPU, CIndxU, MinNod and Switch are updated in the
  subroutine. The output will return the updated arrays.
               
 NOTE: This subroutine is only used to generate the equivalent line
 indices.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [CindxU,ERPU,MinNod,Switch,ChainFlag] = EQRODAssignment(ERP,CIndx,CindxU,ERPU,MinNod,Switch,SelfRef,RowIndex,Chain,MinNod1)
0002 %FUNCTION SUMMARY:
0003 %   Subroutine EQRODAssignment is called in symbolic LU factorization, this
0004 %   subroutine is specifically used to identify the pointers of equivalent
0005 %   branches spanning the boundary buses. The equivalent branches are the
0006 %   fills in the factorization process of rows and columns of the external
0007 %   buses.
0008 %
0009 %   [CindxU,ERPU,MinNod,Switch,ChainFlag] = EQRODAssignment(ERP,CIndx,CindxU,ERPU,MinNod,Switch,SelfRef,RowIndex,Chain,MinNod1)
0010 %
0011 % INPUT DATA:
0012 %   ERP - (N_node+1)*1 array containning the end of row pointer data
0013 %   CIndx - N*1 array containning the column index of the rows, N is the
0014 %           number of non-zeros elements in the input data
0015 %   CIndxU- N*1 array containning the column index of rows in the U matrix.
0016 %           The length N dedpends on the number of non-zero elements in
0017 %           previous rows on right of diagonal.
0018 %   ERPU -  N_dim*1 array containing end of row pointer of all rows except
0019 %           the last row which doesn have any off diagonal element, N_dim is
0020 %           the dimension of the input matrix A in the original Ax = b
0021 %           problem
0022 %   Switch- N*1 array which is used to record the index off diagonal
0023 %           element in CIndxU and avoid keep the indices disjoint
0024 %   SelfRef-scalar, data value in the self refertial link also is the pointer
0025 %           point to next position in the self referential link
0026 %   RowIndex-scalar, the index of the row in processing
0027 %   Chain- 1*n array, if the MinNod got from this cycle (MinNod1) is
0028 %       different to the previous one and the previous one is not inf, then Chain(MinNod1) will
0029 %       record the value of Link(MinNod1)
0030 %   MinNod -scalar, store the minimum index of non-zero element on the
0031 %           right of the diagonal
0032 %   MinNod1 -scalar, MinNod value recorded in the last cycle
0033 %
0034 % OUTPUT DATA:
0035 %   ERPU -   N_dim*1 array containing end of row pointer of all rows except
0036 %            the last row which doesn have any off diagonal element, N_dim is
0037 %            the dimension of the input matrix A in the original Ax = b
0038 %            problem
0039 %   CIndxU - N*1 array containing the column index of off diagonal element
0040 %            in each row in the U matrix. The length N depends on the
0041 %            number of native plus filled non-zero elements in the off
0042 %            diagonal position in U matrix. CIndxU is ordered.
0043 %   MinNod - scalar, store the minimum index of non-zero element on the
0044 %            right of the diagonal
0045 %   Switch- N*1 array which is used to record the index off diagonal
0046 %           element in CIndxU and avoid keep the indices disjoint
0047 %   ChainFlag- scalar, indicate if the MinNod is changed
0048 %  NOTE: in output data, ERPU, CIndxU, MinNod and Switch are updated in the
0049 %  subroutine. The output will return the updated arrays.
0050 %
0051 % NOTE: This subroutine is only used to generate the equivalent line
0052 % indices.
0053 
0054 %   MATPOWER
0055 %   Copyright (c) 2014-2016, Power Systems Engineering Research Center (PSERC)
0056 %   by Yujia Zhu, PSERC ASU
0057 %
0058 %   This file is part of MATPOWER/mx-reduction.
0059 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0060 %   See https://github.com/MATPOWER/mx-reduction/ for more info.
0061 
0062 %% to assign value to ROD position
0063 RowLen = ERP(SelfRef+1)-ERP(SelfRef); % number of non-zero element in current row
0064 RowColInd = CIndx(ERP(SelfRef)+1:ERP(SelfRef+1));
0065 % Initiate the ERPU to be the end of last row
0066 if ERPU(RowIndex+1)==0
0067     ERPU(RowIndex+1)=ERPU(RowIndex); % In the loop every time read one ROD element ERPU(RowColInd)+1
0068 end
0069 ChainFlag=0;
0070 RowColInd2=RowColInd(RowColInd>RowIndex);
0071 for i = 1:RowLen % dealing with each non-zero native non-zero element first
0072     if RowColInd(i)>RowIndex&&(Switch(RowColInd(i))~=RowIndex) % check if current element is on ROD
0073         CindxU(ERPU(RowIndex+1)+1)=RowColInd(i);
0074         ERPU(RowIndex+1)=ERPU(RowIndex+1)+1; % increase 1 after reading one non-zero number;
0075         % Update the MinNod if MinNod greater than current column
0076         % index RowColInd(i)
0077         if MinNod>RowColInd(i)
0078             MinNod = RowColInd(i); % update the MinNod
0079         end
0080         % Update the Switch list
0081         Switch(RowColInd(i))=RowIndex;
0082     elseif Chain(RowColInd(i))~=0&&RowColInd(i)>RowIndex
0083         if MinNod>RowColInd(i)
0084             MinNod = RowColInd(i); % update the MinNod
0085         end
0086     end
0087 end
0088 if ~isempty(RowColInd2)
0089 if (min(RowColInd2)==MinNod1)&&(MinNod~=MinNod1)
0090     ChainFlag=1;
0091     MinNod=inf;
0092 end
0093 end
0094 end

Generated on Fri 09-Oct-2020 11:21:31 by m2html © 2005