Skip to content

Commit

Permalink
overload for OneElement matrices
Browse files Browse the repository at this point in the history
  • Loading branch information
max-vassili3v committed Aug 13, 2024
1 parent f659d9f commit 52314a5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/FillArrays.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Base: size, getindex, setindex!, IndexStyle, checkbounds, convert,
any, all, axes, isone, iszero, iterate, unique, allunique, permutedims, inv,
copy, vec, setindex!, count, ==, reshape, map, zero,
show, view, in, mapreduce, one, reverse, promote_op, promote_rule, repeat,
parent, similar, issorted, add_sum, accumulate, OneTo
parent, similar, issorted, add_sum, accumulate, OneTo, permutedims

import LinearAlgebra: rank, svdvals!, tril, triu, tril!, triu!, diag, transpose, adjoint, fill!,
dot, norm2, norm1, normInf, normMinusInf, normp, lmul!, rmul!, diagzero, AdjointAbsVec, TransposeAbsVec,
Expand Down
4 changes: 4 additions & 0 deletions src/oneelement.jl
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,10 @@ function Base.reshape(A::OneElement, shape::Tuple{Vararg{Int}})
OneElement(A.val, Tuple(newcartind), shape)
end

#permute

permutedims(o::OneElementMatrix) = OneElement(o.val, reverse(o.ind), o.axes)

Check warning on line 431 in src/oneelement.jl

View check run for this annotation

Codecov / codecov/patch

src/oneelement.jl#L431

Added line #L431 was not covered by tests

# show
_maybesize(t::Tuple{Base.OneTo{Int}, Vararg{Base.OneTo{Int}}}) = size.(t,1)
_maybesize(t) = t
Expand Down

0 comments on commit 52314a5

Please sign in to comment.