Skip to content

edit notebooks - #1646

Open
nathan-classiq wants to merge 1 commit into
mainfrom
migrate/new-execution-interface-good-first-prs-after-formatting
Open

edit notebooks#1646
nathan-classiq wants to merge 1 commit into
mainfrom
migrate/new-execution-interface-good-first-prs-after-formatting

Conversation

@nathan-classiq

Copy link
Copy Markdown
Collaborator

PR Description

Some notes

  • Please make sure that the notebook runs successfully with the latest Classiq version.

  • Please make sure that you placed the files in an appropriate folder

    • And that the file names are clear, descriptive, and match the notebook content.
      • Note that we require the file names of .ipynb and .qmod to be unique across this repository.
    • Plus, please make sure that all required files are included: .qmod, .synthesis_options.json, .metadata.json
    • And that images are embedded inside the notebook, not added as external files
  • If applicable, please include link to the paper on which the notebook is based, in the notebook itself.

  • Please use rebase on your branch (no merge commits)

  • Please link this PR to the relevant issue

  • Please make sure to run pre-commit when commiting changes

    • If you're using git in the terminal, make sure to install pre-commit via running pip install pre-commit followed by pre-commit install
    • Note that Classiq runs automatic code linting. Meaning that one of the tests verifies the output of pre-commit.
    • Also note that pre-commit may minorly alter some files. Make sure to git add the changes done by pre-commit

@review-notebook-app

Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@@ -124,7 +124,8 @@
")\n",

@nathan-classiq nathan-classiq Jul 7, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Line #6.    res_state_check = calculate_state_vector(qprog_state_check)

qprog_state_check is redundant, we could use the current model


Reply via ReviewNB

@@ -53,12 +53,15 @@
"from matplotlib.colors import LinearSegmentedColormap\n",

@nathan-classiq nathan-classiq Jul 7, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Line #11.    model = set_execution_preferences(model, execution_preferences)

set_execution_preferences is not needed


Reply via ReviewNB

@@ -53,12 +53,15 @@
"from matplotlib.colors import LinearSegmentedColormap\n",

@nathan-classiq nathan-classiq Jul 7, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Line #2.    print(dict(zip(res["bitstring"], res["counts"])))

the dataframe should be printed instead


Reply via ReviewNB

@@ -53,12 +53,15 @@
"from matplotlib.colors import LinearSegmentedColormap\n",

@nathan-classiq nathan-classiq Jul 7, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

def results_error_rate(res):

    total = res["counts"].sum()
    zeros = res[res["bitstring"] == "0"]["counts"].sum()
    return 1 - zeros / total

Reply via ReviewNB

@@ -53,12 +53,15 @@
"from matplotlib.colors import LinearSegmentedColormap\n",

@nathan-classiq nathan-classiq Jul 7, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Line #17.    model = set_execution_preferences(model, execution_preferences)

not needed


Reply via ReviewNB

@@ -53,12 +53,15 @@
"from matplotlib.colors import LinearSegmentedColormap\n",

@nathan-classiq nathan-classiq Jul 7, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Line #21.        model = set_execution_preferences(model, execution_preferences)

samem not needed


Reply via ReviewNB

"source": [
"preferences = IBMBackendPreferences(\n",
" backend_name=\"ibm_marrakesh\",\n",
"backend = \"ibm/ibm_marrakesh\"\n",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this needs to be ibm/marrakesh--verify this

"source": [
"preferences = IBMBackendPreferences(\n",
" backend_name=\"ibm_sherbrooke\",\n",
"backend = \"ibm/ibm_sherbrooke\"\n",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Similar: ibm/sherbrooke

Comment on lines +723 to +724
"backend_preferences = ClassiqBackendPreferences(\n",
" backend_name=ClassiqSimulatorBackendNames.SIMULATOR_STATEVECTOR\n",
")\n",
"\n",
"\n",
"# Construct a representation of HHL model\n",
"def state_check_model(main, backend_preferences):\n",
" qmod_state_check = create_model(\n",
" main,\n",
" execution_preferences=ExecutionPreferences(\n",
" num_shots=1, backend_preferences=backend_preferences\n",
" ),\n",
" )\n",
" return qmod_state_check"
"# No additional model wrapping is required for this state-vector verification."

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe you can delete this cell?

@@ -390,7 +372,7 @@
"metadata": {},
"source": [
"# Read results\n",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This can just be

res

Or display(res) I think

@nathan-classiq
nathan-classiq changed the base branch from migrate/new-execution-interface-good-first-prs to main July 7, 2026 12:59
@nathan-classiq
nathan-classiq force-pushed the migrate/new-execution-interface-good-first-prs-after-formatting branch from 080d89c to 3bde933 Compare July 7, 2026 13:00
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