Skip to content

Commit 4bc8170

Browse files
authored
Update README.md
1 parent ff4b1a1 commit 4bc8170

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

README.md

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,33 @@ Dynamic computation graph, automatic gradient computation, fast GPU support, bat
5757

5858
## Installation
5959
```bash
60-
git clone https://github.com/mit-han-lab/torchquantum.git
61-
cd torchquantum
62-
pip install --editable .
60+
pip install torchquantum
61+
62+
```
63+
## Basic Usage 1
64+
65+
```python
66+
import torchquantum as tq
67+
import torchquantum.functional as tqf
68+
69+
state = tq.QuantumState(n_wires=2)
70+
71+
state.h(wires=0)
72+
state.cnot(wires=[0, 1])
73+
tqf.h(state, wires=1)
74+
tqf.x(state, wires=1)
75+
76+
# print the current state (dynamic computation graph supported)
77+
print(state)
6378
```
6479

65-
## Basic Usage
80+
## Basic Usage 2
6681

6782
```python
6883
import torchquantum as tq
6984
import torchquantum.functional as tqf
7085

71-
x = tq.QuantumDevice(n_wires=1)
86+
x = tq.QuantumDevice(n_wires=2)
7287

7388
tqf.hadamard(x, wires=0)
7489
tqf.x(x, wires=1)
@@ -78,6 +93,8 @@ tqf.cnot(x, wires=[0, 1])
7893
print(x.states)
7994
```
8095

96+
97+
8198
## Guide to the examples
8299
We also prepare many example and tutorials using TorchQuantum.
83100

0 commit comments

Comments
 (0)