get rid of annoying warning during test
This commit is contained in:
parent
c935ba1215
commit
f23b89f055
|
@ -172,7 +172,8 @@ def scale_to_coprime(v):
|
||||||
m = (np.array(v) * reduce(lcm, map(lambda x: int(get_square_denominator(x)),v)) ** 0.5).astype(np.int)
|
m = (np.array(v) * reduce(lcm, map(lambda x: int(get_square_denominator(x)),v)) ** 0.5).astype(np.int)
|
||||||
m = m//reduce(np.gcd,m)
|
m = m//reduce(np.gcd,m)
|
||||||
|
|
||||||
if not np.allclose(v[v.nonzero()]/m[v.nonzero()],v[v.nonzero()][0]/m[m.nonzero()][0]):
|
with np.errstate(divide='ignore'):
|
||||||
|
if not np.allclose(v/m,v[0]/m[0]):
|
||||||
raise ValueError(f'Invalid result {m} for input {v}. Insufficient precision?')
|
raise ValueError(f'Invalid result {m} for input {v}. Insufficient precision?')
|
||||||
|
|
||||||
return m
|
return m
|
||||||
|
|
Loading…
Reference in New Issue