Releases: jcmgray/quimb
v1.10.0
Enhancements
- tensor network fitting: add
method="tree"
for when ansatz is a tree -tensor_network_fit_tree
- tensor network fitting: fix
method="als"
for complex dtype networks - tensor network fitting: allow
method="als"
to use a iterative solver suited to much larger tensors, by default a custom conjugate gradient implementation. -
tensor_network_distance
and fitting: support hyper indices explicitly viaoutput_inds
kwarg - add
tn.make_overlap
andtn.overlap
for computing the overlap between two tensor networks,$\langle O |T \rangle$ , with explicit handling of outer indices to address hyper networks. Addoutput_inds
totn.norm
andtn.make_norm
also, as well as thesquared
kwarg. - replace all
numba
based paralellism (prange
and parallel vectorize) with explicit thread pool based parallelism. Should be more reliable and no need to setNUMBA_NUM_THREADS
anymore. Remove env varQUIMB_NUMBA_PAR
. -
Circuit
: adddtype
andconvert_eager
options.dtype
specifies what the computation should be performed in.convert_eager
specifies whether to apply this (and anyto_backend
calls) as soon as gates are applied (the default for MPS circuit simulation) or just prior to contraction (the default for exact contraction simulation). -
tn.full_simplify
: addcheck_zero
(by default set of"auto"
) option which explicitly checks for zero tensor norms when equalizing norms to avoidlog10(norm)
resulting in -inf or nan. Since it creates a data dependency that breaks e.g.jax
tracing, it is optional. -
schematic.Drawing
: addshorten
kwarg to line drawing and curve drawing and examples to the docs. -
TensorNetwork
: add.backend
and.dtype_name
properties.
PRs:
- Circuit: add default dtype and convert_eager options by @jcmgray in #273
- add fit(method="tree") and fix ALS for complex TNs by @jcmgray in #274
Full Changelog: v1.9.0...v1.10.0
v1.9.0
Breaking Changes
- renamed
MatrixProductState.partial_trace
andMatrixProductState.ptr
to MatrixProductState.partial_trace_to_mpo to avoid confusion with otherpartial_trace
methods that usually produce a dense matrix.
Enhancements:
- add
Circuit.sample_gate_by_gate
and related methodsCircuitMPS.reordered_gates_dfs_clustered
andCircuitMPS.get_qubit_distances
for sampling a circuit using the 'gate by gate' method introduced in https://arxiv.org/abs/2112.08499. - add
Circuit.draw
for drawing a very simple circuit schematic. -
Circuit
: by default turn onsimplify_equalize_norms
and use agroup_size=10
for sampling. This should result in faster and more stable sampling. -
Circuit
: usenumpy.random.default_rng
for random number generation. - add
qtn.circ_a2a_rand
for generating random all-to-all circuits. - expose
qtn.edge_coloring
as top level function and allow layers to be returned grouped. - add docstring for
tn.contract_compressed
and by default pick up important settings from the supplied contraction path optimizer (max_bond
andcompress_late
) - add
Tensor.rand_reduce
for randomly removing a tensor index by contracting a random vector into it. One can also supply the value"r"
toisel
selectors to use this. - add
fit-zipup
andfit-projector
shorthand methods to the general 1d tensor network compression function - add
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
to make use of the MPS form. - add
PEPS.product_state
for constructing a PEPS representing a product state. - add
PEPS.vacuum
for constructing a PEPS representing the vacuum state$|000\ldots0\rangle$ . - add
PEPS.zeros
for constructing a PEPS whose entries are all zero. -
tn.gauge_all_simple
: improve scheduling and adddamping
andtouched_tids
options. -
qtn.SimpleUpdateGen
: add gauge difference update checking andtol
andequilibrate
settings. Update.plot()
method. Default to a smallcutoff
. - add
psi.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
v1.8.4
What's Changed
- fix MPS sample handling of RNG seed by @kevinsung in #248
- fix bug in applying MPO lazily to MPS (#246)
New Contributors
- @kevinsung made their first contribution in #248
Full Changelog: v1.8.3...v1.8.4
v1.8.3
Enhancements:
- support for numpy v2.0 and scipy v1.14
- add MPS sampling:
MatrixProductState.sample_configuration
andMatrixProductState.sample
(generating multiple samples) and use these forCircuitMPS.sample
andCircuitPermMPS.sample
. - add basic plot method for [
SimpleUpdate
] classes - add
edges_1d_chain
for generating 1D chain edges - operatorbuilder: better coefficient placement for long range / non-local MPO building
Full Changelog: v1.8.2...v1.8.3
v1.8.2
Enhancements:
TNOptimizer
can now accept an arbitrary pytree (nested combination of dicts, lists, tuples, etc. withTensorNetwork
,Tensor
or rawarray_like
objects as the leaves) as the target object to optimize.TNOptimizer
can now directly optimizeCircuit
objects, returning a new optimized circuit with updated parameters.Circuit
: add.copy()
,.get_params()
and.set_params()
interface methods.- Update generic TN optimizer docs.
- add
tn.gen_inds_loops
for generating all loops of indices in a TN. - add
tn.gen_inds_connected
for generating all connected sets of indices in a TN. - make SVD fallback error catching more generic (by @mlxd in #238)
- fix some windows + numba CI issues.
approx_spectral_function
add plotting and tracking- add dispatching to various tensor primitives to allow overriding
New Contributors
Full Changelog: v1.8.1...v1.8.2
v1.8.1
Enhancements:
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
, more docs here: https://quimb.readthedocs.io/en/latest/tensor-circuit-mps.html - add
MatrixProductState.gate_nonlocal
for applying a gate, supplied as a raw matrix, to a non-local and arbitrary number of sites. The kwargcontract="nonlocal"
can be used to force this method, or the new option"auto-mps"
will select this method if the gate is non-local (#230) - add
MatrixProductState.gate_with_mpo
for applying an MPO to an MPS, and immediately compressing back to MPS form usingtensor_network_1d_compress
- add
MatrixProductState.gate_with_submpo
for applying an MPO acting only of a subset of sites to an MPS - add
MatrixProductOperator.from_dense
for constructing MPOs from dense matrices, including an only subset of sites - add
MatrixProductOperator.fill_empty_sites
for 'completing' an MPO which only has tensors on a subset of sites with (by default) identities MatrixProductState
andMatrixProductOperator
, now support thesites
kwarg in common constructors, enabling the TN to act on a subset of the fullL
sites.- add
TensorNetwork.drape_bond_between
for 'draping' an existing bond between two tensors through a third - add
Tensor.new_ind_pair_with_identity
- TN2D, TN3D and arbitrary geom classical partition function builders (
TN_classical_partition_function_from_edges
) now all supportoutputs=
kwarg specifying non-marginalized variables - add simple dense 1-norm belief propagation algorithm
D1BP
- add
qtn.enforce_1d_like
for checking whether a tensor network is 1D-like, including automatically adding strings of identities between non-local bonds, expanding applicability oftensor_network_1d_compress
- add
MatrixProductState.canonicalize
as (by default non-inplace) version ofcanonize
, to follow the pattern of other tensor network methods.canonize
is now an alias forcanonicalize_
[note trailing underscore]. - add
MatrixProductState.left_canonicalize
as (by default non-inplace) version ofleft_canonize
, to follow the pattern of other tensor network methods.left_canonize
is now an alias forleft_canonicalize_
[note trailing underscore]. - add
MatrixProductState.right_canonicalize
as (by default non-inplace) version ofright_canonize
, to follow the pattern of other tensor network methods.right_canonize
is now an alias forright_canonicalize_
[note trailing underscore].
Bug fixes:
Circuit.apply_gate_raw
: fix kwarg bug (#226) by @juliendrapeau- fix for retrieving
opt_einsum.PathInfo
for single scalar contraction (#231).
New Contributors
- @juliendrapeau made their first contribution in #226
Full Changelog: v1.8.0...v1.8.1
v1.8.0
Breaking Changes
- all singular value renormalization is turned off by default
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
- The 'dm' (density matrix) method:
tensor_network_1d_compress_dm
- The 'zipup' method:
tensor_network_1d_compress_zipup
- The 'zipup-first' method:
tensor_network_1d_compress_zipup_first
- The 1 and 2 site 'fit' or sweeping method:
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
. Boundary contraction in 2D can now utilize any of these methods. - The 'direct' method:
-
add
quimb.tensor.tensor_arbgeom_compress.py
with functions for compressing arbitrary geometry tensor networks using various methods. The methods are:- The 'local-early' method:
tensor_network_ag_compress_local_early
- The 'local-late' method:
tensor_network_ag_compress_local_late
- The 'projector' method:
tensor_network_ag_compress_projector
- The 'superorthogonal' method:
tensor_network_ag_compress_superorthogonal
- The 'l2bp' method:
tensor_network_ag_compress_l2bp
And can be accessed via the unified function
tensor_network_ag_compress
. 1D compression can also fall back to these methods. - The 'local-early' method:
-
support PBC in
tn2d.contract_hotrg
,tn2d.contract_ctmrg
,tn3d.contract_hotrg
and the new functiontn3d.contract_ctmrg
. -
support PBC in
gen_2d_bonds
andgen_3d_bonds
, withcyclic
kwarg. -
support PBC in
TN2D_rand_hidden_loop
andTN3D_rand_hidden_loop
, withcyclic
kwarg. -
support PBC in the various base PEPS and PEPO construction methods.
-
add
tensor_network_apply_op_op
for applying 'operator' TNs to 'operator' TNs. -
tweak
tensor_network_apply_op_vec
for applying 'operator' TNs to 'vector' or 'state' TNs. -
add
tnvec.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
method for applying 'operator' TNs to the upper indices of 'operator' TNs like$B \rightarrow A B$ . -
add
tnop.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
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
, 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
,rand_tensor_symmetric
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: v1.7.3...v1.8.0
v1.7.3
Enhancements:
- qu.randn: support
dist="rademacher"
. - support
dist
and otherrandn
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: v1.7.2...v1.7.3
v1.7.2
Bug fixes:
- removed import of deprecated
numba.generated_jit
decorator.
Enhancements:
- add
normalized=True
option totensor_network_distance
for computing the normalized distance between tensor networks:$2 |A - B| / (|A| + |B|)$ , which is useful for convergence checks.Tensor.distance_normalized
andTensorNetwork.distance_normalized
added as aliases. - add
TensorNetwork.cut_bond
for cutting a bond index
Full Changelog: v1.7.1...v1.7.2
v1.7.1
What's Changed
Enhancements:
- add
TensorNetwork.visualize_tensors
for visualizing the actual data entries of an entire tensor network.
- add
ham.build_mpo_propagator_trotterized
for building a trotterized propagator from a local 1D hamiltonian. This also includes updates for creating 'empty' tensor networks usingTensorNetwork.new
, and building up gates from empty tensor networks usingTensorNetwork.gate_inds_with_tn
. - add more options to
Tensor.expand_ind
andTensor.new_ind
: repeat tiling mode and random padding mode. - tensor decomposition: make
eigh_truncated
backend agnostic. tensor_compress_bond
: addreduced="left"
andreduced="right"
modes for when the pair of tensors is already in a canonical form.- add
qtn.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
when operator spanned multiple subsystems (#214) - fix bug in
qr_stabilized
when the diagonal ofR
has significant imaginary parts. - fix bug in quantum discord computation when the state was diagonal (#217)
- Fix empty lines in dimacs by @jjcmoon in #215
New Contributors
Full Changelog: v1.7.0...v1.7.1