% p-chirp2 group parameter inverse operation, incorporating wyckoff principle
% with additive gain
%
% Use:  b = pinverse(a)
%
% Example: a=corners2d([0.1,.04, .03,.98, .95,.04, .94,.96]);
%          a(9)=0;
%          b=pinverse(a);

function b = inverse_projective_operation(a);

A = [a(1) a(2) a(3);  a(4) a(5) a(6);  a(7) a(8) 1];

B = inv(A); % matrix multiplication

if abs(B(3,3)) < sqrt(eps)
  disp('pinverse.m: lower right too close to zero; not dividing')
  b = [B(1,1) B(1,2) B(1,3) B(2,1) B(2,2) B(2,3) B(3,1) B(3,2)];
else%if
  b = [B(1,1) B(1,2) B(1,3) B(2,1) B(2,2) B(2,3) B(3,1) B(3,2)]/B(3,3);
end%if

b(9)=-a(9);

