Skip to content

Commit

Permalink
Format matrix in pairwise docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Jeffery authored and mergify[bot] committed Nov 28, 2023
1 parent 090b133 commit 070e476
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions sgkit/distance/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ def pairwise_distance(
To illustrate the algorithm consider the following (4, 5) two dimensional array:
[e.00, e.01, e.02, e.03, e.04]
[e.10, e.11, e.12, e.13, e.14]
[e.20, e.21, e.22, e.23, e.24]
[e.30, e.31, e.32, e.33, e.34]
.. code-block:: none
[e.00, e.01, e.02, e.03, e.04]
[e.10, e.11, e.12, e.13, e.14]
[e.20, e.21, e.22, e.23, e.24]
[e.30, e.31, e.32, e.33, e.34]
The rows of the above matrix are the set of vectors. Now let's label all
the vectors as v0, v1, v2, v3.
Expand All @@ -34,10 +36,12 @@ def pairwise_distance(
distance between each vector and every other vector, will result in 16
distances and the resultant array will be of size (4, 4) as follows:
[v0.v0, v0.v1, v0.v2, v0.v3]
[v1.v0, v1.v1, v1.v2, v1.v3]
[v2.v0, v2.v1, v2.v2, v2.v3]
[v3.v0, v3.v1, v3.v2, v3.v3]
.. code-block:: none
[v0.v0, v0.v1, v0.v2, v0.v3]
[v1.v0, v1.v1, v1.v2, v1.v3]
[v2.v0, v2.v1, v2.v2, v2.v3]
[v3.v0, v3.v1, v3.v2, v3.v3]
The (i, j) position in the resulting array (matrix) denotes the distance
between vi and vj vectors.
Expand Down

0 comments on commit 070e476

Please sign in to comment.