Skip to content

Commit a7b663c

Browse files
add cite
1 parent 7df72d0 commit a7b663c

File tree

7 files changed

+68
-8
lines changed

7 files changed

+68
-8
lines changed

.pylintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ disable=all
1313
enable=c-extension-no-member,
1414
bad-indentation,
1515
bare-except,
16-
broad-except,
16+
; broad-except,
1717
dangerous-default-value,
1818
function-redefined,
1919
len-as-condition,

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88

99
- Add `circuit.to_openqasm_file` function for compatibility of qiskit>1
1010

11+
- Add `tc.cite()` to get citation information
12+
13+
### Fixed
14+
15+
- Fix customized jax eigh operator by noting the return is a namedtuple
16+
1117
## 1.0.2
1218

1319
### Added

docs/source/index.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ TensorCircuit Next Generation
1111
Introduction
1212
---------------
1313

14-
TensorCircuit-NG is an open-source high-performance quantum computing software framework in Python.
14+
TensorCircuit-NG is an open-source high-performance quantum software framework in Python.
1515

1616
* It is built for humans. 👽
1717

@@ -29,12 +29,15 @@ TensorCircuit-NG is an open-source high-performance quantum computing software f
2929

3030
With the help of TensorCircuit-NG, now get ready to efficiently and elegantly solve interesting and challenging quantum computing and quantum many-body problems: from academic research prototype to industry application deployment.
3131

32+
.. important::
33+
Please cite the `whitepaper <https://quantum-journal.org/papers/q-2023-02-02-912/>`_ when using TensorCircuit or TensorCircuit-NG in your research. The bibtex information is provided by ``tc.cite()``.
3234

3335

3436

35-
Relevant Links
37+
Useful Links
3638
--------------------
3739

40+
3841
TensorCircuit is created and now maintained as TensorCircuit-NG by `Shi-Xin Zhang <https://github.com/refraction-ray>`_.
3942

4043
The current core authors of TensorCircuit-NG are `Shi-Xin Zhang <https://github.com/refraction-ray>`_ and `Yu-Qin Chen <https://github.com/yutuer21>`_.
@@ -168,7 +171,7 @@ TensorCircuit-NG is unifying infrastructures and interfaces for quantum computin
168171
:columns: 12 6 3 3
169172
:shadow: md
170173

171-
neural network/tensor network/quantum circuit
174+
neural-net/tensor-net/quantum-circuit
172175

173176

174177

tensorcircuit/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
gpu_memory_share()
88

9-
from .about import about
9+
from .about import about, cite
1010
from .cons import (
1111
backend,
1212
set_backend,

tensorcircuit/about.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,26 @@ def about() -> None:
2323
print(f"Scipy version: {scipy.__version__}")
2424
except ModuleNotFoundError:
2525
print(f"Scipy is not installed")
26+
except Exception as e:
27+
print(f"Misconfiguration for Scipy: {e}")
2628

2729
try:
2830
import pandas
2931

3032
print(f"Pandas version: {pandas.__version__}")
3133
except ModuleNotFoundError:
3234
print(f"Pandas is not installed")
35+
except Exception as e:
36+
print(f"Misconfiguration for Pandas: {e}")
3337

3438
try:
3539
import tensornetwork as tn
3640

3741
print(f"TensorNetwork version: {tn.__version__}")
3842
except ModuleNotFoundError:
3943
print(f"TensorNetwork is not installed")
44+
except Exception as e:
45+
print(f"Misconfiguration for TensorNetwork: {e}")
4046

4147
try:
4248
import cotengra
@@ -47,6 +53,8 @@ def about() -> None:
4753
print(f"Cotengra: installed")
4854
except ModuleNotFoundError:
4955
print(f"Cotengra is not installed")
56+
except Exception as e:
57+
print(f"Misconfiguration for Cotengra: {e}")
5058

5159
try:
5260
import tensorflow as tf
@@ -56,6 +64,8 @@ def about() -> None:
5664
print(f"TensorFlow CUDA infos: {dict(tf.sysconfig.get_build_info())}")
5765
except ModuleNotFoundError:
5866
print(f"TensorFlow is not installed")
67+
except Exception as e:
68+
print(f"Misconfiguration for TensorFlow: {e}")
5969

6070
try:
6171
import jax
@@ -68,13 +78,17 @@ def about() -> None:
6878
print(f"Jax installation doesn't support GPU")
6979
except ModuleNotFoundError:
7080
print(f"Jax is not installed")
81+
except Exception as e:
82+
print(f"Misconfiguration for Jax: {e}")
7183

7284
try:
7385
import jaxlib
7486

7587
print(f"JaxLib version: {jaxlib.__version__}")
7688
except ModuleNotFoundError:
7789
print(f"JaxLib is not installed")
90+
except Exception as e:
91+
print(f"Misconfiguration for Jaxlib: {e}")
7892

7993
try:
8094
import torch
@@ -88,32 +102,64 @@ def about() -> None:
88102
print(f"Pytorch cuda version: {torch.version.cuda}")
89103
except ModuleNotFoundError:
90104
print(f"PyTorch is not installed")
105+
except Exception as e:
106+
print(f"Misconfiguration for Torch: {e}")
91107

92108
try:
93109
import cupy
94110

95111
print(f"Cupy version: {cupy.__version__}")
96112
except ModuleNotFoundError:
97113
print(f"Cupy is not installed")
114+
except Exception as e:
115+
print(f"Misconfiguration for Cupy: {e}")
98116

99117
try:
100118
import qiskit
101119

102120
print(f"Qiskit version: {qiskit.__version__}")
103121
except ModuleNotFoundError:
104122
print(f"Qiskit is not installed")
123+
except Exception as e:
124+
print(f"Misconfiguration for Qiskit: {e}")
105125

106126
try:
107127
import cirq
108128

109129
print(f"Cirq version: {cirq.__version__}")
110130
except ModuleNotFoundError:
111131
print(f"Cirq is not installed")
132+
except Exception as e:
133+
print(f"Misconfiguration for Cirq: {e}")
112134

113135
from tensorcircuit import __version__
114136

115137
print(f"TensorCircuit version {__version__}")
116138

117139

140+
def cite(format: str = "bib") -> str:
141+
"""
142+
Returns the citation information for tensorcircuit.
143+
Please cite our work if you use the package in your research.
144+
145+
:param format: format for bib, defaults to "bib"
146+
:type format: str, optional
147+
:return: the citation information
148+
:rtype: str
149+
"""
150+
if format == "bib":
151+
return """@article{Zhang_TensorCircuit_2023,
152+
author = {Zhang, Shi-Xin and Allcock, Jonathan and Wan, Zhou-Quan and Liu, Shuo and Sun, Jiace and Yu, Hao and Yang, Xing-Han and Qiu, Jiezhong and Ye, Zhaofeng and Chen, Yu-Qin and Lee, Chee-Kong and Zheng, Yi-Cong and Jian, Shao-Kai and Yao, Hong and Hsieh, Chang-Yu and Zhang, Shengyu},
153+
doi = {10.22331/q-2023-02-02-912},
154+
journal = {Quantum},
155+
month = feb,
156+
title = {{TensorCircuit: a Quantum Software Framework for the NISQ Era}},
157+
volume = {7},
158+
year = {2023}}"""
159+
elif format == "aps":
160+
return """S.-X. Zhang, J. Allcock, Z.-Q. Wan, S. Liu, J. Sun, H. Yu, X.-H. Yang, J. Qiu, Z. Ye, Y.-Q. Chen, C.-K. Lee, Y.-C. Zheng, S.-K. Jian, H. Yao, C.-Y. Hsieh, and S. Zhang, TensorCircuit: a Quantum Software Framework for the NISQ Era, Quantum 7, 912 (2023).""" # pylint: disable=line-too-long
161+
raise ValueError(f"Unsupported format: {format}")
162+
163+
118164
if __name__ == "__main__":
119165
about()

tensorcircuit/experimental.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ def jax_jitted_function_save(filename: str, f: Callable[..., Any], *args: Any) -
534534
:param args: example function arguments for ``f``
535535
"""
536536

537-
from jax import export
537+
from jax import export # type: ignore
538538

539539
f_export = export.export(f)(*args) # type: ignore
540540
barray = f_export.serialize()
@@ -555,14 +555,14 @@ def jax_jitted_function_load(filename: str) -> Callable[..., Any]:
555555
:return: the loaded function
556556
:rtype: _type_
557557
"""
558-
from jax import export
558+
from jax import export # type: ignore
559559

560560
with open(filename, "rb") as f:
561561
barray = f.read()
562562

563563
f_load = export.deserialize(barray) # type: ignore
564564

565-
return f_load.call
565+
return f_load.call # type: ignore
566566

567567

568568
jax_func_load = jax_jitted_function_load

tests/test_miscs.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ def test_about():
3636
print(tc.about())
3737

3838

39+
def test_cite():
40+
print(tc.cite())
41+
print(tc.cite("aps"))
42+
43+
3944
def test_ps2coo(tfb):
4045
for l, a in check_pairs:
4146
r1 = PauliString2COO(tf.constant(l, dtype=tf.int64))

0 commit comments

Comments
 (0)