edcbc642ae1518a049471747fd89909c5f841b84,geomstats/special_euclidean_group.py,SpecialEuclideanGroup,exponential_matrix,#SpecialEuclideanGroup#Any#,422
Before Change
rot_vec = self.rotations.regularize(rot_vec)
n_rot_vecs = rot_vec.shape[0]
angle = np.linalg.norm(rot_vec, axis=1)
if angle.ndim == 1:
angle = np.expand_dims(angle, axis=1)
assert angle.shape == (n_rot_vecs, 1), angle.shape
skew_rot_vec = so_group.skew_matrix_from_vector(rot_vec)
coef_1 = np.empty_like(angle)
coef_2 = np.empty_like(coef_1)
mask_0 = np.equal(angle, 0)
mask_0 = np.squeeze(mask_0, axis=1)
mask_close_to_0 = np.isclose(angle, 0)
mask_close_to_0 = np.squeeze(mask_close_to_0, axis=1)
mask_else = ~mask_0 & ~mask_close_to_0
coef_1[mask_close_to_0] = (1. / 2.
- angle[mask_close_to_0] ** 2 / 24.)
coef_2[mask_close_to_0] = (1. / 6.
- angle[mask_close_to_0] ** 3 / 120.)
// TODO(nina): check if the discountinuity as 0 is expected.
coef_1[mask_0] = 0
coef_2[mask_0] = 0
coef_1[mask_else] = (angle[mask_else] ** (-2)
* (1. - np.cos(angle[mask_else])))
coef_2[mask_else] = (angle[mask_else] ** (-2)
* (1. - (np.sin(angle[mask_else])
/ angle[mask_else])))
term_1 = np.zeros((n_rot_vecs, self.n, self.n))
term_2 = np.zeros_like(term_1)
for i in range(n_rot_vecs):
term_1[i] = np.eye(self.n) + skew_rot_vec[i] * coef_1[i]
term_2[i] = np.matmul(skew_rot_vec[i], skew_rot_vec[i]) * coef_2[i]
exponential_mat = term_1 + term_2
After Change
rot_vec = self.rotations.regularize(rot_vec)
n_rot_vecs, _ = rot_vec.shape
angle = np.linalg.norm(rot_vec, axis=1)
angle = vectorization_utils.expand_dims(angle, to_ndim=2, axis=1)
skew_rot_vec = so_group.skew_matrix_from_vector(rot_vec)
coef_1 = np.empty_like(angle)
coef_2 = np.empty_like(coef_1)
mask_0 = np.equal(angle, 0)
mask_0 = np.squeeze(mask_0, axis=1)
mask_close_to_0 = np.isclose(angle, 0)
mask_close_to_0 = np.squeeze(mask_close_to_0, axis=1)
mask_else = ~mask_0 & ~mask_close_to_0
coef_1[mask_close_to_0] = (1. / 2.
- angle[mask_close_to_0] ** 2 / 24.)
coef_2[mask_close_to_0] = (1. / 6.
- angle[mask_close_to_0] ** 3 / 120.)
// TODO(nina): check if the discountinuity as 0 is expected.
coef_1[mask_0] = 0
coef_2[mask_0] = 0
coef_1[mask_else] = (angle[mask_else] ** (-2)
* (1. - np.cos(angle[mask_else])))
coef_2[mask_else] = (angle[mask_else] ** (-2)
* (1. - (np.sin(angle[mask_else])
/ angle[mask_else])))
term_1 = np.zeros((n_rot_vecs, self.n, self.n))
term_2 = np.zeros_like(term_1)
for i in range(n_rot_vecs):
term_1[i] = np.eye(self.n) + skew_rot_vec[i] * coef_1[i]
term_2[i] = np.matmul(skew_rot_vec[i], skew_rot_vec[i]) * coef_2[i]
exponential_mat = term_1 + term_2
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 14
Instances
Project Name: geomstats/geomstats
Commit Name: edcbc642ae1518a049471747fd89909c5f841b84
Time: 2018-03-16
Author: ninamio78@gmail.com
File Name: geomstats/special_euclidean_group.py
Class Name: SpecialEuclideanGroup
Method Name: exponential_matrix
Project Name: geomstats/geomstats
Commit Name: edcbc642ae1518a049471747fd89909c5f841b84
Time: 2018-03-16
Author: ninamio78@gmail.com
File Name: geomstats/special_euclidean_group.py
Class Name: SpecialEuclideanGroup
Method Name: group_exp_from_identity
Project Name: geomstats/geomstats
Commit Name: edcbc642ae1518a049471747fd89909c5f841b84
Time: 2018-03-16
Author: ninamio78@gmail.com
File Name: geomstats/special_euclidean_group.py
Class Name: SpecialEuclideanGroup
Method Name: exponential_matrix
Project Name: geomstats/geomstats
Commit Name: edcbc642ae1518a049471747fd89909c5f841b84
Time: 2018-03-16
Author: ninamio78@gmail.com
File Name: geomstats/special_euclidean_group.py
Class Name: SpecialEuclideanGroup
Method Name: group_log_from_identity