function [m,n,OPERATIONS,E,d] = ppriori(A) % PPRIORI Priority entry of matrix of polynomials in long format. % [m,n,OPERATIONS] = PPRIORI(A) returns the indices m and n of % the priority entry in A and a third output, OPERATIONS, for use % with PALGO, PALGO2 and PQUICK to determine the type of operation % to be performed. % % [m,n,OPERATIONS,E,d] = PPRIORI(A) returns the numerator and the % denominator of the priority entry value of matrix A. % % Possible OPERATIONS are: % 1 corresponds to a row operation. % 2 corresponds to a column operation. % % See also PRIORITY % Adapted from Harold M. Edwards, "Linear Algebra." % Written by Serge Tchikanda 06/13/95. % Last revised by Serge Tchikanda 06/18/96. [M,N]=psize(A); if isempty(M) | isempty(N) return end U = ptriu(A,1); % Upper triangular part of A L = ptril(A,-1); % Lower triangular part of A idxu=pfind(U); idxl=pfind(L); if ~any(idxu) & ~any(idxl) & nargout > 3 disp(' ') % If entries in U and L are all disp('No priority entry found') % zeroes, then A is diagonal and disp('Matrix is diagonal') % thus has no priority entry. return else [i1,j1] = pfind(U); % Find nonzero entries in U mU = min(i1); % Find priority entry (mU,nU) nU = max(pfind(prtv(U,mU,':'))); % in U. [i2,j2] = pfind(L); % Find nonzero entries in L nL = min(j2); % Find priority entry (mL,nL) mL = max(pfind(prtv(L,':',nL))); % in L if (isempty(i1)) & (isempty(j1)) % If no nonzero entry in U, OPERATIONS = 1; % priority entry (m,n) of A m = mL; % must be in L. n = nL; elseif (isempty(i2)) & (isempty(j2)) % If no nonzero entry in L, OPERATIONS = 2; % priority entry (m,n) of A m = mU; % must be in U. n = nU; else % Else, there are nonzero entries % in both U an L. if mU <= nL % If row index in U less than or equal OPERATIONS = 2; % to column index in L, then priority m = mU; % entry is in U. n = nU; else % If row index in U greater than OPERATIONS = 1; % column index in L, then priority m = mL; % entry is in L. n = nL; end end end [E,d] = gpet(A,m,n);