-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
zero is not recursive #38064
Comments
It would be great to have a formal vector space interface for generic julia types. In a different context than AD, over at KrylovKit.jl, I also tried to formalize the set of methods that a type needs to satisfy in order for it to be used in the KrylovKit.jl methods. I there chose to use |
This is the wrong venue for that discussion. |
You are absolutely right, my apologies for sidetracking. I'll try to find you on Zulip. |
Just zero(x::AbstractArray{T}) where {T} = map!(zero, similar(x), x) ? Some very brief benchmarking indicates that this might be around 10% slower for |
I wonder if this breaks things, in practice. It shouldn't. Since old code behavior errored for the cases I am aware of. As discussed in #38064, this definition is needed to be consistent with our other linear algebra operations, and with us considering a vector of vectors etc as a vector space. Closes #38064
An array of arrays is a valid vector space.
Even an array of arrays of different sizes.
This is why we define
transpose
,adjoint
,dot
and+
recursivelyHowever we do not do the same for
zero
, which is a fundermental vector space operation.This is a problem for AD purposes.
Types that are used to represent a tangent/cotangent need to have the basic vector space operations defined on them.
So if we want to say that the cotangent of an array of arrays of numbers is an an array of arrays of numbers then we should really have
zero
on itThe text was updated successfully, but these errors were encountered: