Skip to content

Commit 4285cf6

Browse files
committed
remove unused sparse
1 parent 3aee908 commit 4285cf6

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

ot/lp/cvx.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
try:
1515
import cvxopt
16-
from cvxopt import solvers, matrix, sparse, spmatrix
16+
from cvxopt import solvers, matrix, spmatrix
1717
except ImportError:
1818
cvxopt = False
1919

@@ -114,13 +114,15 @@ def barycenter(A, M, weights=None, verbose=False, log=False, solver='interior-po
114114
A_eq = sps.vstack((A_eq1, A_eq2))
115115
b_eq = np.concatenate((b_eq1, b_eq2))
116116

117-
if not cvxopt or solver in ['interior-point']: # cvxopt not installed or simplex/interior point
117+
if not cvxopt or solver in ['interior-point']:
118+
# cvxopt not installed or interior point
118119

119120
if solver is None:
120121
solver = 'interior-point'
121122

122123
options = {'sparse': True, 'disp': verbose}
123-
sol = sp.optimize.linprog(c, A_eq=A_eq, b_eq=b_eq, method=solver, options=options)
124+
sol = sp.optimize.linprog(c, A_eq=A_eq, b_eq=b_eq, method=solver,
125+
options=options)
124126
x = sol.x
125127
b = x[-n:]
126128

@@ -129,7 +131,9 @@ def barycenter(A, M, weights=None, verbose=False, log=False, solver='interior-po
129131
h = np.zeros((n_distributions * n2 + n))
130132
G = -sps.eye(n_distributions * n2 + n)
131133

132-
sol = solvers.lp(matrix(c), scipy_sparse_to_spmatrix(G), matrix(h), A=scipy_sparse_to_spmatrix(A_eq), b=matrix(b_eq), solver=solver)
134+
sol = solvers.lp(matrix(c), scipy_sparse_to_spmatrix(G), matrix(h),
135+
A=scipy_sparse_to_spmatrix(A_eq), b=matrix(b_eq),
136+
solver=solver)
133137

134138
x = np.array(sol['x'])
135139
b = x[-n:].ravel()

0 commit comments

Comments
 (0)