From 4aa4c3cbcc48c5ed793e60591203b337db54fc95 Mon Sep 17 00:00:00 2001 From: Roland Guichard Date: Mon, 9 Oct 2023 15:20:45 +0100 Subject: [PATCH] Fix conflicts. --- docs/tutorials/getting_started.md | 54 ------------------------------- 1 file changed, 54 deletions(-) diff --git a/docs/tutorials/getting_started.md b/docs/tutorials/getting_started.md index c3e03c14..bace4776 100644 --- a/docs/tutorials/getting_started.md +++ b/docs/tutorials/getting_started.md @@ -100,13 +100,8 @@ each sub-block and results in a `AddBlock` type which can be used to construct P Please note that `AddBlock` can give rise to non-unitary computations that might not be supported by all backends. ??? note "Get the matrix of a block" -<<<<<<< HEAD It is always possible to retrieve the matrix representation of a block by calling the `block.tensor()` method. Please note that the returned tensor contains a batch dimension for the purposes of block parametrization. -======= - It is always possible to retrieve the matrix representation of a block. Please note that the returned tensor - contains a batch dimension for the purposes of block parametrization. ->>>>>>> main ```python exec="on" source="material-block" result="json" session="i-xx" print(f"X(0) * X(0) tensor = {chain_x.tensor()}") # markdown-exec: hide @@ -207,52 +202,3 @@ print(f"{xs = }") # markdown-exec: hide ``` For more details on `QuantumModel`, see [here](/tutorials/quantummodels). -<<<<<<< HEAD -======= - -## State initialization - -Qadence offers convenience routines for preparing initial quantum states. -These routines are divided into two approaches: - -- As a dense matrix. -- From a suitable quantum circuit. This is available for every backend and it should be added -in front of the desired quantum circuit to simulate. - -Let's illustrate the usage of the state preparation routine. For more details, -please refer to the [API reference](/qadence/index). - -```python exec="on" source="material-block" result="json" session="seralize" -from qadence import random_state, product_state, is_normalized, StateGeneratorType - -# Random initial state. -# the default `type` is StateGeneratorType.HaarMeasureFast -state = random_state(n_qubits=2, type=StateGeneratorType.RANDOM_ROTATIONS) -print(f"{Random initial state generated with rotations:\n {state.detach().numpy().flatten()}}") # markdown-exec: hide - -# Check the normalization. -assert is_normalized(state) - -# Product state from a given bitstring. -# NB: Qadence follows the big endian convention. -state = product_state("01") -print(f"{Product state corresponding to bitstring '10':\n {state.detach().numpy().flatten()}}") # markdown-exec: hide -``` - -Now we see how to generate the product state corresponding to the one above with -a suitable quantum circuit. - -```python -from qadence import product_block, tag, QuantumCircuit - -state_prep_b = product_block("10") -display(state_prep_b) - -# let's now prepare a circuit -state_prep_b = product_block("1000") -tag(state_prep_b, "prep") -qc_with_state_prep = QuantumCircuit(4, state_prep_b, fourier_b, hea_b) - -print(html_string(qc_with_state_prep), size="4,4")) # markdown-exec: hide -``` ->>>>>>> main