Releases: jcmgray/quimb
Releases · jcmgray/quimb
v1.13.0
What's Changed
Breaking Changes
ham_hubbard_hardcorefix description and sign convention of hopping strengtht.heisenberg_from_edgesfix sign convention of magnetic field terms.- the
quimb.tensorsubmodule structure has been refactored withtn1d,tn2d,tn3d, andtnagsubmodules for better organization. Imports from old locations will still work, but are deprecated. Public classes and functions such asMatrixProductStateare directly accessible from the top levelquimb.tensormodule as before.
Enhancements:
Major updates to splitting/decomposing individual tensors/arrays:
- add
array_splitandarray_svalsas the primary array-level entry points for matrix decomposition, consolidating dispatch logic that was previously internal totensor_core. - add
register_split_driverandregister_svals_driverdecorators for registering custom matrix decomposition methods witharray_splitandarray_svals. - allow
array_splitto handle batches of matrices (for most methods). array_split: automatically detect and forward valid kwargs to underlying decomposition methods.tensor_splitandarray_split: expandabsorboptions significantly beyond"left","both","right",Noneto include"lorthog","rorthog","lfactor","rfactor","lsqrt","rsqrtand"s"for returning partial results (single factors or singular values only). Default changed from"both"to"auto", which uses each method's natural default.- add method
"svd:eig"with main implementationsvd_via_eigfor efficient SVD via hermitian eigen-decomposition, with shortcuts for all absorb modes. This can be faster (especially e.g. on GPU) than the standard SVD, but entails some loss of precision. tensor_split: renamemethodoption"eig"to"svd:eig"to make it clearer that this is an SVD split via eigen-decomposition."eig"remains as a deprecated alias for"svd:eig".- add method
"svd:rand"with main implementationsvd_rand_truncatedfor randomized SVD with truncation, with shortcuts for all absorb modes. (This is a new and backend agnostic implementation as opposed to the existing'rsvd'method). - add method
"qr:cholesky"qr_via_choleskyfor efficient QR or LQ like decompositions via cholesky decomposition, with shortcuts for all absorb modes. This can be faster than the standard QR (especially on GPU) but entails some loss of precision. tensor_splitandarray_split: add"lsqrt"and"rsqrt"absorb options, update cholesky decomposition tocholesky_regularizedwithshiftas exposed parameter.compute_oblique_projectors: allowmethodkwarg.- QR decomposition: add
stabilizekwarg for controlling QR stabilization behavior. - decomposition methods: various compatibility improvements for JAX backend.
Other enhancements:
- add
shiftandclockoperators. - add
Tensor.isfermionicandTensorNetwork.isfermionicmethods. - add
Tensor.isblocksparseandTensorNetwork.isblocksparsemethods. - add
phase_dualoption toTensorNetwork.conj. - rename
tensor_network_1d_compress_zipup_firsttotensor_network_1d_compress_zipup_oversampleand standardiseoversamplearguments. - add
tensor_network_1d_compress_srcmps_oversampleandtensor_network_1d_compress_fit_oversamplemethods. - add
connected_bipartitionsfor finding all connected bipartitions of a tensor network -
tn.distribute_exponent: addnew_exponentoption for specifying the new exponent value (default 0.0). -
tensor_network_1d_compress: correctly handle input networks with non-zero exponents andequalize_norms. - add
tensor_network_gate_sandwich_indsfor applying a gate and its conjugate like$G A G^\dagger$ to a tensor network. -
tensor_network_ag_gate: addwhich="sandwich"option for applying a gate and its conjugate like$G A G^\dagger$ to a tensor network, default to this if the supplied tensor network is aTensorNetworkGenOperator. - add function
tensor_network_ag_gate_simplefor applying a gate to an arbitrary geometry tensor network vector or operator, using simple update stylegaugesto perform any compression. -
insert_compressor_between_regionsand upstream CTMRG/HOTRG methods: add explicitcontract_opts,reduce_opts, andcompress_optskeyword arguments for fine-grained control. -
TensorNetwork2D.contract_boundary,contract_ctmrg, [contract_hotrg](https://quimb.readthedocs.io/en/latest/autoapi/quimb/tensor/tn2d/core/index.html#quimb.tensor.tn2d.core.TensorNetwork2D....
v1.12.1
Breaking Changes
- bump minimum required python version to 3.11
Bug fixes:
- fix
SimpleUpdateGenmixin inheritance order. - fix
insert_compressor_between_regionsfor fermionic tensor networks with bond signature +-.
Full Changelog: v1.12.0...v1.12.1
v1.12.0
What's Changed
Enhancements:
- move the experimental
operatorbuildermodule to the mainquimb.operatormodule. - add basic introduction to the operator module - "Basics"
- add new example on tracing tensor network functions
ex_tracing_tn_functions tensor_split: add aninfokwarg, supplying this with an empty dict or with the entry'error'will store the truncation error when usingmethod in {"svd", "eig"}.- update infrastructure for TEBD and SimpleUpdate based algorithms.
schematic.Drawing: addgrid,grid3d,bezier,star,crossandzigzagmethods.schematic.Drawing: addrelativeoption toarrowhead,shortenoption totext_betweenandtext_leftandtext_rightoptions toline.- add
Drawing.scale_figsizefor automatically setting the absolute figsize based on placed elements. - refactor
TEBDGenandSimpleUpdateGen - update the 2d specific
SimpleUpdateto use the new infrastructure. tn.draw(): show abelian signature if usingsymmrayarrays.tn.draw(): addadjust_limsoptionTNOptimizer: allowautodiff_backend="torch"withjit_fn=Trueto work with array backends with general pytree parameters, e.g.symmrayarrays.tn.gen_gloopsandtn.gen_gloops_sites: addjoin_overlapoption. When building cluster by joining smaller generalized loops, this option controls how many nodes they need to overlap by to be joined together.- all message passing routines: add
callbackoption - GBP: allow a message initilization function.
D1BP: allowmessagesto be a callable initialization function.MatrixProductState.gate_nonlocal: addmethod="lazy"option for lazily applying a non-local gate as a sub-MPO without contraction or compression.LocalHamGen.apply_to_arrays: support pytree parameter arrays such assymmray.- add
Tensor.get_namespaceandTensorNetwork.get_namespacefor getting a reusable data array namespace TensorNetwork.isel: usetakewhere possible to better support e.g.torch.vmapacross amplitudes.MatrixProductState.measure, andMatrixProductState.sample: addbackend_randomoption for specifying which backend to use for random number generation when sampling, this can be set for example tojaxto make the whole process jittable, but by default isnumpy, regardless of the actual array backend.- add codes of 2-site MPS-MPO fitting for fermionic TN by @sjdu10 in #333
Bug fixes:
- fix
insert_compressor_between_regionswheninsert_into is None. - tensor network drawing, ensure hyper indices can be specified as
output_inds. - fix
MatrixProductState.measurewhen using jax arrays ({issue}340). - fix
MatrixProductState.measurewhen projecting and keeping a site site ({issue}344). - Relax equality tolerance for
float32values by @iyanmv in #329 - Use input parameters for optimize in tree als fitting by @h-larsson in #337
New Contributors
- @iyanmv made their first contribution in #329
- @sjdu10 made their first contribution in #333
- @h-larsson made their first contribution in #337
Full Changelog: v1.11.2...v1.12.0
v1.11.2
Enhancements:
- Update the introduction to tensor contraction docs
- Improve efficiency of 1D structured contractions when default
optimizeis used.
Bug fixes:
- fixes for MPS and MPO constructors when L=1, (#314)
- tensor splitting with absorb="left" now correctly marks left indices.
tn.isel: fix bug when value could not be compared to string"r"- truncated svd, make n_chi comparison more robust to different backends
Full Changelog: v1.11.1...v1.11.2
v1.11.1
Enhancements:
- add
create_bondtotensor_canonize_bondandtensor_compress_bondfor optionally creating a new bond between two tensors if they don't already share one. Add as a flag toTensorNetwork1DFlat.compressand related functions (#294). - add
ensure_bonds_existfor ensuring that all bonds in a 1D flat tensor network exist. Use this in thepermute_arraysmethods and optionally in theexpand_bond_dimensionmethod. tn.draw(): permit empty network, and allowcolor=Trueto automatically color all tags.tn.add_tag: add arecord: Optional[dict]kwarg, to allow for easy rewinding of temporary tags without tracking the actual networks.- add
qu.plotas a quick wrapper for callingmatplotlib.pyplot.plotwith thequimbstyle. quimb.schematic: addzorder_deltakwarg for fine adjustments to layering of objects in approximately the same position.operatorbuilder: big performance improvements and fixes for building matrix representations including Z2 symmetry. Add defaultsymmetryandsectoroptions that can be overridden at build time. Add lazy (slow, matrix free) 'apply' method. Addpauli_decomposetransformation. Add experimental PEPO builder for nearest neighbor operators. Add unit tests.
Bug fixes:
- Fix
TensorNetwork2D.compute_plaquette_environmentsformode="zipup"and other boundary contraction methods that use the generic 1D compression algorithms. parse_openqasm2_strallow custom gate names to start with the wordgate(#312).MatrixProductState.gate_with_mpo: fix bug to do with inplace argument (#313).
Full Changelog: v1.11.0...v1.11.1
v1.11.0
Breaking Changes
- move belief propagation to
quimb.tensor.belief_propagation - calling
tn.contract()when an non-zero value has been accrued intotn.exponentnow automatically re-absorbs that exponent. - binary tensor operations that would previously have errored now will align and broadcast
Enhancements:
Tensor: make binary operations (+, -, *, /, **) automatically align and broadcast indices. This would previously error.MatrixProductState.measure: add aseedkwarg- belief propagation, implement DIIS (direct inversion in the iterative subspace)
- belief propagation, unify various aspects such as message normalization and distance.
- belief propagation, add a
plotmethod. - belief propagation, add a
contract_everyoption. - HV1BP: vectorize both contraction and message initialization
- add
qu.plot_multi_series_zoomfor plotting multiple series with a zoomed inset, useful for various convergence plots such as BP - add
infooption totn.gauge_all_simplefor tracking extra information such as number of iterations and max gauge diffs Tensor.gate: addtransposedoptionTensorNetwork.contract: addstrip_exponentoption for return the mantissa and exponent (log10) separately. Compatible withcontract_tags,contract_cumulative,contract_compressedsub modes.tensor_split: addmatrix_svalsoption, ifTrueany returned singular values are put into the diagonal of a matrix (by default,False, they are returned as a vector).- add
Tensor.new_ind_pair_diagfor expanding an existing index into a pair of new indices, such that the diagonal of the new tensor on those indices is the old tensor. TNOptimizer: add 'cautious' ADAMTensorNetwork.pop_tensor: allowtidor tags to be specified.- add an example notebook for converting hyper tensor networks to normal tensor networks, for approximate contraction - https://quimb.readthedocs.io/en/latest/examples/ex_htn_to_tn_2d.html#example-htn-to-2d
- Add SX and SXDG gates by @kevinsung in #277
- Add XXPLUSYY and XXMINUSYY gates by @kevinsung in #279
- Added progbar to qsim, and openqasm2 by @edenian in #288
quimb.experimental.operatorbuilder: fix MPO building for congested operators (#296 and #301), allow arbitrary dtype (#289). Fix building of sparse and matrix representations for non-translationally symmetric operators and operators with trivial (all identity) terms.
Bug fixes:
- fix
MatrixProductState.measureforcupybackend arrays (#276). - fix
linalg.expmdispatch (#275) - fix 'dm' 1d compress method for disconnected subgraphs
- fix docs source lookup in
quimb.tensormodule - fix raw gate copying in
Circuit(#285)
New Contributors
Full Changelog: v1.10.0...v1.11.0
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_distanceand fitting: support hyper indices explicitly viaoutput_indskwarg - add
tn.make_overlapandtn.overlapfor computing the overlap between two tensor networks,$\langle O |T \rangle$ , with explicit handling of outer indices to address hyper networks. Addoutput_indstotn.normandtn.make_normalso, as well as thesquaredkwarg. - replace all
numbabased paralellism (prangeand parallel vectorize) with explicit thread pool based parallelism. Should be more reliable and no need to setNUMBA_NUM_THREADSanymore. Remove env varQUIMB_NUMBA_PAR. -
Circuit: adddtypeandconvert_eageroptions.dtypespecifies what the computation should be performed in.convert_eagerspecifies whether to apply this (and anyto_backendcalls) 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.jaxtracing, it is optional. -
schematic.Drawing: addshortenkwarg to line drawing and curve drawing and examples to the docs. -
TensorNetwork: add.backendand.dtype_nameproperties.
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_traceandMatrixProductState.ptrto MatrixProductState.partial_trace_to_mpo to avoid confusion with otherpartial_tracemethods that usually produce a dense matrix.
Enhancements:
- add
Circuit.sample_gate_by_gateand related methodsCircuitMPS.reordered_gates_dfs_clusteredandCircuitMPS.get_qubit_distancesfor sampling a circuit using the 'gate by gate' method introduced in https://arxiv.org/abs/2112.08499. - add
Circuit.drawfor drawing a very simple circuit schematic. -
Circuit: by default turn onsimplify_equalize_normsand use agroup_size=10for sampling. This should result in faster and more stable sampling. -
Circuit: usenumpy.random.default_rngfor random number generation. - add
qtn.circ_a2a_randfor generating random all-to-all circuits. - expose
qtn.edge_coloringas top level function and allow layers to be returned grouped. - add docstring for
tn.contract_compressedand by default pick up important settings from the supplied contraction path optimizer (max_bondandcompress_late) - add
Tensor.rand_reducefor randomly removing a tensor index by contracting a random vector into it. One can also supply the value"r"toiselselectors to use this. - add
fit-zipupandfit-projectorshorthand methods to the general 1d tensor network compression function - add
MatrixProductState.compute_local_expectationfor 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_expectationto make use of the MPS form. - add
PEPS.product_statefor constructing a PEPS representing a product state. - add
PEPS.vacuumfor constructing a PEPS representing the vacuum state$|000\ldots0\rangle$ . - add
PEPS.zerosfor constructing a PEPS whose entries are all zero. -
tn.gauge_all_simple: improve scheduling and adddampingandtouched_tidsoptions. -
qtn.SimpleUpdateGen: add gauge difference update checking andtolandequilibratesettings. Update.plot()method. Default to a smallcutoff. - add
psi.sample_configuration_clusterfor 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_configurationandMatrixProductState.sample(generating multiple samples) and use these forCircuitMPS.sampleandCircuitPermMPS.sample. - add basic plot method for [
SimpleUpdate] classes - add
edges_1d_chainfor generating 1D chain edges - operatorbuilder: better coefficient placement for long range / non-local MPO building
Full Changelog: v1.8.2...v1.8.3