c86fbbe0c0bca22391d46177c8850d71c33b2e1d,geomstats/geometry/riemannian_metric.py,RiemannianMetric,inner_product,#RiemannianMetric#Any#Any#Any#,64

Before Change


        inner_prod_mat = gs.to_ndarray(inner_prod_mat, to_ndim=3)
        n_mats = gs.shape(inner_prod_mat)[0]

        n_inner_prod = gs.maximum(n_tangent_vec_a, n_tangent_vec_b)
        n_inner_prod = gs.maximum(n_inner_prod, n_mats)

        n_tiles_a = gs.divide(n_inner_prod, n_tangent_vec_a)
        n_tiles_a = gs.cast(n_tiles_a, gs.int32)

After Change


        inner_prod_mat = gs.to_ndarray(inner_prod_mat, to_ndim=3)
        n_mats = gs.shape(inner_prod_mat)[0]

        if n_tangent_vec_a != n_mats:
            if n_tangent_vec_a == 1:
                tangent_vec_a = gs.squeeze(tangent_vec_a, axis=0)
                einsum_str_a = "j,njk->nk"
            elif n_mats == 1:
                inner_prod_mat = gs.squeeze(inner_prod_mat, axis=0)
                einsum_str_a = "nj,jk->nk"
            else:
                raise ValueError("Shape mismatch for einsum.")

        aux = gs.einsum("nj,njk->nk", tangent_vec_a, inner_prod_mat)


        inner_prod = gs.einsum("nk,nk->n", aux, tangent_vec_b)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 7

Instances


Project Name: geomstats/geomstats
Commit Name: c86fbbe0c0bca22391d46177c8850d71c33b2e1d
Time: 2020-01-17
Author: ninamio78@gmail.com
File Name: geomstats/geometry/riemannian_metric.py
Class Name: RiemannianMetric
Method Name: inner_product


Project Name: geomstats/geomstats
Commit Name: 072e5680310c1cefef7e520c16bb20e92da3016d
Time: 2020-01-17
Author: ninamio78@gmail.com
File Name: geomstats/geometry/hypersphere.py
Class Name: HypersphereMetric
Method Name: exp


Project Name: scipy/scipy
Commit Name: c8426fe3f2e6d8073fa8bdbd2f53f62e4df1051f
Time: 2015-07-28
Author: n59_ru@hotmail.com
File Name: scipy/optimize/_lsq_dogbox.py
Class Name:
Method Name: dogbox