def rotg(self, a, b):
'''Compute the given rotation matrix given a column vector (a, b).
Returns r, z, c, s.
r: r = a ** 2 + b ** 2.
z: Use to recover c and s.
if abs(z) < 1:
c, s = 1 - z ** 2, z
elif abs(z) == 1:
c, s = 0, 1
else:
c, s = 1 / z, 1 - z ** 2
c: Cosine element of the rotation matrix.
s: Sine element of the rotation matrix.
'''
a, b = np.asarray(a), np.asarray(b)
_sentry_same_dtype(a, b)
fn = self._dispatch(self.rotg.vtable, a.dtype)
return fn(np.asscalar(a), np.asscalar(b))
评论列表
文章目录