Skip to content

Commit 1ca080e

Browse files
suda-yugammcky
andauthored
[opt_transport] Replace np.sum(a * b) with np.vdot(a, b) (#475)
* Replace np.sum(a * b) with np.vdot(a, b) * add @oyamad suggestion to mention the use of vdot --------- Co-authored-by: mmcky <mamckay@gmail.com>
1 parent 245e304 commit 1ca080e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lectures/opt_transport.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -667,10 +667,12 @@ X
667667
Sure enough, we have the same solution and the same cost
668668
669669
```{code-cell} ipython3
670-
total_cost = np.sum(X * C)
670+
total_cost = np.vdot(X, C)
671671
total_cost
672672
```
673673
674+
Here we use [np.vdot](https://numpy.org/doc/stable/reference/generated/numpy.vdot.html) for the trace inner product of X and C
675+
674676
### A Larger Application
675677
676678
Now let's try using the same package on a slightly larger application.

0 commit comments

Comments
 (0)