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

Add option to zero-initialize new elements created by resizeAndPreserve. #90

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

aaronmswan
Copy link

I found it useful to have new elements of an array created by resizeAndPreserve zero-initialize on request. For example when performing FFT interpolation. This can be a bit of a pain to do after the fact because multiple regions could need to be zeroed. I suppose this behavior could also be achieved externally to the library by re-implementing most of what resizeAndPreserve currently does.

Testing: passes "make check-testsuite".

Updated documentation.

Grateful for any feedback.

@slayoo
Copy link
Member

slayoo commented Nov 12, 2018

Thank you!
Let me though suggest adding a test program so that the new functionality will be covered.

Also, thinking out loud, I'm wondering if we could make the API more general by e.g. making the new argument an element-type pointer: if ==null nothing happens, while non-null value gives the user the option to provide a non-zero value for initialisation? @citibeth - any comments?

@citibeth
Copy link
Contributor

Not sure what I think of it in the current context... This is the kind of change that could have unintended consequences. For example, what if someone wants to make blitz::Array<MyStruct,1>???

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.

3 participants