subroutine givens(x,c,s,y1) 
	implicit none 
	double precision	x(2),c,s,y1
!=============================================== 
!	Method 2 
! 
	if (x(2) /= 0.0d0) then 
		if (dabs(x(1)) >= dabs(x(2))) then 
			y1 = dsqrt(1.0d0 + (x(2)/x(1))**2) * dabs(x(1)) 
		else 
			y1 = dsqrt(1.0d0 + (x(1)/x(2))**2) * dabs(x(2)) 
		endif 
		c = x(1)/y1 
		s = -x(2)/y1 
	else  
		if (x(1) >= 0.0d0) then 
			y1	= x(1) 
			c	= 1.0d0 
		else 
			y1	= -x(1) 
			c	= -1.0d0 
		endif 
		s	= 0.0d0 
	endif 
!
! the matrix is  [c s; -s, c]
!
end subroutine givens 
