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

Outsource common code to implement concretize of lazy array operations #3169

Open
schillic opened this issue Nov 1, 2022 · 0 comments
Open
Labels
refactoring 🔧 Internal code changes, typically no impact on API simplification 👶 Simplifies code

Comments

@schillic
Copy link
Member

schillic commented Nov 1, 2022

Compare:

function concretize(msa::MinkowskiSumArray)
a = array(msa)
@assert !isempty(a) "an empty Minkowski sum is not allowed"
X = msa
@inbounds for (i, Y) in enumerate(a)
if i == 1
X = concretize(Y)
else
X = minkowski_sum(X, concretize(Y))
end
end
return X
end

function concretize(cpa::CartesianProductArray)
a = array(cpa)
@assert !isempty(a) "an empty Cartesian product is not allowed"
X = cpa
@inbounds for (i, Y) in enumerate(a)
if i == 1
X = concretize(Y)
else
X = cartesian_product(X, concretize(Y))
end
end
return X
end

@schillic schillic added simplification 👶 Simplifies code refactoring 🔧 Internal code changes, typically no impact on API labels Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring 🔧 Internal code changes, typically no impact on API simplification 👶 Simplifies code
Projects
None yet
Development

No branches or pull requests

1 participant