Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from infiniteopt:master #105

Merged
merged 1 commit into from
Aug 10, 2024
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion src/Collections/VectorTuple.jl
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ function _update_indices(inds::ContainerIndices{1, <:Vector}, i)
new_axes = deleteat!(copy(inds.axes), i)
cart_inds = CartesianIndices(new_axes)
return length(new_axes) >= 2 ? ContainerIndices(cart_inds, new_axes) : nothing
# return ContainerIndices(cart_inds, new_axes)
end

# DenseAxisArray
Expand All @@ -243,7 +244,7 @@ function restricted_copy(vt::VectorTuple, inds::AbstractVector{<:Bool})
prev_sum = 0
delete_inds = Int[]
new_ranges = copy(vt.ranges)
new_indices = collect(vt.indices)
new_indices = collect(Any, vt.indices)
for i in eachindex(new_ranges)
delete_sum = sum(inv_inds[new_ranges[i]])
if length(new_ranges[i]) == delete_sum
Expand Down
3 changes: 3 additions & 0 deletions test/Collections/VectorTuple.jl
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,9 @@
copy_inds = [false, false, true, false, true, true, false, true]
@test IC.restricted_copy(vt, copy_inds) == IC.VectorTuple(cs, new_d)
@test vt == IC.VectorTuple(a, c, d)
# test with partial reduction of an vector
vt = IC.VectorTuple([1, 2])
@test IC.restricted_copy(vt, [true, false]) == IC.VectorTuple(1)
end
end

Expand Down
Loading