Skip to content

zero!(Vector{<:RingElement}) #2384

@thofma

Description

@thofma

Spent an hour looking for a bug, which turned out to be coming from a line of the form

zero!(A)

where A::Vector{ZZRingElem}. This will call zero(parent(A)), which surprisingly does not fail, since parent(A) === A, and then it calls map(zero, A).

Are there objections to doing something of the form

function zero!(A::Vector{T}) where {T <: RingElement}
  for i in 1:length(A)
    A[i] = zero!(A[i])
  end
  return A
end

?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions