tensorcircuit-nightly 1.2.0.dev20250403__py3-none-any.whl → 1.2.1.dev20250510__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of tensorcircuit-nightly might be problematic. Click here for more details.

tensorcircuit/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- __version__ = "1.2.0.dev20250403"
1
+ __version__ = "1.2.1.dev20250510"
2
2
  __author__ = "TensorCircuit Authors"
3
3
  __creator__ = "refraction-ray"
4
4
 
@@ -796,8 +796,10 @@ class BaseCircuit(AbstractCircuit):
796
796
  """
797
797
  # if isinstance(readout_error, tuple):
798
798
  # readout_error = list[readout_error] # type: ignore
799
-
800
- nqubit = len(readout_error) # type: ignore
799
+ try:
800
+ nqubit = int(readout_error.shape[0]) # type: ignore
801
+ except AttributeError:
802
+ nqubit = len(readout_error) # type: ignore
801
803
  readoutlist = []
802
804
  for i in range(nqubit):
803
805
  readoutlist.append(
@@ -5,9 +5,6 @@ Interface wraps quantum function as a jax function
5
5
  from typing import Any, Callable, Tuple, Optional, Union, Sequence
6
6
  from functools import wraps, partial
7
7
 
8
- import jax
9
- from jax import custom_vjp
10
-
11
8
  from ..cons import backend
12
9
  from .tensortrans import general_args_to_backend
13
10
 
@@ -22,6 +19,8 @@ def jax_wrapper(
22
19
  ] = None,
23
20
  output_dtype: Optional[Union[Any, Sequence[Any]]] = None,
24
21
  ) -> Callable[..., Any]:
22
+ import jax
23
+
25
24
  @wraps(fun)
26
25
  def fun_jax(*x: Any) -> Any:
27
26
  def wrapped_fun(*args: Any) -> Any:
@@ -129,6 +128,9 @@ def create_jax_function(
129
128
  output_shape: Optional[Union[Tuple[int, ...], Tuple[()]]] = None,
130
129
  output_dtype: Optional[Any] = None,
131
130
  ) -> Callable[..., Any]:
131
+ import jax
132
+ from jax import custom_vjp
133
+
132
134
  if jit:
133
135
  fun = backend.jit(fun)
134
136
 
@@ -723,7 +723,10 @@ class ReadoutMit:
723
723
  cals = self._form_cals(qubits)
724
724
  M = M3MatVec(dict(counts), cals, distance)
725
725
  L = spla.LinearOperator(
726
- (M.num_elems, M.num_elems), matvec=M.matvec, rmatvec=M.rmatvec
726
+ (M.num_elems, M.num_elems),
727
+ matvec=M.matvec,
728
+ rmatvec=M.rmatvec,
729
+ dtype=np.float64,
727
730
  )
728
731
  diags = M.get_diagonal()
729
732
 
@@ -45,7 +45,6 @@ Tensor = Any
45
45
 
46
46
 
47
47
  def get_qiskit_qasm(qc: Any) -> str:
48
-
49
48
  try:
50
49
  qasm_str = qc.qasm() # type: ignore
51
50
  except AttributeError: # qiskit 1.0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tensorcircuit-nightly
3
- Version: 1.2.0.dev20250403
3
+ Version: 1.2.1.dev20250510
4
4
  Summary: nightly release for tensorcircuit
5
5
  Home-page: https://github.com/refraction-ray/tensorcircuit-dev
6
6
  Author: TensorCircuit Authors
@@ -60,11 +60,11 @@ Dynamic: summary
60
60
 
61
61
  <p align="center"> English | <a href="README_cn.md"> 简体中文 </a></p>
62
62
 
63
- TensorCircuit-NG is an open-source high-performance quantum software framework, supporting for automatic differentiation, just-in-time compiling, hardware acceleration, and vectorized parallelism, providing unified infrastructures and interfaces for quantum programming. It can compose quantum circuits, neural networks and tensor networks seamlessly with high simulation efficiency and flexibility.
63
+ TensorCircuit-NG is the next-generation open-source high-performance quantum software framework, built upon tensornetwork engines, supporting for automatic differentiation, just-in-time compiling, hardware acceleration, and vectorized parallelism, providing unified infrastructures and interfaces for quantum programming. It can compose quantum circuits, neural networks and tensor networks seamlessly with high simulation efficiency and flexibility.
64
64
 
65
65
  TensorCircuit-NG is built on top of modern machine learning frameworks: Jax, TensorFlow, and PyTorch. It is specifically suitable for large-scale simulations of quantum-classical hybrid paradigm and variational quantum algorithms in ideal, noisy, Clifford, approximate and analog cases. It also supports quantum hardware access and provides CPU/GPU/QPU hybrid deployment solutions.
66
66
 
67
- TensorCircuit-NG is [fully compatible](https://tensorcircuit-ng.readthedocs.io/en/latest/faq.html#what-is-the-relation-between-tensorcircuit-and-tensorcircuit-ng) with TensorCircuit with more new features and bug fixes (support latest `numpy>2` and `qiskit>1`).
67
+ TensorCircuit-NG is the actively maintained official version and a [fully compatible](https://tensorcircuit-ng.readthedocs.io/en/latest/faq.html#what-is-the-relation-between-tensorcircuit-and-tensorcircuit-ng) successor to TensorCircuit with more new features (stabilizer circuit and distributed simulation) and bug fixes (support latest `numpy>2` and `qiskit>1`).
68
68
 
69
69
  ## Getting Started
70
70
 
@@ -357,6 +357,8 @@ TensorCircuit-NG is open source, released under the Apache License, Version 2.0.
357
357
 
358
358
  ## Research and Applications
359
359
 
360
+ TensorCircuit-NG is a powerful framework for driving research and applications in quantum computing. Below are examples of published academic works and open-source projects that utilize TensorCircuit-NG.
361
+
360
362
  ### DQAS
361
363
 
362
364
  For the application of Differentiable Quantum Architecture Search, see [applications](/tensorcircuit/applications).
@@ -411,6 +413,10 @@ For the simulation implementation of quantum states based on neural networks, te
411
413
 
412
414
  Reference paper: https://arxiv.org/abs/2411.18921.
413
415
 
416
+ ### A Unified Variational Framework for Quantum Excited States
417
+
418
+ For the simulation code and data for variational optimization of simutaneous excited states, see the [project repo](https://github.com/sxzgroup/quantum_excited_state).
419
+
414
420
  ### More works
415
421
 
416
422
  <details>
@@ -1,8 +1,8 @@
1
- tensorcircuit/__init__.py,sha256=uOC_drtSBEysG94JGwtj226VVRC9FThVWVi335gv2DY,2032
1
+ tensorcircuit/__init__.py,sha256=E7f0j-E63GRwg2vulZFYh_uV4_cuqLDbTvMoibYAOqw,2032
2
2
  tensorcircuit/about.py,sha256=DazTswU2nAwOmASTaDII3L04PVtaQ7oiWPty5YMI3Wk,5267
3
3
  tensorcircuit/abstractcircuit.py,sha256=0osacPqq7B1EJki-cI1aLYoVRmjFaG9q3XevWMs7SsA,44125
4
4
  tensorcircuit/asciiart.py,sha256=neY1OWFwtoW5cHPNwkQHgRPktDniQvdlP9QKHkk52fM,8236
5
- tensorcircuit/basecircuit.py,sha256=1KRytwTjjV93tCLlGM0fNoqY0vo6vvMmv4_T6cX70CI,36419
5
+ tensorcircuit/basecircuit.py,sha256=__GECTdRGq8Xx7sOzqnpje-F4EB1Zjn3Wx6O4EbwZac,36531
6
6
  tensorcircuit/channels.py,sha256=CFQxWI-JmkIxexslCBdjp_RSxUbHs6eAJv4LvlXXXCY,28637
7
7
  tensorcircuit/circuit.py,sha256=jC1Bb9A06pt6XX7muC-Q72BR9HS6n0Ft6aMjOGcz9iM,36428
8
8
  tensorcircuit/cons.py,sha256=tL57J84c5t_ELs9t9oSJPDVUu5vYGbs9A_6sU6eHbfg,30658
@@ -19,7 +19,7 @@ tensorcircuit/shadows.py,sha256=6XmWNubbuaxFNvZVWu-RXd0lN9Jkk-xwong_K8o8_KE,1701
19
19
  tensorcircuit/simplify.py,sha256=O11G3UYiVAc30GOfwXXmhLXwGZrQ8OVwLTMQMZp_XBc,9414
20
20
  tensorcircuit/stabilizercircuit.py,sha256=4gDeTgko04j4dwt7NdJvl8NhqmB8JH75nZjdbLU3Aw0,15178
21
21
  tensorcircuit/torchnn.py,sha256=z_QpM0QC3mydGyWpyp877j-tSFCPyzynCwqrTWaw-IA,4637
22
- tensorcircuit/translation.py,sha256=yrOsJUOUKvB1TRbRopRzeDwqs3HbUfd-DLKV_rIsUQE,28331
22
+ tensorcircuit/translation.py,sha256=D0-JzhN8IxBlPerwDN4ImGbS4VQg-nFxGry9BhEc4xk,28330
23
23
  tensorcircuit/utils.py,sha256=CH9gTV4iKIikSS8KajIu3ttyC8i_1tBPf5PAYH1fgxs,7060
24
24
  tensorcircuit/vis.py,sha256=O4hm050KKfOAoVyHsjpMg6NBNVoWhLSlv-xsCx4opsU,12196
25
25
  tensorcircuit/applications/__init__.py,sha256=nAX-Am6JoL9k53iJ_CjZJ2NcjIpaz21H87nrW4Op03k,246
@@ -63,7 +63,7 @@ tensorcircuit/compiler/composed_compiler.py,sha256=AsOGYg11rHYlZjr6olDovRkxr0B2L
63
63
  tensorcircuit/compiler/qiskit_compiler.py,sha256=qpz7DRpQATIxsfi4pj_C6-JBtKdUVcu3BQwhoWViSVA,6219
64
64
  tensorcircuit/compiler/simple_compiler.py,sha256=4OC1oYH0YqYF-UzV7ZiJ0qLitS6Z3xjvd8l02wicATM,9589
65
65
  tensorcircuit/interfaces/__init__.py,sha256=cE2bZYRwIpxXaL0SLnIKtQS0jRZPDF3k1ep9rpesLVU,500
66
- tensorcircuit/interfaces/jax.py,sha256=LjYBLSWV07OiqKF_fTZkwTqA9719GT4MlIYUqQJCxrI,5990
66
+ tensorcircuit/interfaces/jax.py,sha256=q_nay20gcrPRyY2itvcOtkCjqtvcC4qotbvrgm2a3cU,6014
67
67
  tensorcircuit/interfaces/numpy.py,sha256=T7h64dG9e5xDG0KVOy9O8TXyrt5RWRnTWN9iXf3aGyY,1439
68
68
  tensorcircuit/interfaces/scipy.py,sha256=_P2IeqvJiO7cdjTzNCIAFm8Y56Wd3j3jGmWUeeQ1Fw8,3402
69
69
  tensorcircuit/interfaces/tensorflow.py,sha256=U4hZjm-yWxOJ5tqmffk8-tNvOkAltYBJ8Z6jYwOtTaM,3355
@@ -71,7 +71,7 @@ tensorcircuit/interfaces/tensortrans.py,sha256=oUxIVpXfANZVRXfPjiGJDzFPiszfBsiY4
71
71
  tensorcircuit/interfaces/torch.py,sha256=13IFGmWUFoWiSzKAzwp2EkOSxgiwN_oUFxjQb36gimo,5149
72
72
  tensorcircuit/results/__init__.py,sha256=3kkIvmjLYQd5ff-emY8l82rpv9mwMZdM2kTLZ9sNfA4,89
73
73
  tensorcircuit/results/counts.py,sha256=qJhiY03Hh_Pp6ti-ytsqmt28-4H6jmZYnejjkc9iLe4,3829
74
- tensorcircuit/results/readout_mitigation.py,sha256=5Kxo3pmvJdJYSSQ7Sh-Bh71iKIfV1mdnA5TiFAOMLf8,31691
74
+ tensorcircuit/results/readout_mitigation.py,sha256=dVpNvtFZe7n_fDVczKcqYPEepu3fV2qK3u-SfOpTf68,31746
75
75
  tensorcircuit/results/qem/__init__.py,sha256=Pw0hcFYNesuPE8uNDm9P8DVTIFCSBqUcIkr6smQYzuM,419
76
76
  tensorcircuit/results/qem/benchmark_circuits.py,sha256=LlFuKCDFKihMOhiY6WUZt9QPyoPeQw0SuaczdcSA3oM,3243
77
77
  tensorcircuit/results/qem/qem_methods.py,sha256=v8HyVsRX9vkjgGfLyB1K0Eq5UyUnh-thysqo05kXo6E,12148
@@ -83,7 +83,7 @@ tensorcircuit/templates/conversions.py,sha256=D3chiKDr7G1ekCJngiol91k9iqrMag1DZQ
83
83
  tensorcircuit/templates/dataset.py,sha256=ldPvCUlwjHU_S98E2ISQp34KqJzJPpPHmDIKJ4K-qYo,1933
84
84
  tensorcircuit/templates/graphs.py,sha256=cPYrxjoem0xZ-Is9dZKAvEzWZL_FejfIRiCEOTA4qd4,3935
85
85
  tensorcircuit/templates/measurements.py,sha256=pzc5Aa9S416Ilg4aOY77Z6ZhUlYcXnAkQNQFTuHjFFs,10943
86
- tensorcircuit_nightly-1.2.0.dev20250403.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
86
+ tensorcircuit_nightly-1.2.1.dev20250510.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
87
87
  tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
88
88
  tests/conftest.py,sha256=J9nHlLE3Zspz1rMyzadEuBWhaS5I4Q9sq0lnWybcdIA,1457
89
89
  tests/test_backends.py,sha256=rClxb2gyAoGeXd_ZYVSAJ0zEvJ7z_2btAeFM_Iy_wwY,33925
@@ -96,7 +96,7 @@ tests/test_dmcircuit.py,sha256=Th5N6TCdGQ2MBWy8O3GNnMWshGui8XR_rUSeM2QlVcs,17232
96
96
  tests/test_ensemble.py,sha256=0RzJkv-5D8LeZxS0Q0MwtEcgnXd2zefMquPHRNYT6RY,2109
97
97
  tests/test_fgs.py,sha256=nv3E_F_SAF4ChsoT8Ihm3FtSpOmTGJr_Jf2MoKXXceE,10162
98
98
  tests/test_gates.py,sha256=rAIV2QFpFsA5bT1QivTSkhdarvwu5t0N3IOz4SEDrzg,4593
99
- tests/test_interfaces.py,sha256=7V4miC9rgcpgmgHDxX8NmQcb-6pBI12p3Ur3c40vetg,16943
99
+ tests/test_interfaces.py,sha256=iJPmes8S8HkA9_PGjsu4Ike-vCXYyS1EMgnNKKXDNaU,16938
100
100
  tests/test_keras.py,sha256=U453jukavmx0RMeTSDEgPzrNdHNEfK1CW0CqO3XCNKo,4841
101
101
  tests/test_miscs.py,sha256=NO0mwM-OgAUAd-qrzq4wHKKn_vAIJgspWH9s5vMS5Wk,8212
102
102
  tests/test_mpscircuit.py,sha256=mDXX8oQeFeHr_PdZvwqyDs_tVcVAqLmCERqlTAU7590,10552
@@ -105,14 +105,14 @@ tests/test_qaoa.py,sha256=hEcC_XVmKBGt9XgUGtbTO8eQQK4mjorgTIrfqZCeQls,2616
105
105
  tests/test_qem.py,sha256=jUqsfaDNqrZdSB4Jur51R0OUP-3FHyNsXtPsIRCh6L4,4304
106
106
  tests/test_quantum.py,sha256=p6ilnHVmi6Gkhynd7eLX-6xbO14fm9hVfPJjF69FUK4,19317
107
107
  tests/test_quantum_attr.py,sha256=Zl6WbkbnTWVp6FL2rR21qBGsLoheoIEZXqWZKxfpDRs,1245
108
- tests/test_results.py,sha256=TaxLo7ZaoQFV5qsQJaa-hxmRNwrlpvmx95ljTO6upjI,11883
108
+ tests/test_results.py,sha256=8cQO0ShkBc4_pB-fi9s35WJbuZl5ex5y1oElSV-GlRo,11882
109
109
  tests/test_shadows.py,sha256=1T3kJesVJ5XfZrSncL80xdq-taGCSnTDF3eL15UlavY,5160
110
110
  tests/test_simplify.py,sha256=35tbOu1QANsPvY1buLwNhqPnMkBOsnBtHn82qaukmgI,1175
111
111
  tests/test_stabilizer.py,sha256=tG78b8NZEBxgWQXPT2vmYGkGK1MeAempCT7Hsv5ZLrA,5252
112
112
  tests/test_templates.py,sha256=Xm9otFFaaBWG9TZpgJ-nNh9MBfRipTzFWL8fBOnie2k,7192
113
113
  tests/test_torchnn.py,sha256=CHLTfWkF7Ses5_XnGFN_uv_JddfgenFEFzaDtSH8XYU,2848
114
114
  tests/test_van.py,sha256=kAWz860ivlb5zAJuYpzuBe27qccT-Yf0jatf5uXtTo4,3163
115
- tensorcircuit_nightly-1.2.0.dev20250403.dist-info/METADATA,sha256=nGhbySJxMLYOaHqBAMlIXm9ZhQ5yiJBcnA9ln7SQc98,33430
116
- tensorcircuit_nightly-1.2.0.dev20250403.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
117
- tensorcircuit_nightly-1.2.0.dev20250403.dist-info/top_level.txt,sha256=O_Iqeh2x02lasEYMI9iyPNNNtMzcpg5qvwMOkZQ7n4A,20
118
- tensorcircuit_nightly-1.2.0.dev20250403.dist-info/RECORD,,
115
+ tensorcircuit_nightly-1.2.1.dev20250510.dist-info/METADATA,sha256=qJve2u5CVtsRdk4M9h0pJr1tMfurFqG5PHuGANQeue4,34022
116
+ tensorcircuit_nightly-1.2.1.dev20250510.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
117
+ tensorcircuit_nightly-1.2.1.dev20250510.dist-info/top_level.txt,sha256=O_Iqeh2x02lasEYMI9iyPNNNtMzcpg5qvwMOkZQ7n4A,20
118
+ tensorcircuit_nightly-1.2.1.dev20250510.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (78.1.0)
2
+ Generator: setuptools (80.4.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
tests/test_interfaces.py CHANGED
@@ -431,7 +431,6 @@ def test_args_to_tensor(backend):
431
431
 
432
432
 
433
433
  def test_jax_interface_basic(tfb):
434
-
435
434
  def f(params):
436
435
  c = tc.Circuit(1)
437
436
  c.rx(0, theta=params[0])
@@ -453,7 +452,6 @@ def test_jax_interface_basic(tfb):
453
452
 
454
453
 
455
454
  def test_jax_interface_multiple_inputs(tfb):
456
-
457
455
  def f(params1, params2):
458
456
  c = tc.Circuit(2)
459
457
  c.rx(0, theta=params1[0])
@@ -481,7 +479,6 @@ def test_jax_interface_multiple_inputs(tfb):
481
479
  reason="might fail when testing with other function",
482
480
  )
483
481
  def test_jax_interface_jit_dlpack(tfb):
484
-
485
482
  def f(params):
486
483
  c = tc.Circuit(2)
487
484
  c.rx(range(2), theta=params)
@@ -502,7 +499,6 @@ def test_jax_interface_jit_dlpack(tfb):
502
499
 
503
500
 
504
501
  def test_jax_interface_pure_callback(tfb):
505
-
506
502
  def f(params):
507
503
  # Use TF operation to test pure_callback
508
504
  return tf.square(params)
@@ -531,7 +527,6 @@ def test_jax_interface_pure_callback(tfb):
531
527
 
532
528
 
533
529
  def test_jax_interface_multiple_outputs(tfb):
534
-
535
530
  def f(params):
536
531
  # Use TF operation to test pure_callback
537
532
  return tf.square(params), params
tests/test_results.py CHANGED
@@ -16,7 +16,6 @@ def test_marginal_count():
16
16
 
17
17
 
18
18
  def test_merge_count():
19
-
20
19
  c1 = {"00": 10, "01": 20, "11": 30}
21
20
  c2 = {"00": 5, "10": 15, "11": 25}
22
21
  c3 = {"01": 10, "10": 20}