Skip to content

Support setindex #161

Closed
Closed
@dlfivefifty

Description

@dlfivefifty

The following should be a fast way of creating e_k (the vector of all zeros but with 1 in the k-th entry):

julia> using FillArrays

julia> Base.setindex(Zeros(5), 2, 3)
ERROR: MethodError: no method matching setindex(::Zeros{Float64, 1, Tuple{Base.OneTo{Int64}}}, ::Int64, ::Int64)
Closest candidates are:
  setindex(::Tuple, ::Any, ::Integer) at tuple.jl:49
  setindex(::CartesianIndex, ::Any, ::Any) at multidimensional.jl:100
  setindex(::NamedTuple, ::Any, ::Symbol) at namedtuple.jl:355
Stacktrace:
 [1] top-level scope
   @ REPL[2]:1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions