diff --git a/.gitignore b/.gitignore index 7da1b34..1a8589f 100644 --- a/.gitignore +++ b/.gitignore @@ -102,3 +102,6 @@ ENV/ # pytest .pytest_cache/ + +# PyCharm +pylocus/.idea/ diff --git a/pylocus/algorithms.py b/pylocus/algorithms.py index cc71def..5cdb63a 100644 --- a/pylocus/algorithms.py +++ b/pylocus/algorithms.py @@ -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 diff --git a/pylocus/edm_completion.py b/pylocus/edm_completion.py index c64a83e..ea73812 100644 --- a/pylocus/edm_completion.py +++ b/pylocus/edm_completion.py @@ -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) @@ -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) diff --git a/pylocus/lateration.py b/pylocus/lateration.py index 5147da8..ec44866 100644 --- a/pylocus/lateration.py +++ b/pylocus/lateration.py @@ -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))