def _sym_ortho(a, b):
 if (b == 0):
  return (np.sign(a), 0, abs(a))
 elif (a == 0):
  return (0, np.sign(b), abs(b))
 elif (abs(b) > abs(a)):
  tau = (a / b)
  s = (np.sign(b) / sqrt((1 + (tau * tau))))
  c = (s * tau)
  r = (b / s)
 else:
  tau = (b / a)
  c = (np.sign(a) / sqrt((1 + (tau * tau))))
  s = (c * tau)
  r = (a / c)
 return (c, s, r)

def _sym_ortho ( a , b ) : if ( b == 0 ) : return ( np . sign ( a ) , 0 , abs ( a ) ) elif ( a == 0 ) : return ( 0 , np . sign ( b ) , abs ( b ) ) elif ( abs ( b ) > abs ( a ) ) : tau = ( a / b ) s = ( np . sign ( b ) / sqrt ( ( 1 + ( tau * tau ) ) ) ) c = ( s * tau ) r = ( b / s ) else : tau = ( b / a ) c = ( np . sign ( a ) / sqrt ( ( 1 + ( tau * tau ) ) ) ) s = ( c * tau ) r = ( a / c ) return ( c , s , r )
stable implementation of givens rotation .