Skip to content

Commit

Permalink
Merge pull request #23 from Ceow/master
Browse files Browse the repository at this point in the history
Little fixes
  • Loading branch information
duembgen authored Nov 9, 2018
2 parents 5790607 + 36e75cf commit c56a38c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,6 @@ ENV/

# pytest
.pytest_cache/

# PyCharm
pylocus/.idea/
3 changes: 2 additions & 1 deletion pylocus/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ def execute_method(method, measured_matrix=None, all_points=None, W=None, **kwar
xhat, costs = reconstruct_dwmds(measured_matrix, W=W, X0=X0, **kwargs)
if method == 'SRLS':
n = kwargs.get('n', 1)
z = kwargs.get('z', None)
rescale = kwargs.get('rescale', False)
xhat = reconstruct_srls(measured_matrix, all_points,
n=n, W=W, rescale=rescale)
n=n, W=W, rescale=rescale, z=z)
return xhat


Expand Down
6 changes: 3 additions & 3 deletions pylocus/edm_completion.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,11 @@ def kappa_cvx(gram, n):

if method == 'maximize':
obj = Maximize(trace(H) - lamda *
norm(multiply(W, (edm_optimize - edm_missing))))
norm(multiply(W, (edm_optimize - edm_missing)), p=1))
# TODO: add a reference to paper where "minimize" is used instead of maximize.
elif method == 'minimize':
obj = Minimize(trace(H) + lamda *
norm(multiply(W, (edm_optimize - edm_missing))))
norm(multiply(W, (edm_optimize - edm_missing)), p=1))

prob = Problem(obj)

Expand All @@ -136,7 +136,7 @@ def kappa_cvx(gram, n):
if H.value is not None:
print('trace of H:', np.trace(H.value))
print('other cost:', lamda *
norm(multiply(W, (edm_complete - edm_missing))).value)
norm(multiply(W, (edm_complete - edm_missing)), p=1).value)

return np.array(edm_complete)

Expand Down
5 changes: 4 additions & 1 deletion pylocus/lateration.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,12 @@ def phi_prime(_lambda):
if rescale and n < d + 2:
raise ValueError(
'A minimum of d + 2 ranges are necessary for rescaled ranging.')
elif n < d + 1:
elif n < d + 1 and z is None:
raise ValueError(
'A minimum of d + 1 ranges are necessary for ranging.')
elif n < d:
raise ValueError(
'A minimum of d ranges are necessary for ranging.')

Sigma = np.diagflat(np.power(w, 0.5))

Expand Down

0 comments on commit c56a38c

Please sign in to comment.