Skip to content

Commit

Permalink
Fix conflicts.
Browse files Browse the repository at this point in the history
  • Loading branch information
RolandMacDoland committed Oct 9, 2023
1 parent 359ad97 commit 4aa4c3c
Showing 1 changed file with 0 additions and 54 deletions.
54 changes: 0 additions & 54 deletions docs/tutorials/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit 4aa4c3c

Please sign in to comment.