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

Avoid if-else-end in parsevalsum/parsevalsum2 #239

Closed
navidcy opened this issue Dec 24, 2020 · 5 comments
Closed

Avoid if-else-end in parsevalsum/parsevalsum2 #239

navidcy opened this issue Dec 24, 2020 · 5 comments
Assignees
Labels

Comments

@navidcy
Copy link
Member

navidcy commented Dec 24, 2020

Any idea how to overload the parsevalsum()/parsevalsum2() functions to avoid the if statements, e.g., here:

if size(uh, 1) == grid.nkr # uh is in conjugate symmetric form

?

cc @glwagner

@glwagner
Copy link
Member

To make dispatch possible, information must be encoded via type specification.

Given an array of numbers representing a Fourier transform, there's no way to infer whether uh has the "conjugate symmetric" form or not.

Probably the right way to permit functionality like this is to use a Field abstraction (rather than just arrays) for storing data. A well-implemented Field abstraction would encode needed metadata with types, such as whether a field is real-valued in physical space.

@navidcy
Copy link
Member Author

navidcy commented Dec 30, 2020

#FourierFlows v2.0

@navidcy
Copy link
Member Author

navidcy commented Dec 30, 2020

Also #129

@navidcy
Copy link
Member Author

navidcy commented Dec 30, 2020

But for now we can write two separate functions, eg parsevalsum and parsevalsumr.

@navidcy
Copy link
Member Author

navidcy commented Mar 6, 2021

Since benchmarks in #250 didn't reveal that any benefit was gained, I'm closing this issue.

@navidcy navidcy closed this as completed Mar 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants