function [pel,d,lc] = gpel(A,i,j) %GPEL Get polynomial elements of matrices in long format. % [PEL,d] = GPEL(A,i,j) returns the polynomials and their common % denominator, of the (i,j) elements of an m-by-n matrix of % polynomials stored in an (m*n + 2)-by-(k+1) matrix (long format). % k is the highest degree of the polynomials in A. The polynomial % elements are stored as rows of PEL. % % [PET,d,LC] = GPEL(A,i,j) returns the leading coefficient of PEL. % % Example: If PEL = [0 -7 3 -1], then LC = -7 % % [...] = GPEL(A,v) returns the polynomial entries of A corresponding % to the entries in v. % % See also GPET, GDEG % Written by Serge Tchikanda 06/14/96. % Last revised by Serge Tchikanda 06/17/96. if nargin == 2 if strcmp(':',i) idx = [1:prod(psize(A))] + 2; else idx = i(:)+2; end else idx = elplf(A,i,j); end if isempty(idx) return end pel = delzeros(A(idx,:)); if any(any(round(A) ~= A)) disp(' ') disp(' Input argument must have integer entries.') return else g=matgcd([pel(:); A(2)]); end d = A(2); if g ~= 0 d = d/g; pel = pel/g; end if nargout > 2 for l = 1:length(idx) if any(find(pel(l,:))) k = min(find(pel(l,:))); lc(l,1) = pel(l,k); else lc(l,1) = 0; end end end