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

fix nan problem, the static int approach #18

Merged
merged 1 commit into from
Nov 2, 2021
Merged

Conversation

GiggleLiu
Copy link
Member

No description provided.

Octavian.matmul!(o, a, b, α, β)
end
end
end
# NOTE: benchmark shows, the type instability here can be optimized by the compiler
# so you do not need to worry about the overheads.
Copy link
Collaborator

Choose a reason for hiding this comment

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

It still makes me nervous, but it is good at optimizing small unions. Most obviously, for loops all have unions.

But is this really what you want?
That alpha isn't allowed to be anything other than 0 or 1?

Copy link
Member Author

@GiggleLiu GiggleLiu Nov 2, 2021

Choose a reason for hiding this comment

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

I compare this version with the explicit version with if ... else .... Both cases does not introduce new allocations. So I think it is safe to do so.

Yes, I am sure this is what I want. Actually, here alpha can be a tropical number. A Tropical number is a semiring that can not be converted to/from a regular number. When the input is a regular number, I just want to to treat the zero element and one element properly. There is a correspondence of zero-element and one element in different algebras, but not for other numbers.

@GiggleLiu GiggleLiu merged commit 671326f into master Nov 2, 2021
This pull request was closed.
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