function [pixel_coordinate] = RPCforwardform_array(p,q,X,Y,Z)
    npoints=length(X);
    num=zeros(npoints,20);den=zeros(npoints,20);
    monomial=[1 X Y Z X.*Y X.*Z Y.*Z X.^2 Y.^2 Z.^2 X.*Y.*Z X.^3 X.*Y.^2 X.*Z.^2 X.^2.*Y ...
       Y.^3 Y.*Z.^2 X.^2.*Z Y.^2.*Z Z.^3];
   p_array=repmat(p,[length(X) 1]);
   q_array=repmat(q,[length(X) 1]);
%     for i=1:20
        num=sum(p_array.*monomial,2);
        den=sum(q_array.*monomial,2);
%     end
    if den==0
        den=1;
    end
    pixel_coordinate=num./den;
end