-
Notifications
You must be signed in to change notification settings - Fork 20
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
Should ABD objects optimize for when some fields are omitted? #81
Comments
@duetosymmetry - Yes that is right. I check there if self.fields_present[i]==True and skip the calculations for the corresponding field if they are not present |
I think the objective is good, but it would pay to be thoughtful about the implementation. In particular, it's dangerous to start putting in flags and branches, because it increases code complexity, and we would need to make sure that those flags are supported in every piece of code. Plus, it makes it harder to ensure that what we write reflects the mathematics. I think there's a much easier solution that should be more generic and elegant. I put some thought into the design of the base So a cleaner and simpler approach would be to subclass The big advantage of this approach is that code implementing math can be generic, free of branches, and actually look like the equations. It won't be precisely as efficient as if you special-case for 0 Newman-Penrose components, but it won't be anywhere close to a bottleneck, in either speed or memory. Obviously, I haven't actually tested these things. And in particular, it looks like |
@duetosymmetry I just realized you may want more efficiency not just on the input to this Still, it might be worth implementing this special behavior just in the |
We may be in the situation where we use and abd object to store only strain, or just strain and \psi_i through \psi_4 with some smallest value of i. In this case, there are a lot of calculations in e.g.
AsymptoticBondiData.transform()
that could be skipped. For example, in the linesscri/scri/asymptotic_bondi_data/transformations.py
Lines 325 to 336 in 6db96ad
we can simply skip all the fields which are not stored; and similarly in the lines
scri/scri/asymptotic_bondi_data/transformations.py
Lines 342 to 387 in 6db96ad
we can skip the calculations for fields \psi_j where j<i, i representing the smallest subscript of Weyl scalar we keep, as above.
If I remember correctly, @akhadse has implemented this as a speedup. Was that right, Akshay?
@moble do you think this is a feature worth having for ABD objects?
The text was updated successfully, but these errors were encountered: