Skip to content

Commit fba1467

Browse files
Generate qiskit-addon-sqd 0.12 and qiskit 2.2.0rc1 (#3905)
1 parent e5b9d27 commit fba1467

File tree

654 files changed

+4507
-3514
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

654 files changed

+4507
-3514
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "qiskit-addon-sqd",
3+
"version": "0.11.0"
4+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"title": "Sample-based quantum diagonalization (SQD)",
3+
"children": [
4+
{
5+
"title": "API index",
6+
"url": "/docs/api/qiskit-addon-sqd/0.11"
7+
},
8+
{
9+
"title": "qiskit_addon_sqd.configuration_recovery",
10+
"url": "/docs/api/qiskit-addon-sqd/0.11/configuration-recovery"
11+
},
12+
{
13+
"title": "qiskit_addon_sqd.counts",
14+
"url": "/docs/api/qiskit-addon-sqd/0.11/counts"
15+
},
16+
{
17+
"title": "qiskit_addon_sqd.fermion",
18+
"url": "/docs/api/qiskit-addon-sqd/0.11/fermion"
19+
},
20+
{
21+
"title": "qiskit_addon_sqd.qubit",
22+
"url": "/docs/api/qiskit-addon-sqd/0.11/qubit"
23+
},
24+
{
25+
"title": "qiskit_addon_sqd.subsampling",
26+
"url": "/docs/api/qiskit-addon-sqd/0.11/subsampling"
27+
},
28+
{
29+
"title": "Release notes",
30+
"url": "/docs/api/qiskit-addon-sqd/release-notes"
31+
}
32+
],
33+
"collapsed": true
34+
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
title: configuration_recovery (v0.11)
3+
description: API reference for qiskit_addon_sqd.configuration_recovery in qiskit-addon-sqd v0.11
4+
in_page_toc_min_heading_level: 2
5+
python_api_type: module
6+
python_api_name: qiskit_addon_sqd.configuration_recovery
7+
---
8+
9+
<span id="module-qiskit_addon_sqd.configuration_recovery" />
10+
11+
<span id="configuration-recovery-qiskit-addon-sqd-configuration-recovery" />
12+
13+
# Configuration recovery
14+
15+
`qiskit_addon_sqd.configuration_recovery`
16+
17+
Functions for performing self-consistent configuration recovery.
18+
19+
### post\_select\_by\_hamming\_weight
20+
21+
<Function id="qiskit_addon_sqd.configuration_recovery.post_select_by_hamming_weight" github="https://github.com/Qiskit/qiskit-addon-sqd/tree/stable/0.11/qiskit_addon_sqd/configuration_recovery.py#L25-L49" signature="post_select_by_hamming_weight(bitstring_matrix, *, hamming_right, hamming_left)">
22+
Post-select bitstrings based on the hamming weight of each half.
23+
24+
**Parameters**
25+
26+
* **bitstring\_matrix** ([*ndarray*](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray "(in NumPy v2.2)")) – A 2D array of `bool` representations of bit values such that each row represents a single bitstring
27+
* **hamming\_right** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")) – The target hamming weight of the right half of bitstrings
28+
* **hamming\_left** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")) – The target hamming weight of the left half of bitstrings
29+
30+
**Returns**
31+
32+
A mask signifying which samples (rows) were selected from the input matrix.
33+
34+
**Return type**
35+
36+
[*ndarray*](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray "(in NumPy v2.2)")
37+
</Function>
38+
39+
### recover\_configurations
40+
41+
<Function id="qiskit_addon_sqd.configuration_recovery.recover_configurations" github="https://github.com/Qiskit/qiskit-addon-sqd/tree/stable/0.11/qiskit_addon_sqd/configuration_recovery.py#L52-L121" signature="recover_configurations(bitstring_matrix, probabilities, avg_occupancies, num_elec_a, num_elec_b, rand_seed=None)">
42+
Refine bitstrings based on average orbital occupancy and a target hamming weight.
43+
44+
This function refines each bit in isolation in an attempt to transform the Hilbert space represented by the input `bitstring_matrix` into a space closer to that which supports the ground state.
45+
46+
<Admonition title="Note" type="note">
47+
This function makes the assumption that bit `i` represents the spin-down orbital corresponding to the spin-up orbital in bit `i + N` where `N` is the number of spatial orbitals and `i < N`.
48+
</Admonition>
49+
50+
**Parameters**
51+
52+
* **bitstring\_matrix** ([*ndarray*](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray "(in NumPy v2.2)")) – A 2D array of `bool` representations of bit values such that each row represents a single bitstring
53+
* **probabilities** ([*Sequence*](https://docs.python.org/3/library/collections.abc.html#collections.abc.Sequence "(in Python v3.13)")*\[*[*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")*] |* [*ndarray*](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray "(in NumPy v2.2)")) – A 1D array specifying a probability distribution over the bitstrings
54+
* **avg\_occupancies** ([*tuple*](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.13)")*\[*[*ndarray*](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray "(in NumPy v2.2)")*,* [*ndarray*](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray "(in NumPy v2.2)")*]*) – A length-2 tuple of arrays holding the mean occupancy of the spin-up and spin-down orbitals, respectively. The occupancies should be formatted as: `(array([occ_a_0, ..., occ_a_N]), array([occ_b_0, ..., occ_b_N]))`
55+
* **num\_elec\_a** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")) – The number of spin-up electrons in the system.
56+
* **num\_elec\_b** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")) – The number of spin-down electrons in the system.
57+
* **rand\_seed** ([*Generator*](https://numpy.org/doc/stable/reference/random/generator.html#numpy.random.Generator "(in NumPy v2.2)") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)") *| None*) – A seed for controlling randomness
58+
59+
**Returns**
60+
61+
A refined bitstring matrix and an updated probability array.
62+
63+
**Return type**
64+
65+
[tuple](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.13)")\[[*ndarray*](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray "(in NumPy v2.2)"), [*ndarray*](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray "(in NumPy v2.2)")]
66+
67+
**References**
68+
69+
**\[1]: J. Robledo-Moreno, et al., [Chemistry Beyond Exact Solutions on a Quantum-Centric Supercomputer](https://arxiv.org/abs/2405.05068),**
70+
71+
arXiv:2405.05068 \[quant-ph].
72+
</Function>
73+
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
---
2+
title: counts (v0.11)
3+
description: API reference for qiskit_addon_sqd.counts in qiskit-addon-sqd v0.11
4+
in_page_toc_min_heading_level: 2
5+
python_api_type: module
6+
python_api_name: qiskit_addon_sqd.counts
7+
---
8+
9+
<span id="module-qiskit_addon_sqd.counts" />
10+
11+
<span id="counts-qiskit-addon-sqd-counts" />
12+
13+
# Counts
14+
15+
`qiskit_addon_sqd.counts`
16+
17+
Functions for transforming counts dictionaries.
18+
19+
### counts\_to\_arrays
20+
21+
<Function id="qiskit_addon_sqd.counts.counts_to_arrays" github="https://github.com/Qiskit/qiskit-addon-sqd/tree/stable/0.11/qiskit_addon_sqd/counts.py#L24-L42" signature="counts_to_arrays(counts)">
22+
Convert a counts dictionary into a bitstring matrix and a probability array.
23+
24+
**Parameters**
25+
26+
**counts** ([*Mapping*](https://docs.python.org/3/library/collections.abc.html#collections.abc.Mapping "(in Python v3.13)")*\[*[*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)")*,* [*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")*]*) – The counts dictionary to convert
27+
28+
**Returns**
29+
30+
* A 2D array representing the sampled bitstrings. Each row represents a bitstring, and each element is a `bool` representation of the bit’s value
31+
* A 1D array containing the probability with which each bitstring was sampled
32+
33+
**Return type**
34+
35+
[tuple](https://docs.python.org/3/library/stdtypes.html#tuple "(in Python v3.13)")\[[*ndarray*](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray "(in NumPy v2.2)"), [*ndarray*](https://numpy.org/doc/stable/reference/generated/numpy.ndarray.html#numpy.ndarray "(in NumPy v2.2)")]
36+
</Function>
37+
38+
### generate\_counts\_uniform
39+
40+
<Function id="qiskit_addon_sqd.counts.generate_counts_uniform" github="https://github.com/Qiskit/qiskit-addon-sqd/tree/stable/0.11/qiskit_addon_sqd/counts.py#L64-L97" signature="generate_counts_uniform(num_samples, num_bits, rand_seed=None)">
41+
Generate a bitstring counts dictionary of samples drawn from the uniform distribution.
42+
43+
**Parameters**
44+
45+
* **num\_samples** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")) – The number of samples to draw
46+
* **num\_bits** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")) – The number of bits in the bitstrings
47+
* **rand\_seed** ([*Generator*](https://numpy.org/doc/stable/reference/random/generator.html#numpy.random.Generator "(in NumPy v2.2)") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)") *| None*) – A seed for controlling randomness
48+
49+
**Returns**
50+
51+
A dictionary mapping bitstrings of length `num_bits` to the number of times they were sampled.
52+
53+
**Raises**
54+
55+
[**ValueError**](https://docs.python.org/3/library/exceptions.html#ValueError "(in Python v3.13)")`num_samples` and `num_bits` must be positive integers.
56+
57+
**Return type**
58+
59+
[dict](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.13)")\[[str](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)"), [int](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")]
60+
</Function>
61+
62+
### generate\_counts\_bipartite\_hamming
63+
64+
<Function id="qiskit_addon_sqd.counts.generate_counts_bipartite_hamming" github="https://github.com/Qiskit/qiskit-addon-sqd/tree/stable/0.11/qiskit_addon_sqd/counts.py#L120-L173" signature="generate_counts_bipartite_hamming(num_samples, num_bits, *, hamming_right, hamming_left, rand_seed=None)">
65+
Generate a bitstring counts dictionary with specified bipartite hamming weight.
66+
67+
**Parameters**
68+
69+
* **num\_samples** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")) – The number of samples to draw
70+
* **num\_bits** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")) – The number of bits in the bitstrings
71+
* **hamming\_right** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")) – The hamming weight on the right half of each bitstring
72+
* **hamming\_left** ([*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")) – The hamming weight on the left half of each bitstring
73+
* **rand\_seed** ([*Generator*](https://numpy.org/doc/stable/reference/random/generator.html#numpy.random.Generator "(in NumPy v2.2)") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)") *| None*) – A seed for controlling randomness
74+
75+
**Returns**
76+
77+
A dictionary mapping bitstrings to the number of times they were sampled. Each half of each bitstring in the output dictionary will have a hamming weight as specified by the inputs.
78+
79+
**Raises**
80+
81+
* [**ValueError**](https://docs.python.org/3/library/exceptions.html#ValueError "(in Python v3.13)")`num_bits` and `num_samples` must be positive integers.
82+
* [**ValueError**](https://docs.python.org/3/library/exceptions.html#ValueError "(in Python v3.13)") – Hamming weights must be specified as non-negative integers.
83+
* [**ValueError**](https://docs.python.org/3/library/exceptions.html#ValueError "(in Python v3.13)")`num_bits` must be even.
84+
85+
**Return type**
86+
87+
[dict](https://docs.python.org/3/library/stdtypes.html#dict "(in Python v3.13)")\[[str](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)"), [int](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")]
88+
</Function>
89+
90+
### normalize\_counts\_dict
91+
92+
<Function id="qiskit_addon_sqd.counts.normalize_counts_dict" github="https://github.com/Qiskit/qiskit-addon-sqd/tree/stable/0.11/qiskit_addon_sqd/counts.py#L176-L183" signature="normalize_counts_dict(counts)">
93+
Convert a counts dictionary into a probability dictionary.
94+
95+
**Parameters**
96+
97+
**counts** ([*Mapping*](https://docs.python.org/3/library/collections.abc.html#collections.abc.Mapping "(in Python v3.13)")*\[*[*str*](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)")*,* [*float*](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)") *|*[*int*](https://docs.python.org/3/library/functions.html#int "(in Python v3.13)")*]*)
98+
99+
**Return type**
100+
101+
[*Mapping*](https://docs.python.org/3/library/collections.abc.html#collections.abc.Mapping "(in Python v3.13)")\[[str](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.13)"), [float](https://docs.python.org/3/library/functions.html#float "(in Python v3.13)")]
102+
</Function>
103+

0 commit comments

Comments
 (0)