r""" Retrieve optimal transportation plan from optimal dual potentials. Parameters ---------- alpha: array, shape = len(a) beta: array, shape = len(b) Optimal dual potentials. C: array, shape = (len(a), len(b)) Ground cost matrix. regul: Regularization ob
(alpha, beta, C, regul)
| 451 | |
| 452 | |
| 453 | def get_plan_from_dual(alpha, beta, C, regul): |
| 454 | r""" |
| 455 | Retrieve optimal transportation plan from optimal dual potentials. |
| 456 | |
| 457 | Parameters |
| 458 | ---------- |
| 459 | alpha: array, shape = len(a) |
| 460 | beta: array, shape = len(b) |
| 461 | Optimal dual potentials. |
| 462 | C: array, shape = (len(a), len(b)) |
| 463 | Ground cost matrix. |
| 464 | regul: Regularization object |
| 465 | Should implement a `delta_Omega(X)` method. |
| 466 | |
| 467 | Returns |
| 468 | ------- |
| 469 | T: array, shape = (len(a), len(b)) |
| 470 | Optimal transportation plan. |
| 471 | """ |
| 472 | X = alpha[:, np.newaxis] + beta - C |
| 473 | return regul.delta_Omega(X)[1] |
| 474 | |
| 475 | |
| 476 | def get_plan_from_semi_dual(alpha, b, C, regul): |
no test coverage detected