function [ a0, a1, a2, a3 ] = u2F_polynom( G1, G2 )
%U2F_POLYNOM  Coefficients of polynom for 7-point algorithm.
%
%   [ a0, a1, a2, a3 ] = u2f_polynom( G1, G2 )

% (c) 2020-04-14 Martin Matousek
% Last change: $Date$
%              $Revision$

  a3 = det(G2);

  a2 =  G2(2,1) * G2(3,2) * G1(1,3) ...
        - G2(2,1) * G2(1,2) * G1(3,3) ...
        + G2(1,1) * G2(2,2) * G1(3,3) ...
        + G2(3,1) * G1(1,2) * G2(2,3) ...
        + G2(3,1) * G2(1,2) * G1(2,3) ...
        - G2(1,1) * G1(3,2) * G2(2,3) ...
        - G2(3,1) * G1(2,2) * G2(1,3) ...
        - G2(3,1) * G2(2,2) * G1(1,3) ...
        - G2(1,1) * G2(3,2) * G1(2,3) ...
        + G1(2,1) * G2(3,2) * G2(1,3) ...
        + G2(2,1) * G1(3,2) * G2(1,3) ...
        + G1(3,1) * G2(1,2) * G2(2,3) ...
        - G1(2,1) * G2(1,2) * G2(3,3) ...
        - G1(1,1) * G2(2,3) * G2(3,2) ...
        - G2(2,1) * G1(1,2) * G2(3,3) ...
        + G2(1,1) * G1(2,2) * G2(3,3) ...
        + G1(1,1) * G2(2,2) * G2(3,3) ...
        - G1(3,1) * G2(2,2) * G2(1,3);

  a1 = + G1(1,1) * G1(2,2) * G2(3,3) ...
       + G1(1,1) * G2(2,2) * G1(3,3) ...
       + G2(3,1) * G1(1,2) * G1(2,3) ...
       - G1(2,1) * G1(1,2) * G2(3,3) ...
       - G2(1,1) * G1(3,2) * G1(2,3) ...
       - G2(2,1) * G1(1,2) * G1(3,3) ...
       - G2(3,1) * G1(2,2) * G1(1,3) ...
       + G2(1,1) * G1(2,2) * G1(3,3) ...
       + G1(2,1) * G1(3,2) * G2(1,3) ...
       + G1(2,1) * G2(3,2) * G1(1,3) ...
       + G1(3,1) * G2(1,2) * G1(2,3) ...
       - G1(2,1) * G2(1,2) * G1(3,3) ...
       - G1(3,1) * G2(2,2) * G1(1,3) ...
       + G2(2,1) * G1(3,2) * G1(1,3) ...
       - G1(1,1) * G2(3,2) * G1(2,3) ...
       - G1(3,1) * G1(2,2) * G2(1,3) ...
       + G1(3,1) * G1(1,2) * G2(2,3) ...
       - G1(1,1) * G1(3,2) * G2(2,3);

  a0 = det(G1);

end % fcn.
