Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/oneelement.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,26 @@

OneElement(val, inds::NTuple{N,Int}, sz::NTuple{N,Integer}) where N = OneElement(val, inds, oneto.(sz))
"""
OneElement(val, ind::Int, n::Int)
OneElement(val, ind::Int, n::Integer)

Creates a length `n` vector where the `ind` entry is equal to `val`, and all other entries are zero.
"""
OneElement(val, ind::Int, len::Int) = OneElement(val, (ind,), (len,))
OneElement(val, ind::Int, len::Integer) = OneElement(val, (ind,), (len,))

Check warning on line 26 in src/oneelement.jl

View check run for this annotation

Codecov / codecov/patch

src/oneelement.jl#L26

Added line #L26 was not covered by tests
"""
OneElement(ind::Int, n::Int)
OneElement(ind::Int, n::Integer)

Creates a length `n` vector where the `ind` entry is equal to `1`, and all other entries are zero.
"""
OneElement(inds::Int, sz::Int) = OneElement(1, inds, sz)
OneElement(inds::Int, sz::Integer) = OneElement(1, inds, sz)

Check warning on line 32 in src/oneelement.jl

View check run for this annotation

Codecov / codecov/patch

src/oneelement.jl#L32

Added line #L32 was not covered by tests
OneElement{T}(val, inds::NTuple{N,Int}, sz::NTuple{N,Integer}) where {T,N} = OneElement(convert(T,val), inds, oneto.(sz))
OneElement{T}(val, inds::Int, sz::Int) where T = OneElement{T}(val, (inds,), (sz,))
OneElement{T}(val, inds::Int, sz::Integer) where T = OneElement{T}(val, (inds,), (sz,))

Check warning on line 34 in src/oneelement.jl

View check run for this annotation

Codecov / codecov/patch

src/oneelement.jl#L34

Added line #L34 was not covered by tests

"""
OneElement{T}(ind::Int, n::Int)

Creates a length `n` vector where the `ind` entry is equal to `one(T)`, and all other entries are zero.
"""
OneElement{T}(inds::Int, sz::Int) where T = OneElement(one(T), inds, sz)
OneElement{T}(inds::Int, sz::Integer) where T = OneElement(one(T), inds, sz)

Check warning on line 41 in src/oneelement.jl

View check run for this annotation

Codecov / codecov/patch

src/oneelement.jl#L41

Added line #L41 was not covered by tests

Base.size(A::OneElement) = map(length, A.axes)
Base.axes(A::OneElement) = A.axes
Expand Down
Loading