Skip to content

Commit 2535517

Browse files
committed
Fix for unset_flag!, better docstring
1 parent 86d97ae commit 2535517

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

src/threadsafe.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,10 @@ end
190190
values_as(vi::ThreadSafeVarInfo) = values_as(vi.varinfo)
191191
values_as(vi::ThreadSafeVarInfo, ::Type{T}) where {T} = values_as(vi.varinfo, T)
192192

193-
function unset_flag!(vi::ThreadSafeVarInfo, vn::VarName, flag::String)
194-
return unset_flag!(vi.varinfo, vn, flag)
193+
function unset_flag!(
194+
vi::ThreadSafeVarInfo, vn::VarName, flag::String, ignoreable::Bool=false
195+
)
196+
return unset_flag!(vi.varinfo, vn, flag, ignoreable)
195197
end
196198
function is_flagged(vi::ThreadSafeVarInfo, vn::VarName, flag::String)
197199
return is_flagged(vi.varinfo, vn, flag)

src/varnamedvector.jl

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ struct VarNamedVector{
4646

4747
"""
4848
vector of transformations, so that `transforms[varname_to_index[vn]]` is a callable
49-
that transformes the value of `vn` back to its original space, undoing any linking and
49+
that transforms the value of `vn` back to its original space, undoing any linking and
5050
vectorisation
5151
"""
5252
transforms::TTrans
@@ -62,8 +62,8 @@ struct VarNamedVector{
6262
"""
6363
mapping from a variable index to the number of inactive entries for that variable.
6464
Inactive entries are elements in `vals` that are not part of the value of any variable.
65-
They arise when transformations change the dimension of the value stored. In active
66-
entries always come after the last active entry for the given variable.
65+
They arise when a variable is set to a new value with a different dimension, in-place.
66+
Inactive entries always come after the last active entry for the given variable.
6767
"""
6868
num_inactive::OrderedDict{Int,Int}
6969

@@ -149,7 +149,7 @@ function VarNamedVector(
149149
)
150150
end
151151

152-
# TODO(mhauru) Are we sure we want the last one to be of type Any[]? Might this call
152+
# TODO(mhauru) Are we sure we want the last one to be of type Any[]? Might this cause
153153
# unnecessary type instability?
154154
function VarNamedVector{K,V}() where {K,V}
155155
return VarNamedVector(OrderedDict{K,Int}(), K[], UnitRange{Int}[], V[], Any[])
@@ -205,7 +205,6 @@ function ==(vnv_left::VarNamedVector, vnv_right::VarNamedVector)
205205
vnv_left.num_inactive == vnv_right.num_inactive
206206
end
207207

208-
# Some `VarNamedVector` specific functions.
209208
getidx(vnv::VarNamedVector, vn::VarName) = vnv.varname_to_index[vn]
210209

211210
getrange(vnv::VarNamedVector, idx::Int) = vnv.ranges[idx]
@@ -219,8 +218,8 @@ gettransform(vnv::VarNamedVector, vn::VarName) = gettransform(vnv, getidx(vnv, v
219218
"""
220219
istrans(vnv::VarNamedVector, vn::VarName)
221220
222-
Return a boolean for whether `vn` is guaranteed to have been transformed so that all of
223-
Euclidean space is its domain.
221+
Return a boolean for whether `vn` is guaranteed to have been transformed so that its domain
222+
is all of Euclidean space.
224223
"""
225224
istrans(vnv::VarNamedVector, vn::VarName) = vnv.is_unconstrained[getidx(vnv, vn)]
226225

@@ -289,7 +288,6 @@ Base.length(vnv::VarNamedVector) =
289288
Base.size(vnv::VarNamedVector) = (length(vnv),)
290289
Base.isempty(vnv::VarNamedVector) = isempty(vnv.varnames)
291290

292-
# TODO: We should probably remove this
293291
Base.IndexStyle(::Type{<:VarNamedVector}) = IndexLinear()
294292

295293
# Dictionary interface.
@@ -686,6 +684,9 @@ function nextrange(vnv::VarNamedVector, x)
686684
return (offset + 1):(offset + length(x))
687685
end
688686

687+
# TODO(mhauru) Might add another specialisation to _compose_no_identity, where if
688+
# ReshapeTransforms are composed with each other or with a an UnwrapSingeltonTransform, only
689+
# the latter one would be kept.
689690
"""
690691
_compose_no_identity(f, g)
691692

0 commit comments

Comments
 (0)