506b234094009d55d326f1ce957f53f15d4b65ee,geomstats/spd_matrices_space.py,SPDMetric,exp,#SPDMetric#Any#Any#,160

Before Change


        sqrt_base_point = scipy.linalg.sqrtm(base_point)
        inv_sqrt_base_point = np.linalg.inv(sqrt_base_point)

        tangent_vec_at_id = np.dot(np.dot(inv_sqrt_base_point,
                                          tangent_vec),
                                   inv_sqrt_base_point)
        exp_from_id = group_exp(tangent_vec_at_id)

        exp = np.dot(sqrt_base_point,
                     np.dot(exp_from_id,

After Change



        This gives a symmetric positive definite matrix.
        
        if tangent_vec.ndim == 2:
            tangent_vec = np.expand_dims(tangent_vec, axis=0)
        assert tangent_vec.ndim == 3

        if base_point.ndim == 2:
            base_point = np.expand_dims(base_point, axis=0)
        assert base_point.ndim == 3

        n_tangent_vecs, _, _ = tangent_vec.shape
        n_base_points, mat_dim, _ = base_point.shape

        assert (n_tangent_vecs == n_base_points
                or n_tangent_vecs == 1
                or n_base_points == 1)

        sqrt_base_point = np.zeros((n_base_points, mat_dim, mat_dim))
        for i in range(n_base_points):
            sqrt_base_point[i] = scipy.linalg.sqrtm(base_point[i])

        inv_sqrt_base_point = np.linalg.inv(sqrt_base_point)

        tangent_vec_at_id = np.matmul(inv_sqrt_base_point,
                                      tangent_vec)
        tangent_vec_at_id = np.matmul(tangent_vec_at_id,
                                      inv_sqrt_base_point)
        exp_from_id = group_exp(tangent_vec_at_id)

        exp = np.matmul(exp_from_id, sqrt_base_point)
        exp = np.matmul(sqrt_base_point, exp)

        return exp

    def log(self, point, base_point):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 10

Instances


Project Name: geomstats/geomstats
Commit Name: 506b234094009d55d326f1ce957f53f15d4b65ee
Time: 2018-02-26
Author: ninamio78@gmail.com
File Name: geomstats/spd_matrices_space.py
Class Name: SPDMetric
Method Name: exp


Project Name: geomstats/geomstats
Commit Name: b0d0053b1f1738640fc99fba642c83af42d10b22
Time: 2018-02-02
Author: ninamio78@gmail.com
File Name: geomstats/invariant_metric.py
Class Name: InvariantMetric
Method Name: inner_product_matrix


Project Name: geomstats/geomstats
Commit Name: 506b234094009d55d326f1ce957f53f15d4b65ee
Time: 2018-02-26
Author: ninamio78@gmail.com
File Name: geomstats/spd_matrices_space.py
Class Name: SPDMetric
Method Name: log


Project Name: geomstats/geomstats
Commit Name: 506b234094009d55d326f1ce957f53f15d4b65ee
Time: 2018-02-26
Author: ninamio78@gmail.com
File Name: geomstats/spd_matrices_space.py
Class Name: SPDMetric
Method Name: exp