MCPcopy Create free account
hub / github.com/PythonOT/POT / _func

Function _func

ot/smooth.py:333–344  ·  view source on GitHub ↗
(params)

Source from the content-addressed store, hash-verified

331 """
332
333 def _func(params):
334 # Unpack alpha and beta.
335 alpha = params[: len(a)]
336 beta = params[len(a) :]
337
338 obj, grad_alpha, grad_beta = dual_obj_grad(alpha, beta, a, b, C, regul)
339
340 # Pack grad_alpha and grad_beta.
341 grad = np.concatenate((grad_alpha, grad_beta))
342
343 # We need to maximize the dual.
344 return -obj, -grad
345
346 # Unfortunately, `minimize` only supports functions whose argument is a
347 # vector. So, we need to concatenate alpha and beta.

Callers

nothing calls this directly

Calls 3

dual_obj_gradFunction · 0.85
semi_dual_obj_gradFunction · 0.85
concatenateMethod · 0.45

Tested by

no test coverage detected