mirror of
https://github.com/Brandon-Rozek/matmod.git
synced 2025-12-13 04:50:25 +00:00
Optimization in computing meets and joins
This commit is contained in:
parent
bf2735023f
commit
51c26dd9fc
1 changed files with 12 additions and 0 deletions
12
model.py
12
model.py
|
|
@ -129,6 +129,12 @@ class OrderTable:
|
||||||
|
|
||||||
candidates = X.intersection(Y)
|
candidates = X.intersection(Y)
|
||||||
|
|
||||||
|
if not candidates:
|
||||||
|
return None
|
||||||
|
|
||||||
|
if len(candidates) == 1:
|
||||||
|
return next(iter(candidates))
|
||||||
|
|
||||||
# Grab all elements greater than each of the candidates
|
# Grab all elements greater than each of the candidates
|
||||||
candidate_ge_maps = (self.ge_map[candidate] for candidate in candidates)
|
candidate_ge_maps = (self.ge_map[candidate] for candidate in candidates)
|
||||||
common_ge_values = reduce(set.intersection, candidate_ge_maps)
|
common_ge_values = reduce(set.intersection, candidate_ge_maps)
|
||||||
|
|
@ -147,6 +153,12 @@ class OrderTable:
|
||||||
|
|
||||||
candidates = X.intersection(Y)
|
candidates = X.intersection(Y)
|
||||||
|
|
||||||
|
if not candidates:
|
||||||
|
return None
|
||||||
|
|
||||||
|
if len(candidates) == 1:
|
||||||
|
return next(iter(candidates))
|
||||||
|
|
||||||
# Grab all elements smaller than each of the candidates
|
# Grab all elements smaller than each of the candidates
|
||||||
candidate_le_maps = (self.le_map[candidate] for candidate in candidates)
|
candidate_le_maps = (self.le_map[candidate] for candidate in candidates)
|
||||||
common_le_values = reduce(set.intersection, candidate_le_maps)
|
common_le_values = reduce(set.intersection, candidate_le_maps)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue