% solve multiple 2nd degree linear systems at once - no pivoting!
function dg2 = lin_solve_dgr_2(A,b,R)
nrm =  (-A(2,1,:) .* A(1,2,:) + A(1,1,:) .* A(2,2,:));
  dg2 = zeros(2,R);
  dg2(1,:) = -(b(2,1,:) .* A(1,2,:) - b(1,1,:) .* A(2,2,:)) ./ nrm;
  dg2(2,:) = -(b(1,1,:) .* A(2,1,:) - b(2,1,:) .* A(1,1,:)) ./ nrm;
end