Home > matpower5.1 > extras > reduction > PartialSymLU.m

PartialSymLU

PURPOSE ^

FUNCTION SUMMARY:

SYNOPSIS ^

function [ERPU,CIndxU,ERPEQ,CIndxEQ] = PartialSymLU(CIndx,ERP,dim,Stop,BoundBus)

DESCRIPTION ^

FUNCTION SUMMARY:
   Subroutine PartialSymLU do partial symbolic LU factorization. 

   [ERPU,CIndxU,ERPEQ,CIndxEQ] = PartialSymLU(CIndx,ERP,dim,Stop,BoundBus)

 INPUT DATA:
   CIndx - N*1 array containning the column index of the rows, N is the
           number of non-zeros elements in the input data
   ERP - (N_node+1)*1 array containning the end of row pointer data
   dim - scalar, dimension of the input matrix
   Stop - scalar, stop sign of the LU factorization (The LU factorization
       in the reduction process is not complete but partial)
   BoundBus- 1*n array, includes indices of boundary buses


 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 unordered.
   ERPEQ, CIndxEQ, - both are N*1 arrays, together include the indices of
            equivalent branches


   Note: This subroutine will do:
       1. Factorization of rows in the full model bus addmittance matrix
       corresponding to the external buses. This process will only
       generate the pointers of non-zeroes in L and U matrix;
       2. Identify the equivalent branch indices. Identify the pointers
       (ERPEQ, CIndxEQ)of fills generated from step 1 in the rows and
       columns corresponding to the boundary buses. (The equivalent lines  
       can only span the boundary buses).

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [ERPU,CIndxU,ERPEQ,CIndxEQ] = PartialSymLU(CIndx,ERP,dim,Stop,BoundBus)
0002 %FUNCTION SUMMARY:
0003 %   Subroutine PartialSymLU do partial symbolic LU factorization.
0004 %
0005 %   [ERPU,CIndxU,ERPEQ,CIndxEQ] = PartialSymLU(CIndx,ERP,dim,Stop,BoundBus)
0006 %
0007 % INPUT DATA:
0008 %   CIndx - N*1 array containning the column index of the rows, N is the
0009 %           number of non-zeros elements in the input data
0010 %   ERP - (N_node+1)*1 array containning the end of row pointer data
0011 %   dim - scalar, dimension of the input matrix
0012 %   Stop - scalar, stop sign of the LU factorization (The LU factorization
0013 %       in the reduction process is not complete but partial)
0014 %   BoundBus- 1*n array, includes indices of boundary buses
0015 %
0016 %
0017 % OUTPUT DATA:
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 %   CIndxU - N*1 array containing the column index of off diagonal element
0023 %            in each row in the U matrix. The length N depends on the
0024 %            number of native plus filled non-zero elements in the off
0025 %            diagonal position in U matrix. CIndxU is unordered.
0026 %   ERPEQ, CIndxEQ, - both are N*1 arrays, together include the indices of
0027 %            equivalent branches
0028 %
0029 %
0030 %   Note: This subroutine will do:
0031 %       1. Factorization of rows in the full model bus addmittance matrix
0032 %       corresponding to the external buses. This process will only
0033 %       generate the pointers of non-zeroes in L and U matrix;
0034 %       2. Identify the equivalent branch indices. Identify the pointers
0035 %       (ERPEQ, CIndxEQ)of fills generated from step 1 in the rows and
0036 %       columns corresponding to the boundary buses. (The equivalent lines
0037 %       can only span the boundary buses).
0038 
0039 %   MATPOWER
0040 %   Copyright (c) 2014-2015 by Power System Engineering Research Center (PSERC)
0041 %   by Yujia Zhu, PSERC ASU
0042 %
0043 %   $Id: PartialSymLU.m 2655 2015-03-18 16:40:32Z ray $
0044 %
0045 %   This file is part of MATPOWER.
0046 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0047 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0048 
0049 %% Begin of the code
0050 numRow = dim; % number of rows of given data matrix
0051 % numCol = dim; % number of columns of given data matrix
0052 %% Initialization
0053 % the length of pos is equal to # of total non zero data - number of
0054 % diagonal elements - the number of non zero element in last row'
0055 %% step 0
0056 CIndxU = 0;
0057 ERPU= zeros(1,dim); % with aditional one digit for the 7th row
0058 Switch = zeros(1,dim);
0059 MinNod0 = inf; % This is a initiate large value of MinNod; not the MinNod used in building the symbolic struture
0060 MinNod = MinNod0;
0061 MinNod1=MinNod;
0062 Link = ERPU;
0063 CIndxEQ=0;
0064 ERPEQ=zeros(1,Stop+length(BoundBus)+1);
0065 Chain=zeros(1,Stop+length(BoundBus));
0066 % preprocess the data by ordering the CIndx of every row in ascending order
0067 for i = 2:numRow+1
0068     RowColInd = ERP(i-1)+1:ERP(i); % for every row the pointer of the column index
0069     CIndx(RowColInd)=sort(CIndx(RowColInd));
0070 end
0071 % initiate starting row 1
0072 RowIndex = 1;
0073 while RowIndex<=length(BoundBus)+Stop
0074     MinNod1=MinNod0;
0075     %% step 1
0076     if RowIndex<=Stop
0077         [CIndxU,ERPU,MinNod,Switch] = RODAssignment(ERP,CIndx,CIndxU,ERPU,MinNod,Switch,RowIndex,RowIndex);
0078         %% step 2
0079         % Check fill in ROD in current row
0080         SelfRef = RowIndex; % self referential link pointer to next availale link element
0081         while (Link(SelfRef)~=0)
0082             SelfRef = Link(SelfRef); % to refer for the next link element
0083             [CIndxU,ERPU,MinNod,Switch] = RODAssignment (ERPU,CIndxU,CIndxU,ERPU,MinNod,Switch,SelfRef,RowIndex);
0084         end
0085         Link(RowIndex) = 0; % zero the element in the Link list of current row
0086         %% step 3
0087         % update Link node (MinNod) to be current RowIndex
0088         if MinNod>RowIndex&&MinNod~=MinNod0
0089             SelfRef = MinNod; % start the assign value to Link
0090             while (Link(SelfRef)~=0)
0091                 SelfRef = Link(SelfRef);
0092             end
0093             Link(SelfRef)=RowIndex;
0094         end
0095         %% step 4
0096         MinNod = MinNod0; % reset the MinNod value
0097     else
0098         if Link(RowIndex)~=0
0099             [LinkPos,LinkArray,Counter] = SelfLink(Link,RowIndex);
0100             for i = 1:Counter
0101                 SelfRef=LinkArray(i);
0102                 if SelfRef<=Stop
0103                     [CIndxEQ,ERPEQ,MinNod,Switch,ChainFlag] = EQRODAssignment(ERPU,CIndxU,CIndxEQ,ERPEQ,MinNod,Switch,SelfRef,RowIndex,Chain,MinNod1);
0104                     if MinNod>RowIndex&&MinNod~=MinNod0||(MinNod1~=MinNod&&ChainFlag~=1)
0105                         if MinNod1~=MinNod0
0106                             if RowIndex>Stop+1&&MinNod1~=MinNod&&Chain(MinNod1)==0
0107                                 Link(SelfRef1)=0;
0108                                 % If the chain breaks, record where and which
0109                                 % row to be reconected
0110                                 Chain(MinNod1)=Link(MinNod1);
0111                             end
0112                         elseif RowIndex>Stop+1&&MinNod1~=MinNod&&ChainFlag==0
0113                             Link(SelfRef1)=0;
0114                             
0115                         end
0116                         
0117                         if MinNod~=MinNod0
0118                             SelfRef1=SelfRef;
0119                             FillIn = MinNod; % start the assign value to Link
0120                             while (Link(FillIn)~=0)&&Link(FillIn)~=FillIn;
0121                                 FillIn = Link(FillIn);
0122                             end
0123                             %                         if Link(FillIn)==0
0124                             if FillIn~=SelfRef1
0125                                 Link(FillIn)=SelfRef1;
0126                             else
0127                                 MinNod=MinNod;
0128                             end
0129                             Chain(MinNod)=0;
0130                             %                         end
0131                         end
0132                     end
0133                     %% step 4
0134                     MinNod1=MinNod;
0135                     
0136                     MinNod = MinNod0; % reset the MinNod value
0137                 end
0138             end
0139         else
0140             ERPEQ(RowIndex+1)=ERPEQ(RowIndex);
0141         end
0142         Link(RowIndex) = 0; % zero the element in the Link list of current row
0143     end  
0144     % ready for next loop
0145     RowIndex = RowIndex+1;
0146 end
0147 end

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