Home > matpower6.0 > extras > reduction > RODAssignment.m

RODAssignment

PURPOSE ^

FUNCTION SUMMARY:

SYNOPSIS ^

function [CindxU,ERPU,MinNod,Switch] = RODAssignment(ERP,CIndx,CindxU,ERPU,MinNod,Switch,SelfRef,RowIndex)

DESCRIPTION ^

FUNCTION SUMMARY:
   Subroutine RODAssignment is called in the symbolic LU factorization to
   assign column index of non-zero element on right of the diagonal in U
   matrix. The non-zero element may come be native or filed.

   [CindxU,ERPU,MinNod,Switch] = RODAssignment(ERP,CIndx,CindxU,ERPU,MinNod,Switch,SelfRef,RowIndex)

 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.
   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   
   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
   MinNod -scalar, store the minimum index of non-zero element on the 
           right of the diagonal

 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
  NOTE: in output data, ERPU, CIndxU, MinNod and Switch are updated in the
  subroutine. The output will return the updated arrays.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [CindxU,ERPU,MinNod,Switch] = RODAssignment(ERP,CIndx,CindxU,ERPU,MinNod,Switch,SelfRef,RowIndex)
0002 %FUNCTION SUMMARY:
0003 %   Subroutine RODAssignment is called in the symbolic LU factorization to
0004 %   assign column index of non-zero element on right of the diagonal in U
0005 %   matrix. The non-zero element may come be native or filed.
0006 %
0007 %   [CindxU,ERPU,MinNod,Switch] = RODAssignment(ERP,CIndx,CindxU,ERPU,MinNod,Switch,SelfRef,RowIndex)
0008 %
0009 % INPUT DATA:
0010 %   ERP - (N_node+1)*1 array containning the end of row pointer data
0011 %   CIndx - N*1 array containning the column index of the rows, N is the
0012 %           number of non-zeros elements in the input data
0013 %   CIndxU- N*1 array containning the column index of rows in the U matrix.
0014 %           The length N dedpends on the number of non-zero elements in
0015 %           previous rows on right of diagonal.
0016 %   Switch- N*1 array which is used to record the index off diagonal
0017 %           element in CIndxU and avoid keep the indices disjoint
0018 %   SelfRef-scalar, data value in the self refertial link also is the pointer
0019 %           point to next position in the self referential link
0020 %   RowIndex-scalar, the index of the row in processing
0021 %   ERPU -  N_dim*1 array containing end of row pointer of all rows except
0022 %           the last row which doesn have any off diagonal element, N_dim is
0023 %           the dimension of the input matrix A in the original Ax = b
0024 %           problem
0025 %   MinNod -scalar, store the minimum index of non-zero element on the
0026 %           right of the diagonal
0027 %
0028 % OUTPUT DATA:
0029 %   ERPU -   N_dim*1 array containing end of row pointer of all rows except
0030 %            the last row which doesn have any off diagonal element, N_dim is
0031 %            the dimension of the input matrix A in the original Ax = b
0032 %            problem
0033 %   CIndxU - N*1 array containing the column index of off diagonal element
0034 %            in each row in the U matrix. The length N depends on the
0035 %            number of native plus filled non-zero elements in the off
0036 %            diagonal position in U matrix. CIndxU is ordered.
0037 %   MinNod - scalar, store the minimum index of non-zero element on the
0038 %            right of the diagonal
0039 %   Switch- N*1 array which is used to record the index off diagonal
0040 %           element in CIndxU and avoid keep the indices disjoint
0041 %  NOTE: in output data, ERPU, CIndxU, MinNod and Switch are updated in the
0042 %  subroutine. The output will return the updated arrays.
0043 
0044 %   MATPOWER
0045 %   Copyright (c) 2014-2016, Power Systems Engineering Research Center (PSERC)
0046 %   by Yujia Zhu, PSERC ASU
0047 %
0048 %   This file is part of MATPOWER.
0049 %   Covered by the 3-clause BSD License (see LICENSE file for details).
0050 %   See http://www.pserc.cornell.edu/matpower/ for more info.
0051 
0052 %% to assign value to ROD position
0053 RowLen = ERP(SelfRef+1)-ERP(SelfRef); % number of non-zero element in current row
0054 RowColInd = CIndx(ERP(SelfRef)+1:ERP(SelfRef+1));
0055 % Initiate the ERPU to be the end of last row
0056 if ERPU(RowIndex+1)==0
0057     ERPU(RowIndex+1)=ERPU(RowIndex); % In the loop every time read one ROD element ERPU(RowColInd)+1
0058 end
0059 for i = 1:RowLen % dealing with each non-zero native non-zero element first
0060     % Load the native non-zero ROD
0061     if RowColInd(i)>RowIndex&&(Switch(RowColInd(i))~=RowIndex) % check if current element is on ROD
0062         CindxU(ERPU(RowIndex+1)+1)=RowColInd(i);
0063         ERPU(RowIndex+1)=ERPU(RowIndex+1)+1; % increase 1 after reading one non-zero number;
0064         % Update the MinNod if MinNod greater than current column
0065         % index RowColInd(i)
0066         if MinNod>RowColInd(i)
0067             MinNod = RowColInd(i); % update the MinNod
0068         end
0069         % Update the Switch list
0070         Switch(RowColInd(i))=RowIndex;
0071     end
0072 end
0073 end

Generated on Fri 16-Dec-2016 12:45:37 by m2html © 2005