Skip to content

Commit e2e0ed3

Browse files
committed
Fix collect(::MonomialVector)
1 parent 7926df5 commit e2e0ed3

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "DynamicPolynomials"
22
uuid = "7c1d4256-1411-5781-91ec-d7bc3513ac07"
33
repo = "https://github.com/JuliaAlgebra/DynamicPolynomials.jl.git"
4-
version = "0.3.7"
4+
version = "0.3.8"
55

66
[deps]
77
DataStructures = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8"

src/monovec.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,11 @@ end
3939
# `mutable_copy` recursively copies the vector or vector of integers.
4040
MA.mutable_copy(m::MV) where {MV<:MonomialVector} = MV(copy(m.vars), MA.mutable_copy(m.Z))
4141
Base.copy(m::MonomialVector) = MA.mutable_copy(m)
42-
function Base.getindex(x::MV, I) where {MV<:MonomialVector}
43-
MV(x.vars, x.Z[sort(I)])
42+
function Base.getindex(x::MonomialVector, I)
43+
return typeof(x)(x.vars, x.Z[sort(I)])
4444
end
4545
Base.getindex(x::MonomialVector, i::Integer) = Monomial(x.vars, x.Z[i])
46+
Base.getindex(x::MonomialVector, i::CartesianIndex{1}) = x[i.I[1]]
4647

4748
Base.firstindex(x::MonomialVector) = firstindex(x.Z)
4849
Base.lastindex(x::MonomialVector) = lastindex(x.Z)

0 commit comments

Comments
 (0)