Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memof fix #28

Merged
merged 3 commits into from
Jan 27, 2016
Merged

Memof fix #28

merged 3 commits into from
Jan 27, 2016

Conversation

ipelupessy
Copy link
Member

fix for fail of:

import numpy
from amuse.units import units

n=10000

for i in range(n):
  vec_i = numpy.random.random(size=[3]) | units.none
  print i, vec_i, vec_i.lengths(), vec_i.lengths().value_in(units.none)

another way to fix this would be to replace the various instances of none_unit('none','none') in e.g. to_simple_form in units/core.py...

@launerbie
Copy link
Contributor

This reply won't help the issue a single bit, but if you're only interested in the magnitude of the vectors in units.none, this will work around the problem:

import numpy
from amuse.units import units

n = 10000
vectors = numpy.random.random(size=(n, 3))
vec_lengths = numpy.linalg.norm(vectors, axis=1) |units.none

@jilkoval
Copy link
Contributor

The fix is working for my problem. Thanks.

arjenve added a commit that referenced this pull request Jan 27, 2016
@arjenve arjenve merged commit 2e9c0aa into amusecode:master Jan 27, 2016
@ipelupessy ipelupessy deleted the memof_fix branch January 27, 2016 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants