zero_elements += bvec
A = []
b = []
zero = []
for i, is_zero in enumerate(zero_elements):
if is_zero:
eq = np.zeros(n_elements, dtype=int)
eq[i] = 1
A.append(eq)
b.append(0)
zero.append(i)
if A:
A = np.asarray(A)
b = np.asarray(b)
else:
A = None
b = None
zeroset = set(zero)
nonzero = [i for i in range(n_elements) if i not in zeroset]
variables = Bunch(nonzero=nonzero, zero=zero)
return A, b, variables
def initial_point(dist, k, A=None, b=None, isolated=None, **kwargs):
After Change
xopt[np.abs(xopt) < tol] = 0
xopt /= xopt.sum()
// Do not build the full vector since this is input to the reduced
// optimization problem.
//xx = np.zeros(len(dist.pmf))
//xx[variables.nonzero] = xopt