Skip to content

zero is not recursive #38064

@oxinabox

Description

@oxinabox

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 + recursively

However we do not do the same for zero, which is a fundermental vector space operation.

julia> zero([2,2])
2-element Array{Int64,1}:
 0
 0

julia> zero([[2,2], [3,3,3]])
ERROR: MethodError: no method matching zero(::Type{Array{Int64,1}})

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 it

Metadata

Metadata

Assignees

No one assigned

    Labels

    arrays[a, r, r, a, y, s]

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions