-
Notifications
You must be signed in to change notification settings - Fork 39
Introduce AbstractZeros
and AbstractOnes
#299
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #299 +/- ##
=======================================
Coverage 99.88% 99.88%
=======================================
Files 7 7
Lines 871 900 +29
=======================================
+ Hits 870 899 +29
Misses 1 1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
@dlfivefifty in the latest I did some minimal refactoring of the matrix multiplication, broadcasting, and kron code to factor out some functions which create the output fill array based on information about the element type and axes, which default to simple The output can be customized for new mult_fill(a, b, val, ax) = Fill(val, ax)
mult_zeros(a, b, elt, ax) = Zeros{elt}(ax)
mult_ones(a, b, elt, ax) = Ones{elt}(ax)
broadcasted_fill(f, a, val, ax) = Fill(val, ax)
broadcasted_fill(f, a, b, val, ax) = Fill(val, ax)
broadcasted_zeros(f, a, elt, ax) = Zeros{elt}(ax)
broadcasted_zeros(f, a, b, elt, ax) = Zeros{elt}(ax)
broadcasted_ones(f, a, elt, ax) = Ones{elt}(ax)
broadcasted_ones(f, a, b, elt, ax) = Ones{elt}(ax)
kron_fill(a, b, val, ax) = Fill(val, ax)
kron_zeros(a, b, elt, ax) = Zeros{elt}(ax)
kron_ones(a, b, elt, ax) = Ones{elt}(ax) on I definitely understand that exposing an interface that is meant to be overloaded by end users is a big commitment for a package like this, open to suggestions about that. |
The fact that the IntegrationTest's pass means this change is "safe" (or lets say "safe enough"). Remember you will likely be the only "end user" of this functionality.... so arguably its fine to add this functionality without advertising it.... I looked through and I don't think I have any comments about it but hopefully someone else will review it. |
Makes sense to keep this as a private interface for now. |
I guess this is waiting on a second review? Would be nice to get this merged so we can start using it in some code we are developing in ITensors.jl. |
Can you bump the minor version number? |
Done. |
This introduces
AbstactZeros
andAbstractOnes
as proposed in #298.For now, it just replaces function signatures that were specialized to
Zeros
andOnes
withAbstactZeros
andAbstractOnes
. I'm currently testing out what it is like to define customAbstractZeros
andAbstractOnes
subtypes and have those types preserved through operations, which would require deeper changes. Perhaps that could make use of ArrayLayouts.jl.