Quimb

Latest version: v1.8.0

Safety actively analyzes 621892 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 3

1.8.0

**Breaking Changes**

- all singular value renormalization is turned off by default
- [`TensorNetwork.compress_all`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/index.html#quimb.tensor.TensorNetwork.compress_all) now defaults to using some local gauging

**Enhancements:**

- add `quimb.tensor.tensor_1d_compress.py` with functions for compressing generic 1D tensor networks (with arbitrary local structure) using various methods. The methods are:

- The **'direct'** method: [`tensor_network_1d_compress_direct`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_1d_compress/index.html#quimb.tensor.tensor_1d_compress.tensor_network_1d_compress_direct)
- The **'dm'** (density matrix) method: [`tensor_network_1d_compress_dm`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_1d_compress/index.html#quimb.tensor.tensor_1d_compress.tensor_network_1d_compress_dm)
- The **'zipup'** method: [`tensor_network_1d_compress_zipup`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_1d_compress/index.html#quimb.tensor.tensor_1d_compress.tensor_network_1d_compress_zipup)
- The **'zipup-first'** method: [`tensor_network_1d_compress_zipup_first`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_1d_compress/index.html#quimb.tensor.tensor_1d_compress.tensor_network_1d_compress_zipup_first)
- The 1 and 2 site **'fit'** or sweeping method: [`tensor_network_1d_compress_fit`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_1d_compress/index.html#quimb.tensor.tensor_1d_compress.tensor_network_1d_compress_fit)
- ... and some more niche methods for debugging and testing.

And can be accessed via the unified function [`tensor_network_1d_compress`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_1d_compress/index.html#quimb.tensor.tensor_1d_compress.tensor_network_1d_compress). Boundary contraction in 2D can now utilize any of these methods.
- add [`quimb.tensor.tensor_arbgeom_compress.py`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_arbgeom_compress/index.html) with functions for compressing arbitrary geometry tensor networks using various methods. The methods are:

- The **'local-early'** method: [`tensor_network_ag_compress_local_early`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_arbgeom_compress/index.html#quimb.tensor.tensor_arbgeom_compress.tensor_network_ag_compress_local_early)
- The **'local-late'** method: [`tensor_network_ag_compress_local_late`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_arbgeom_compress/index.html#quimb.tensor.tensor_arbgeom_compress.tensor_network_ag_compress_local_late)
- The **'projector'** method: [`tensor_network_ag_compress_projector`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_arbgeom_compress/index.html#quimb.tensor.tensor_arbgeom_compress.tensor_network_ag_compress_projector)
- The **'superorthogonal'** method: [`tensor_network_ag_compress_superorthogonal`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_arbgeom_compress/index.html#quimb.tensor.tensor_arbgeom_compress.tensor_network_ag_compress_superorthogonal)
- The **'l2bp'** method: [`tensor_network_ag_compress_l2bp`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_arbgeom_compress/index.html#quimb.tensor.tensor_arbgeom_compress.tensor_network_ag_compress_l2bp)

And can be accessed via the unified function [`tensor_network_ag_compress`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_arbgeom_compress/index.html#quimb.tensor.tensor_arbgeom_compress.tensor_network_ag_compress). 1D compression can also fall back to these methods.
- support PBC in [`tn2d.contract_hotrg`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_2d/index.html#quimb.tensor.tensor_2d.TensorNetwork2D.contract_hotrg), [`tn2d.contract_ctmrg`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_2d/index.html#quimb.tensor.tensor_2d.TensorNetwork2D.contract_ctmrg), [`tn3d.contract_hotrg`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_3d/index.html#quimb.tensor.tensor_3d.TensorNetwork3D.contract_hotrg) and the new function [`tn3d.contract_ctmrg`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_3d/index.html#quimb.tensor.tensor_3d.TensorNetwork3D.contract_ctmrg).
- support PBC in [`gen_2d_bonds`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_2d/index.html#quimb.tensor.tensor_2d.gen_2d_bonds) and [`gen_3d_bonds`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_3d/index.html#quimb.tensor.tensor_3d.gen_3d_bonds), with ``cyclic`` kwarg.
- support PBC in [`TN2D_rand_hidden_loop`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_builder/index.html#quimb.tensor.tensor_builder.TN2D_rand_hidden_loop) and [`TN3D_rand_hidden_loop`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_builder/index.html#quimb.tensor.tensor_builder.TN3D_rand_hidden_loop), with ``cyclic`` kwarg.
- support PBC in the various base PEPS and PEPO construction methods.
- add [`tensor_network_apply_op_op`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_arbgeom/index.html#quimb.tensor.tensor_arbgeom.tensor_network_apply_op_op) for applying 'operator' TNs to 'operator' TNs.
- tweak [`tensor_network_apply_op_vec`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_arbgeom/index.html#quimb.tensor.tensor_arbgeom.tensor_network_apply_op_vec) for applying 'operator' TNs to 'vector' or 'state' TNs.
- add [`tnvec.gate_with_op_lazy`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_arbgeom/index.html#quimb.tensor.tensor_arbgeom.TensorNetworkGenVector.gate_with_op_lazy) method for applying 'operator' TNs to 'vector' or 'state' TNs like $x \rightarrow A x$.
- add [`tnop.gate_upper_with_op_lazy`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_arbgeom/index.html#quimb.tensor.tensor_arbgeom.TensorNetworkGenOperator.gate_upper_with_op_lazy) method for applying 'operator' TNs to the upper indices of 'operator' TNs like $B \rightarrow A B$.
- add [`tnop.gate_lower_with_op_lazy`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_arbgeom/index.html#quimb.tensor.tensor_arbgeom.TensorNetworkGenOperator.gate_lower_with_op_lazy) method for applying 'operator' TNs to the lower indices of 'operator' TNs like $B \rightarrow B A$.
- add [`tnop.gate_sandwich_with_op_lazy`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_arbgeom/index.html#quimb.tensor.tensor_arbgeom.TensorNetworkGenOperator.gate_sandwich_with_op_lazy) method for applying 'operator' TNs to the upper and lower indices of 'operator' TNs like $B \rightarrow A B A^\dagger$.
- unify all TN summing routines into [`tensor_network_ag_sum`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_arbgeom/index.html#quimb.tensor.tensor_arbgeom.tensor_network_ag_sum), which allows summing *any* two tensor networks with matching site tags and outer indices, replacing specific MPS, MPO, PEPS, PEPO, etc. summing routines.
- add [`rand_symmetric_array`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_builder/index.html#quimb.tensor.tensor_builder.rand_symmetric_array), [`rand_tensor_symmetric`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_builder/index.html#quimb.tensor.tensor_builder.rand_tensor_symmetric) [`TN2D_rand_symmetric`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_builder/index.html#quimb.tensor.tensor_builder.TN2D_rand_symmetric) for generating random symmetric arrays, tensors and 2D tensor networks.

**Bug fixes:**

- fix scipy sparse monkey patch for scipy>=1.13 (222)
- fix autoblock bug where connected sectors were not being merged (223)


**Full Changelog**: https://github.com/jcmgray/quimb/compare/v1.7.3...v1.8.0

1.7.3

**Enhancements:**

- [qu.randn](https://quimb.readthedocs.io/en/latest/autoapi/quimb/index.html#quimb.randn): support `dist="rademacher"`.
- support `dist` and other `randn` options in various TN builders.

**Bug fixes:**

- restore fallback (to `scipy.linalg.svd` with driver='gesvd') behavior for truncated SVD with numpy backend.

**Full Changelog**: https://github.com/jcmgray/quimb/compare/v1.7.2...v1.7.3

1.7.2

**Bug fixes:**

- removed import of deprecated `numba.generated_jit` decorator.

**Enhancements:**

- add `normalized=True` option to [`tensor_network_distance`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_core/index.html#quimb.tensor.tensor_core.tensor_network_distance) for computing the normalized distance between tensor networks: $2 |A - B| / (|A| + |B|)$, which is useful for convergence checks. [`Tensor.distance_normalized`](quimb.tensor.tensor_core.Tensor.distance_normalized) and [`TensorNetwork.distance_normalized`](quimb.tensor.tensor_core.TensorNetwork.distance_normalized) added as aliases.
- add [`TensorNetwork.cut_bond`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_core/index.html#quimb.tensor.tensor_core.TensorNetwork.cut_bond) for cutting a bond index

**Full Changelog**: https://github.com/jcmgray/quimb/compare/v1.7.1...v1.7.2

1.7.1

What's Changed

**Enhancements:**

- add [`TensorNetwork.visualize_tensors`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/drawing/index.html#quimb.tensor.drawing.visualize_tensors) for visualizing the actual data entries of an entire tensor network.
<img width="724" alt="Screenshot 2024-01-30 at 9 16 56 AM" src="https://github.com/jcmgray/quimb/assets/8982598/3c2c3ef8-c41a-456b-b9e7-a73fa3e9d549">

- add [`ham.build_mpo_propagator_trotterized`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_1d_tebd/index.html#quimb.tensor.tensor_1d_tebd.LocalHam1D.build_mpo_propagator_trotterized) for building a trotterized propagator from a local 1D hamiltonian. This also includes updates for creating 'empty' tensor networks using [`TensorNetwork.new`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_core/index.html#quimb.tensor.tensor_core.TensorNetwork.new), and building up gates from empty tensor networks using [`TensorNetwork.gate_inds_with_tn`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/index.html#quimb.tensor.TensorNetwork.gate_inds_with_tn).
- add more options to [`Tensor.expand_ind`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/index.html#quimb.tensor.Tensor.expand_ind) and [`Tensor.new_ind`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/index.html#quimb.tensor.Tensor.new_ind): repeat tiling mode and random padding mode.
- tensor decomposition: make ``eigh_truncated`` backend agnostic.
- [`tensor_compress_bond`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_core/index.html#quimb.tensor.tensor_core.tensor_compress_bond): add `reduced="left"` and `reduced="right"` modes for when the pair of tensors is already in a canonical form.
- add [`qtn.TN2D_embedded_classical_ising_partition_function`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_builder/index.html#quimb.tensor.tensor_builder.TN2D_embedded_classical_ising_partition_function) for constructing 2D (triangular) tensor networks representing all-to-all classical ising partition functions.

**Bug fixes:**

- fix bug in [`kruas_op`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/index.html#quimb.kraus_op) when operator spanned multiple subsystems (214)
- fix bug in [`qr_stabilized`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/decomp/index.html#quimb.tensor.decomp.qr_stabilized) when the diagonal of `R` has significant imaginary parts.
- fix bug in quantum discord computation when the state was diagonal (217)
- Fix empty lines in dimacs by jjcmoon in https://github.com/jcmgray/quimb/pull/215

New Contributors

* jjcmoon made their first contribution in https://github.com/jcmgray/quimb/pull/215

**Full Changelog**: https://github.com/jcmgray/quimb/compare/v1.7.0...v1.7.1

1.7.0

**Breaking Changes**

- [`Circuit`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/circuit/index.html#quimb.tensor.circuit.Circuit) : remove `target_size` in preparation for all contraction specifications to be encapsulated at the contract level (e.g. with `cotengra`)
- some TN drawing options (mainly arrow options) have changed due to the backend change detailed below.

**Enhancements:**

*Multi tag drawing support*:

![drawing-updates-banner](https://github.com/jcmgray/quimb/assets/8982598/8edf5e83-d8d8-4da2-8115-645a041c41de)

- [TensorNetwork.draw](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/drawing/index.html#quimb.tensor.drawing.draw_tn): use [`quimb.schematic`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/schematic/index.html) for main `backend="matplotlib"` drawing. Enabling:
1. multi tag coloring for single tensors
2. arrows and labels on multi-edges
3. better sizing of tensors using absolute units
4. neater single tensor drawing, in 2D and 3D
* add [quimb.schematic.Drawing](https://quimb.readthedocs.io/en/latest/autoapi/quimb/schematic/index.html#quimb.schematic.Drawing) from experimental submodule, add example docs at [`schematic`](https://quimb.readthedocs.io/en/latest/examples/schematic-demo.html). Add methods [`text_between`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/schematic/index.html#quimb.schematic.Drawing.text_between), [`wedge`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/schematic/index.html#quimb.schematic.Drawing.wedge), [`line_offset`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/schematic/index.html#quimb.schematic.Drawing.line_offset) and other tweaks for future use by main TN drawing.
- upgrade all contraction to use `cotengra` as the backend
- [`Circuit`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/index.html#quimb.tensor.Circuit) : allow any gate to be [controlled by any number of qubits](https://quimb.readthedocs.io/en/latest/autoapi/quimb/index.html#quimb.ncontrolled_gate).
- [`Circuit`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/index.html#quimb.tensor.Circuit) : support for parsing `openqasm2` specifications now with custom and nested gate definitions etc.
- add [`is_cyclic_x`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_2d/index.html#quimb.tensor.tensor_2d.TensorNetwork2D.is_cyclic_x), [`is_cyclic_y`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_2d/index.html#quimb.tensor.tensor_2d.TensorNetwork2D.is_cyclic_y)) and [`is_cyclic_z`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_3d/index.html#quimb.tensor.tensor_3d.TensorNetwork3D.is_cyclic_z) to [TensorNetwork2D](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_2d/index.html#quimb.tensor.tensor_2d.TensorNetwork2D) and [TensorNetwork3D](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_3d/index.html#quimb.tensor.tensor_3d.TensorNetwork3D).
- add [TensorNetwork.compress_all_1d](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/index.html#quimb.tensor.TensorNetwork.compress_all_1d) for compressing generic tensor networks that you promise have a 1D topology, without casting as a [TensorNetwork1D](quimb.tensor.TensorNetwork1D).
- add [MatrixProductState.from_fill_fn](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_1d/index.html#quimb.tensor.tensor_1d.MatrixProductState.from_fill_fn) for constructing MPS from a function that fills the tensors.
- add [Tensor.idxmin](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/index.html#quimb.tensor.Tensor.idxmin) and [Tensor.idxmax](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/index.html#quimb.tensor.Tensor.idxmax) for finding the index of the minimum / maximum element.
- 2D and 3D classical partition function TN builders: allow output indices.
- [`quimb.experimental.belief_propagation`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/experimental/belief_propagation/index.html): add various 1-norm/2-norm dense/lazy BP algorithms.

**Bug fixes:**

- fixed bug where an output index could be removed by squeezing when performing tensor network simplifications.
* Fix deprecation warnings by king-p3nguin in https://github.com/jcmgray/quimb/pull/209

New Contributors
* king-p3nguin made their first contribution in https://github.com/jcmgray/quimb/pull/209

**Full Changelog**: https://github.com/jcmgray/quimb/compare/v1.6.0...v1.7.0

1.6.0

**Breaking Changes**

- Quantum circuit RZZ definition corrected (angle changed by -1/2 to match qiskit).

**Enhancements:**

- add OpenQASM 2.0 parsing support: :meth:`Circuit.from_openqasm2_file`
- :class:`Circuit`: add RXX, RYY, CRX, CRY, CRZ, toffoli, fredkin, givens gates
- truncate TN pretty html reprentation to 100 tensors for performance
- add :meth:`Tensor.sum_reduce` and :meth:`Tensor.vector_reduce`
- :meth:`contract_compressed`, default to 'virtual-tree' gauge
- add :func:`TN_rand_tree`
- `experimental.operatorbuilder`: fix parallel and heisenberg builder
- make parametrized gate generation even more robost (ensure matching types so e.g. tensorflow can be used)

**Bug fixes:**

- fix gauge size check for some backends

**Full Changelog**: https://github.com/jcmgray/quimb/compare/v1.5.1...v1.6.0

Page 1 of 3

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.