Home > matpower5.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-2015 by Power System Engineering Research Center (PSERC)
0056 %   by Yujia Zhu, PSERC ASU
0057 %
0058 %   $Id: EQRODAssignment.m 2655 2015-03-18 16:40:32Z ray $
0059 %
0060 %   This file is part of MATPOWER.
0061 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0062 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0063 
0064 %% to assign value to ROD position
0065 RowLen = ERP(SelfRef+1)-ERP(SelfRef); % number of non-zero element in current row
0066 RowColInd = CIndx(ERP(SelfRef)+1:ERP(SelfRef+1));
0067 % Initiate the ERPU to be the end of last row
0068 if ERPU(RowIndex+1)==0
0069     ERPU(RowIndex+1)=ERPU(RowIndex); % In the loop every time read one ROD element ERPU(RowColInd)+1
0070 end
0071 ChainFlag=0;
0072 RowColInd2=RowColInd(RowColInd>RowIndex);
0073 for i = 1:RowLen % dealing with each non-zero native non-zero element first
0074     if RowColInd(i)>RowIndex&&(Switch(RowColInd(i))~=RowIndex) % check if current element is on ROD
0075         CindxU(ERPU(RowIndex+1)+1)=RowColInd(i);
0076         ERPU(RowIndex+1)=ERPU(RowIndex+1)+1; % increase 1 after reading one non-zero number;
0077         % Update the MinNod if MinNod greater than current column
0078         % index RowColInd(i)
0079         if MinNod>RowColInd(i)
0080             MinNod = RowColInd(i); % update the MinNod
0081         end
0082         % Update the Switch list
0083         Switch(RowColInd(i))=RowIndex;
0084     elseif Chain(RowColInd(i))~=0&&RowColInd(i)>RowIndex
0085         if MinNod>RowColInd(i)
0086             MinNod = RowColInd(i); % update the MinNod
0087         end
0088     end
0089 end
0090 if ~isempty(RowColInd2)
0091 if (min(RowColInd2)==MinNod1)&&(MinNod~=MinNod1)
0092     ChainFlag=1;
0093     MinNod=inf;
0094 end
0095 end
0096 end

Generated on Fri 20-Mar-2015 18:23:34 by m2html © 2005