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

Use inplace conversion #27

Merged
merged 7 commits into from
Nov 4, 2024
Merged

Use inplace conversion #27

merged 7 commits into from
Nov 4, 2024

Conversation

Tortar
Copy link
Collaborator

@Tortar Tortar commented Nov 3, 2024

This has some good impact on performance (something like 20% less time)

Copy link
Collaborator

@Devetak Devetak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi! Its not clear what the pos! function does since it is both in place and returns an array.

@Tortar
Copy link
Collaborator Author

Tortar commented Nov 4, 2024

I add some docs

@Devetak
Copy link
Collaborator

Devetak commented Nov 4, 2024

Woudn't be better if the function was either pure or in-place with no return. Looking at the use I would say

expression = pos_inplace(a / sum(a))
# transfor to
expression .= a / sum(a) # in - place 
pos_inplace!(expression)

@Tortar
Copy link
Collaborator Author

Tortar commented Nov 4, 2024

added some docs and put it next to the not-in-place version

@Tortar
Copy link
Collaborator Author

Tortar commented Nov 4, 2024

We need the return, otherwise we couldn't use it inside other computations

@Tortar
Copy link
Collaborator Author

Tortar commented Nov 4, 2024

it's also conventional in Julia (I think for this reason)

@Devetak Devetak merged commit 8ec4dc0 into bancaditalia:main Nov 4, 2024
2 checks passed
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.

2 participants