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

Steve/jupyter notebook tutorial part 4 #15

Merged
merged 12 commits into from
Aug 17, 2023

Conversation

qwang98
Copy link
Owner

@qwang98 qwang98 commented Aug 15, 2023

WIP

@@ -82,10 +83,21 @@ def pragma_disable_q_enable(self: Circuit) -> None:

def add(self: Circuit, step_type: StepType, args: Any):
assert self.mode == CircuitMode.Trace
if self.num_step_instances >= self.ast.num_steps:
raise ValueError(f"Number of step instances exceeds {self.ast.num_steps}")
self.num_step_instances += 1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@qwang98 isn' this the lenght of the self.witness.step_instances array? I don't think we need to keep self.num_step_instances.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deleted this field and use len(self.witness.step_instances) instead! Thanks. :)

@@ -22,6 +22,7 @@ def __init__(self: Circuit):
self.ast = ASTCircuit()
self.witness = TraceWitness()
self.rust_ast_id = 0
self.num_step_instances = 0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@qwang98 remember that all the witness generation fields have to be reset after a witness is generated because we can generate more than a witness for the circuit

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't an issue, because TraceWitness() constructor creates an empty default witness before calling trace:

def gen_witness(self: Circuit, args: Any) -> TraceWitness:
        self.mode = CircuitMode.Trace
        self.witness = TraceWitness()
        # ...

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but it does not set num_step_instances to 0.

@leolara
Copy link
Collaborator

leolara commented Aug 16, 2023

The files conflict with the new files layout

@qwang98
Copy link
Owner Author

qwang98 commented Aug 17, 2023

The files conflict with the new files layout

Fixed.

@qwang98
Copy link
Owner Author

qwang98 commented Aug 17, 2023

@leolara Ready for review again. All tutorials first pass done.

@@ -23,6 +22,7 @@ def __init__(self: Circuit):
self.ast = ASTCircuit()
self.witness = TraceWitness()
self.rust_ast_id = 0
self.num_step_instances = 0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@qwang98 it seems we don't need this field anymore

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surprises me why I didn't remove it already but fixed and thanks for catching. :)

@qwang98 qwang98 requested a review from leolara August 17, 2023 04:45
@leolara
Copy link
Collaborator

leolara commented Aug 17, 2023

@qwang98 this is approved

@qwang98
Copy link
Owner Author

qwang98 commented Aug 17, 2023

@qwang98 this is approved

Thanks! Will merge soon as I just finished the instance issue for core Chiquito. Need to update dependency here as well.

@qwang98 qwang98 merged commit 09ef47a into main Aug 17, 2023
1 of 11 checks passed
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

Successfully merging this pull request may close these issues.

2 participants