Skip to content

Commit 1049603

Browse files
unify examples docstring format
1 parent 78c18f3 commit 1049603

21 files changed

+30
-0
lines changed

examples/adiabatic_vqnhe.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Calculate the molecule dissociation curve using VQNHE.
33
"""
4+
45
from functools import partial
56
import sys
67

examples/bp_benchmark.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
benchmark on barren plateau using tfq and tc
33
"""
4+
45
import os
56

67
os.environ["TF_FORCE_GPU_ALLOW_GROWTH"] = "true"

examples/bp_validation.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Compute the circuit gradient with single qubit random Haar averaged to
33
demonstrate the gradient vanishing, aka, barren plateau.
44
"""
5+
56
import numpy as np
67
from tqdm import tqdm
78
import tensorcircuit as tc

examples/chaotic_behavior.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Some chaotic properties calculations from the circuit state.
33
"""
4+
45
from functools import partial
56
import sys
67

examples/ghz_dqas.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
DQAS for GHZ state preparation circuit, deprecated DQAS implementation
33
"""
4+
45
import sys
56

67
sys.path.insert(0, "../")

examples/hamiltonian_building.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
benchmark sparse hamiltonian building
33
"""
4+
45
import time
56
import numpy as np
67
import quimb

examples/incremental_twoqubit.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Optimizing the parameterized circuit with progressively dense two-qubit gates,
33
as a potential approach to alleviate barren plateau.
44
"""
5+
56
import sys
67

78
sys.path.insert(0, "../")

examples/jsonio.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
example showcasing how circuit can be load from and dump to json:
33
useful for storage or restful api
44
"""
5+
56
import numpy as np
67
import tensorcircuit as tc
78

examples/mcnoise_check.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Cross check the correctness of the density matrix simulator and the Monte Carlo trajectory state simulator.
33
"""
4+
45
import os
56

67
os.environ["CUDA_VISIBLE_DEVICES"] = "-1"

examples/mera_extra_mpo.py

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
"""
2+
MERA VQE example with Hamiltonian expectation in MPO representation
3+
"""
4+
15
import time
26
import logging
37
import numpy as np

examples/mipt.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
demo example of mipt in tc style
33
"""
4+
45
from functools import partial
56
import time
67
import numpy as np

examples/mpsvsexact.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
A simple script to benchmark the approximation power of the MPS simulator.
33
"""
4+
45
import sys
56

67
sys.path.insert(0, "../")

examples/optperformance_comparison.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
Optimization for performance comparison for different densities of two-qubit gates
33
(random layouts averaged).
44
"""
5+
56
import sys
67

78
sys.path.insert(0, "../")

examples/qaoa_parallel_opt.py

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
"""
2+
Depracated, using ``vectorized_value_and_grad`` instead for batched optimization
3+
"""
4+
15
import sys
26

37
sys.path.insert(0, "../")

examples/qaoa_shot_noise.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
QAOA with finite measurement shot noise
33
"""
4+
45
from functools import partial
56
import numpy as np
67
from scipy import optimize

examples/qem_dqas.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
DQAS for QFT QEM circuit design, deprecated DQAS implementation
33
"""
4+
45
import sys
56

67
sys.path.insert(0, "../")

examples/readout_mitigation.py

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
"""
2+
Demonstration on readout error mitigation usage
3+
"""
4+
15
import numpy as np
26

37
import tensorcircuit as tc

examples/sample_value_gradient.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Evaluate expectation and gradient on Pauli string sum with finite measurement shots
33
"""
4+
45
from functools import partial
56
import numpy as np
67
import tensorcircuit as tc

examples/simple_qaoa.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
A plain QAOA optimization example with given graphs using networkx.
33
"""
4+
45
import sys
56

67
sys.path.insert(0, "../")

examples/vqe_shot_noise.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
VQE with finite measurement shot noise
33
"""
4+
45
from functools import partial
56
import numpy as np
67
from scipy import optimize

examples/vqnhe_h6.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
H6 molecule VQNHE with code from tc.application
33
"""
4+
45
import sys
56

67
sys.path.insert(0, "../")

0 commit comments

Comments
 (0)