function InvR = inverse3x3(R)
  % ========================
  % https://guiard.org/pages/octave/inverseX.html
  % =========================
  %
  % Parallel inverte multiple matrices of size [3 3].
  % size(A) = [3 3 x]
  % Version 1.00
  %


  a = R(1,1,:);
  b = R(1,2,:);
  c = R(1,3,:);

  d = R(2,1,:);
  e = R(2,2,:);
  f = R(2,3,:);

  g = R(3,1,:);
  h = R(3,2,:);
  i = R(3,3,:);

  DetR  =  a.*e.*i + b.*f.*g + c.*d.*h -g.*e.*c - h.*f.*a - i.*d.*b;


  InvR = 1./DetR .* [e.*i-f.*h , c.*h-b.*i , b.*f-c.*e;
                     f.*g-d.*i , a.*i-c.*g , c.*d-a.*f;
                     d.*h-e.*g , b.*g-a.*h , a.*e-b.*d];


endfunction
