Skip to content

Commit

Permalink
Merge pull request #2 from QuantumApplicationLab/api_doc
Browse files Browse the repository at this point in the history
Api doc
  • Loading branch information
NicoRenaud authored May 4, 2023
2 parents a17c1d9 + 1e931a4 commit e176e67
Show file tree
Hide file tree
Showing 9 changed files with 990 additions and 121 deletions.
161 changes: 161 additions & 0 deletions docs/apidocs/hadamard_test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
<!-- markdownlint-disable -->

<a href="../vqls_prototype/hadamard_test.py#L0"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

# <kbd>module</kbd> `vqls_prototype.hadamard_test`
Hadammard test.



---

<a href="../vqls_prototype/hadamard_test.py#L10"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

## <kbd>class</kbd> `HadammardTest`
Class to compute the Hadamard Test



<a href="../vqls_prototype/hadamard_test.py#L13"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

### <kbd>method</kbd> `__init__`

```python
__init__(
operators: Union[QuantumCircuit, List[QuantumCircuit]],
use_barrier: Optional[bool] = False,
apply_control_to_operator: Optional[bool, List[bool]] = True,
apply_initial_state: Optional[QuantumCircuit] = None,
apply_measurement: Optional[bool] = False
)
```

Create the quantum circuits required to compute the hadamard test:

.. math:
```
\\langle \\Psi | U | \\Psi \\rangle
```


**Args:**

- <b>`operators`</b> (Union[QuantumCircuit, List[QuantumCircuit]]): quantum circuit or list of quantum circuits representing the U.
- <b>`use_barrier`</b> (Optional[bool], optional): introduce barriers in the description of the circuits. Defaults to False.
- <b>`apply_control_to_operator`</b> (Optional[bool], optional): Apply control operator to the input quantum circuits. Defaults to True.
- <b>`apply_initial_state`</b> (Optional[QuantumCircuit], optional): Quantum Circuit to create |Psi> from |0>. If None, assume that the qubits are alredy in Psi.
- <b>`apply_measurement`</b> (Optional[bool], optional): apply explicit measurement. Defaults to False.




---

<a href="../vqls_prototype/hadamard_test.py#L162"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

### <kbd>method</kbd> `get_value`

```python
get_value(estimator, parameter_sets: List) → List
```






---

<a href="../vqls_prototype/hadamard_test.py#L181"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

## <kbd>class</kbd> `HadammardOverlapTest`
Class to compute the Hadamard Test



<a href="../vqls_prototype/hadamard_test.py#L184"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

### <kbd>method</kbd> `__init__`

```python
__init__(
operators: List[QuantumCircuit],
use_barrier: Optional[bool] = False,
apply_initial_state: Optional[QuantumCircuit] = None,
apply_measurement: Optional[bool] = True
)
```

Create the quantum circuits required to compute the hadamard test:

.. math:
```
\\langle 0 | U^\dagger A_l V | 0 \\rangle \\langle V^\dagger A_m^\dagger U | 0 \\rangle
```


**Args:**

- <b>`operators`</b> (List[QuantumCircuit]): List of quantum circuits representing the operators [U, A_l, A_m].
- <b>`use_barrier`</b> (Optional[bool], optional): introduce barriers in the description of the circuits. Defaults to False.
- <b>`apply_initial_state`</b> (Optional[QuantumCircuit], optional): Quantum Circuit to create |Psi> from |0>. If None, assume that the qubits of the firsr register are alredy in Psi.
- <b>`apply_measurement`</b> (Optional[bool], optional): apply explicit measurement. Defaults to False.



**Returns:**

- <b>`List[QuantumCircuit]`</b>: List of quamtum circuits required to compute the Hadammard Test.




---

<a href="../vqls_prototype/hadamard_test.py#L315"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

### <kbd>method</kbd> `compute_post_processing_coefficients`

```python
compute_post_processing_coefficients()
```

Compute the coefficients for the postprocessing



---

<a href="../vqls_prototype/hadamard_test.py#L348"><img align="right" style="float:right;" src="https://img.shields.io/badge/-source-cccccc?style=flat-square"></a>

### <kbd>method</kbd> `get_value`

```python
get_value(sampler, parameter_sets: List) → float
```

Compute and return the value of Hadmard overlap test



**Args:**

- <b>`sampler`</b> (Sampler): a Sampler primitive to extract the output of the circuits
- <b>`parameter_sets`</b> (List): the parameters of the variational circuits



**Returns:**

- <b>`float`</b>: value of the overlap hadammard test




---

_This file was automatically generated via [lazydocs](https://github.com/ml-tooling/lazydocs)._
Loading

0 comments on commit e176e67

Please sign in to comment.