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

Make MaxSens partition an iterator #147

Open
tomerarnon opened this issue Aug 3, 2020 · 0 comments
Open

Make MaxSens partition an iterator #147

tomerarnon opened this issue Aug 3, 2020 · 0 comments

Comments

@tomerarnon
Copy link
Collaborator

It would be twice as efficient not to have to allocate the partitioned hyperrectangles. Something like

function Base.iterate(P::HyperrectanglePartition, i = 1)
    # Or whatever variables make the most sense:
    low, high = P.low, P.high
    N, Δ, CI = P.N, P.Δ, P.CI

    i > N && return nothing

    I = collect(Tuple(CI[i])) .- 1
    local_lower = @. min(low + Δ*I,       high)
    local_upper = @. min(local_lower + Δ, high)
    H = Hyperrectangle(low = local_lower, high = local_upper)

    return H, i+1
end

Then we allocate only the end result of map(forward_network, iter).

Other potential names: DividedHyperrectangle, SubHyperrectangles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant