-
Notifications
You must be signed in to change notification settings - Fork 47
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
Add BasePass.get_pre_conditions
and BasePass.get_post_conditions
#1689
Changes from 3 commits
e494551
da64baa
135fa39
801bb2a
297cd4e
34ed2c2
b07b052
04d318b
ea9700d
3ca2716
e94838a
a94fa69
c41dab2
376d87c
d104331
2e4ca31
dc05f2f
ed275e6
f0fb617
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -268,6 +268,32 @@ PYBIND11_MODULE(passes, m) { | |||||
return py::cast(serialise(base_pass)); | ||||||
}, | ||||||
":return: A JSON serializable dictionary representation of the Pass.") | ||||||
.def( | ||||||
"get_pre_conditions", | ||||||
sjdilkes marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
[](const BasePass &base_pass) { | ||||||
std::vector<PredicatePtr> pre_conditions; | ||||||
for (const std::pair< | ||||||
const std::type_index, std::shared_ptr<tket::Predicate>> | ||||||
&p : base_pass.get_conditions().first) { | ||||||
pre_conditions.push_back(p.second); | ||||||
} | ||||||
return pre_conditions; | ||||||
}, | ||||||
"Returns the pre condition Predicates for the given pass." | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||||||
"\n:return: A list of Predicate") | ||||||
.def( | ||||||
"get_post_conditions", | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||||||
[](const BasePass &base_pass) { | ||||||
std::vector<PredicatePtr> post_conditions; | ||||||
for (const std::pair< | ||||||
const std::type_index, std::shared_ptr<tket::Predicate>> & | ||||||
p : base_pass.get_conditions().second.specific_postcons_) { | ||||||
post_conditions.push_back(p.second); | ||||||
} | ||||||
return post_conditions; | ||||||
}, | ||||||
"Returns the post condition Predicates for the given pass." | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||||||
"\n:return: A list of Predicate") | ||||||
sjdilkes marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
.def_static( | ||||||
"from_dict", | ||||||
[](const py::dict &base_pass_dict, | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ | |
|
||
class TketConan(ConanFile): | ||
name = "tket" | ||
version = "1.3.48" | ||
version = "1.3.49" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This version bump shouldn't be necessary as the change only touches pytket. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oops ofc - will revert |
||
package_type = "library" | ||
license = "Apache 2" | ||
homepage = "https://github.com/CQCL/tket" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is also worth adding a function specifically to get the gate-set requirements of a pass; i.e. which gets the preconditions, checks for any
GateSetPredicate
s, and returns the set intersection of their gate sets (orNone
if there are noGateSetPredicate
s.)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done