Quimb

Latest version: v1.9.0

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

Scan your dependencies

Page 1 of 3

1.9.0

**Breaking Changes**

- renamed `MatrixProductState.partial_trace` and `MatrixProductState.ptr` to [MatrixProductState.partial_trace_to_mpo](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_1d/index.html#quimb.tensor.tensor_1d.MatrixProductState.partial_trace_to_mpo) to avoid confusion with other `partial_trace` methods that usually produce a dense matrix.

**Enhancements:**

- add [`Circuit.sample_gate_by_gate`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/circuit/index.html#quimb.tensor.circuit.Circuit.sample_gate_by_gate) and related methods [`CircuitMPS.reordered_gates_dfs_clustered`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/circuit/index.html#quimb.tensor.circuit.Circuit.reordered_gates_dfs_clustered) and [`CircuitMPS.get_qubit_distances`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/index.html#quimb.tensor.Circuit.get_qubit_distances) for sampling a circuit using the 'gate by gate' method introduced in https://arxiv.org/abs/2112.08499.
- add [`Circuit.draw`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/circuit/index.html#quimb.tensor.circuit.Circuit.draw) for drawing a very simple circuit schematic.
- [`Circuit`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/circuit/index.html#quimb.tensor.circuit.Circuit): by default turn on `simplify_equalize_norms` and use a `group_size=10` for sampling. This should result in faster and more stable sampling.
- [`Circuit`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/circuit/index.html#quimb.tensor.circuit.Circuit): use `numpy.random.default_rng` for random number generation.
- add [`qtn.circ_a2a_rand`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/circuit_gen/index.html#quimb.tensor.circuit_gen.circ_a2a_rand) for generating random all-to-all circuits.
- expose [`qtn.edge_coloring`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_arbgeom_tebd/index.html#quimb.tensor.tensor_arbgeom_tebd.edge_coloring) as top level function and allow layers to be returned grouped.
- add docstring for [`tn.contract_compressed`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_core/index.html#quimb.tensor.tensor_core.TensorNetwork.contract_compressed) and by default pick up important settings from the supplied contraction path optimizer (`max_bond` and `compress_late`)
- add [`Tensor.rand_reduce`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_core/index.html#quimb.tensor.tensor_core.Tensor.rand_reduce) for randomly removing a tensor index by contracting a random vector into it. One can also supply the value `"r"` to `isel` selectors to use this.
- add `fit-zipup` and `fit-projector` shorthand methods to the general 1d tensor network compression function
- add [`MatrixProductState.compute_local_expectation`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_1d/index.html#quimb.tensor.tensor_1d.MatrixProductState.compute_local_expectation) for computing many local expectations for a MPS at once, to match the interface for this method elsewhere. These can either be computed via canonicalization (`method="canonical"`), or via explicit left and right environment contraction (`method="envs"`)
- specialize [`CircuitMPS.local_expectation`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/circuit/index.html#quimb.tensor.circuit.CircuitMPS.local_expectation) to make use of the MPS form.
- add [`PEPS.product_state`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_2d/index.html#quimb.tensor.tensor_2d.PEPS.product_state) for constructing a PEPS representing a product state.
- add [`PEPS.vacuum`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_2d/index.html#quimb.tensor.tensor_2d.PEPS.vacuum) for constructing a PEPS representing the vacuum state $|000\ldots0\rangle$.
- add [`PEPS.zeros`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_2d/index.html#quimb.tensor.tensor_2d.PEPS.zeros) for constructing a PEPS whose entries are all zero.
- [`tn.gauge_all_simple`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_core/index.html#quimb.tensor.tensor_core.TensorNetwork.gauge_all_simple): improve scheduling and add `damping` and `touched_tids` options.
- [`qtn.SimpleUpdateGen`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_arbgeom_tebd/index.html#quimb.tensor.tensor_arbgeom_tebd.SimpleUpdateGen): add gauge difference update checking and `tol` and `equilibrate` settings. Update `.plot()` method. Default to a small `cutoff`.
- add [`psi.sample_configuration_cluster`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_arbgeom/index.html#quimb.tensor.tensor_arbgeom.TensorNetworkGenVector.sample_configuration_cluster) for sampling a tensor network using the simple update or cluster style environment approximation.
- add the new example doc [Exploring circuit sampling with various methods](https://quimb.readthedocs.io/en/latest/examples/ex_tn_circuit_sample_explore.html#ex-circuit-sampling)

1.8.4

What's Changed
* fix MPS sample handling of RNG seed by kevinsung in https://github.com/jcmgray/quimb/pull/248
* fix bug in applying MPO lazily to MPS (246)

New Contributors
* kevinsung made their first contribution in https://github.com/jcmgray/quimb/pull/248

**Full Changelog**: https://github.com/jcmgray/quimb/compare/v1.8.3...v1.8.4

1.8.3

**Enhancements:**

- support for numpy v2.0 and scipy v1.14
- add MPS sampling: [`MatrixProductState.sample_configuration`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_1d/index.html#quimb.tensor.tensor_1d.MatrixProductState.sample_configuration) and [`MatrixProductState.sample`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_1d/index.html#quimb.tensor.tensor_1d.MatrixProductState.sample) (generating multiple samples) and use these for [`CircuitMPS.sample`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/circuit/index.html#quimb.tensor.circuit.CircuitMPS.sample) and [`CircuitPermMPS.sample`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/circuit/index.html#quimb.tensor.circuit.CircuitPermMPS.sample).
- add basic plot method for [`SimpleUpdate`] classes
- add [`edges_1d_chain`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/geometry/index.html#quimb.tensor.geometry.edges_1d_chain) for generating 1D chain edges
- [operatorbuilder](https://quimb.readthedocs.io/en/latest/autoapi/quimb/experimental/operatorbuilder/index.html#module-quimb.experimental.operatorbuilder): better coefficient placement for long range / non-local MPO building


**Full Changelog**: https://github.com/jcmgray/quimb/compare/v1.8.2...v1.8.3

1.8.2

**Enhancements:**

- [`TNOptimizer`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/optimize/index.html#quimb.tensor.optimize.TNOptimizer) can now accept an arbitrary pytree (nested combination of dicts, lists, tuples, etc. with `TensorNetwork`, `Tensor` or raw `array_like` objects as the leaves) as the target object to optimize.
- [`TNOptimizer`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/optimize/index.html#quimb.tensor.optimize.TNOptimizer) can now directly optimize [`Circuit`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/circuit/index.html#quimb.tensor.circuit.Circuit) objects, returning a new optimized circuit with updated parameters.
- [`Circuit`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/circuit/index.html#quimb.tensor.circuit.Circuit): add `.copy()`, `.get_params()` and `.set_params()` interface methods.
- Update generic TN optimizer docs.
- add [`tn.gen_inds_loops`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_core/index.html#quimb.tensor.tensor_core.TensorNetwork.gen_inds_loops) for generating all loops of indices in a TN.
- add [`tn.gen_inds_connected`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tensor_core/index.html#quimb.tensor.tensor_core.TensorNetwork.gen_inds_connected) for generating all connected sets of indices in a TN.
- make SVD fallback error catching more generic (by mlxd in https://github.com/jcmgray/quimb/pull/238)
- fix some windows + numba CI issues.
- [`approx_spectral_function`](https://quimb.readthedocs.io/en/latest/autoapi/quimb/linalg/approx_spectral/index.html#quimb.linalg.approx_spectral.approx_spectral_function) add plotting and tracking
- add dispatching to various tensor primitives to allow overriding

New Contributors
* mlxd made their first contribution in https://github.com/jcmgray/quimb/pull/238

**Full Changelog**: https://github.com/jcmgray/quimb/compare/v1.8.1...v1.8.2

1.8.1

Enhancements:

- [`CircuitMPS`](quimb.tensor.circuit.CircuitMPS) now supports multi qubit gates, including arbitrary multi-controls (which are treated in a low-rank manner), and faster simulation via better orthogonality center tracking.
- add [`CircuitPermMPS`](quimb.tensor.circuit.CircuitPermMPS), more docs here: https://quimb.readthedocs.io/en/latest/tensor-circuit-mps.html
- add [`MatrixProductState.gate_nonlocal`](quimb.tensor.tensor_1d.MatrixProductState.gate_nonlocal) for applying a gate, supplied as a raw matrix, to a non-local and arbitrary number of sites. The kwarg `contract="nonlocal"` can be used to force this method, or the new option `"auto-mps"` will select this method if the gate is non-local (https://github.com/jcmgray/quimb/issues/230)
- add [`MatrixProductState.gate_with_mpo`](quimb.tensor.tensor_1d.MatrixProductState.gate_with_mpo) for applying an MPO to an MPS, and immediately compressing back to MPS form using [`tensor_network_1d_compress`](quimb.tensor.tensor_1d_compress.tensor_network_1d_compress)
- add [`MatrixProductState.gate_with_submpo`](quimb.tensor.tensor_1d.MatrixProductState.gate_with_submpo) for applying an MPO acting only of a subset of sites to an MPS
- add [`MatrixProductOperator.from_dense`](quimb.tensor.tensor_1d.MatrixProductOperator.from_dense) for constructing MPOs from dense matrices, including an only subset of sites
- add [`MatrixProductOperator.fill_empty_sites`](quimb.tensor.tensor_1d.MatrixProductOperator.fill_empty_sites) for 'completing' an MPO which only has tensors on a subset of sites with (by default) identities
- [`MatrixProductState`](quimb.tensor.tensor_1d.MatrixProductState) and [`MatrixProductOperator`](quimb.tensor.tensor_1d.MatrixProductOperator), now support the ``sites`` kwarg in common constructors, enabling the TN to act on a subset of the full ``L`` sites.
- add [`TensorNetwork.drape_bond_between`](quimb.tensor.tensor_core.TensorNetwork.drape_bond_between) for 'draping' an existing bond between two tensors through a third
- add [`Tensor.new_ind_pair_with_identity`](quimb.tensor.tensor_core.Tensor.new_ind_pair_with_identity)
- TN2D, TN3D and arbitrary geom classical partition function builders ([`TN_classical_partition_function_from_edges`](quimb.tensor.tensor_builder.TN_classical_partition_function_from_edges)) now all support `outputs=` kwarg specifying non-marginalized variables
- add simple dense 1-norm belief propagation algorithm [`D1BP`](quimb.experimental.belief_propagation.d1bp.D1BP)
- add [`qtn.enforce_1d_like`](quimb.tensor.tensor_1d_compress.enforce_1d_like) for checking whether a tensor network is 1D-like, including automatically adding strings of identities between non-local bonds, expanding applicability of [`tensor_network_1d_compress`](quimb.tensor.tensor_1d_compress.tensor_network_1d_compress)
- add [`MatrixProductState.canonicalize`](quimb.tensor.tensor_1d.MatrixProductState.canonicalize) as (by default *non-inplace*) version of `canonize`, to follow the pattern of other tensor network methods. `canonize` is now an alias for `canonicalize_` [note trailing underscore].
- add [`MatrixProductState.left_canonicalize`](quimb.tensor.tensor_1d.MatrixProductState.left_canonicalize) as (by default *non-inplace*) version of `left_canonize`, to follow the pattern of other tensor network methods. `left_canonize` is now an alias for `left_canonicalize_` [note trailing underscore].
- add [`MatrixProductState.right_canonicalize`](quimb.tensor.tensor_1d.MatrixProductState.right_canonicalize) as (by default *non-inplace*) version of `right_canonize`, to follow the pattern of other tensor network methods. `right_canonize` is now an alias for `right_canonicalize_` [note trailing underscore].

Bug fixes:

- [`Circuit.apply_gate_raw`](quimb.tensor.circuit.Circuit.apply_gate_raw): fix kwarg bug (https://github.com/jcmgray/quimb/pull/226) by juliendrapeau
- fix for retrieving `opt_einsum.PathInfo` for single scalar contraction (https://github.com/jcmgray/quimb/issues/231).

New Contributors
* juliendrapeau made their first contribution in https://github.com/jcmgray/quimb/pull/226

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

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

Page 1 of 3

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.