Skip to content

Commit 366cce8

Browse files
Sync docs for SDK version 0.96.0
1 parent 58d9f90 commit 366cce8

File tree

3 files changed

+82
-0
lines changed

3 files changed

+82
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
search:
3+
boost: 2.476
4+
---
5+
6+
<!-- spell-checker: disable -->
7+
<!-- prettier-ignore-start -->
8+
::: classiq.open_library.functions.amplitude_loading
9+
options:
10+
show_if_no_docstrings: false
11+
members:
12+
- assign_amplitude_table
13+
<!-- prettier-ignore-end -->
14+
<!-- spell-checker: enable -->

.internal/docs/qmod-reference/api-reference/functions/open_library/linear_combination_of_unitaries.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ search:
1111
members:
1212
- lcu
1313
- lcu_pauli
14+
- prepare_select
1415
<!-- prettier-ignore-end -->
1516
<!-- spell-checker: enable -->

.internal/docs/qmod-reference/language-reference/quantum-variables.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,73 @@ Note that an alternative approach to implementing a phase-kickback pattern, whic
291291
not require the use of `free`, is to encapsulate the calls to `H` in a function
292292
with an as unchecked _const_ parameter.
293293

294+
## Drop
295+
296+
The _drop_ statement is used to declare that a quantum variable is no longer
297+
used and should be exluded from any future uncomputation. Subsequently, the
298+
variable becomes uninitialized, while its qubits retain their current
299+
state &mdash; which may be dirty and entangled with functional qubits &mdash; and cannot be reused.
300+
301+
### Syntax
302+
303+
=== "Python"
304+
305+
[comment]: DO_NOT_TEST
306+
```python
307+
def drop(var: Input[QVar]) -> None:
308+
pass
309+
```
310+
311+
=== "Native"
312+
313+
**drop** **(** _var_ **)**
314+
315+
### Semantics
316+
317+
- Prior to a _drop_ statement _var_ must be initialized, and subsequently it
318+
becomes uninitialized.
319+
- Local variables that are explicitly dropped are not considered uncomputation candidates,
320+
and are not restricted to permutable use contexts. See more under
321+
[Uncomputation](https://docs.classiq.io/latest/qmod-reference/language-reference/uncomputation/).
322+
323+
### Example
324+
325+
Explicitly dropping a variable is typically not needed and is only used for specific purposes.
326+
The following example demonstrates the use of `drop` in a swap test algorithm,
327+
where the two quantum states cannot be uncomputed, yet we do not wish to measure
328+
them.
329+
330+
=== "Python"
331+
332+
```python
333+
from classiq import *
334+
335+
336+
@qfunc
337+
def main(test: Output[QBit]):
338+
state1 = QArray("state1")
339+
state2 = QArray("state2")
340+
prepare_state([0.1, 0.5, 0.3, 0.1], 0.0, state1)
341+
prepare_state([0.2, 0.1, 0.4, 0.3], 0.0, state2)
342+
swap_test(state1, state2, test)
343+
drop(state1)
344+
drop(state2)
345+
```
346+
347+
=== "Native"
348+
349+
```
350+
qfunc main(output test: qbit) {
351+
state1: qbit[];
352+
state2: qbit[];
353+
prepare_state([0.1, 0.5, 0.3, 0.1], 0.0, state1);
354+
prepare_state([0.2, 0.1, 0.4, 0.3], 0.0, state2);
355+
swap_test(state1, state2, test);
356+
drop(state1);
357+
drop(state2);
358+
}
359+
```
360+
294361
## Concatenation Operator
295362

296363
The _concatenation operator_ is used to combine a sequence of quantum objects

0 commit comments

Comments
 (0)