A python library for quantum information and many-body calculations including tensor networks.
OTHER License
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.CircuitPermMPS
, more docs here: https://quimb.readthedocs.io/en/latest/tensor-circuit-mps.html
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)MatrixProductState.gate_with_mpo
for applying an MPO to an MPS, and immediately compressing back to MPS form using tensor_network_1d_compress
MatrixProductState.gate_with_submpo
for applying an MPO acting only of a subset of sites to an MPSMatrixProductOperator.from_dense
for constructing MPOs from dense matrices, including an only subset of sitesMatrixProductOperator.fill_empty_sites
for 'completing' an MPO which only has tensors on a subset of sites with (by default) identitiesMatrixProductState
and MatrixProductOperator
, now support the sites
kwarg in common constructors, enabling the TN to act on a subset of the full L
sites.TensorNetwork.drape_bond_between
for 'draping' an existing bond between two tensors through a thirdTensor.new_ind_pair_with_identity
TN_classical_partition_function_from_edges
) now all support outputs=
kwarg specifying non-marginalized variablesD1BP
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 of tensor_network_1d_compress
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].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].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].Circuit.apply_gate_raw
: fix kwarg bug (https://github.com/jcmgray/quimb/pull/226) by @juliendrapeauopt_einsum.PathInfo
for single scalar contraction (https://github.com/jcmgray/quimb/issues/231).Full Changelog: https://github.com/jcmgray/quimb/compare/v1.8.0...v1.8.1
Published by jcmgray 7 months ago
Breaking Changes
TensorNetwork.compress_all
now defaults to using some local gaugingEnhancements:
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:
tensor_network_1d_compress_direct
tensor_network_1d_compress_dm
tensor_network_1d_compress_zipup
tensor_network_1d_compress_zipup_first
tensor_network_1d_compress_fit
And can be accessed via the unified function tensor_network_1d_compress
. Boundary contraction in 2D can now utilize any of these methods.
add quimb.tensor.tensor_arbgeom_compress.py
with functions for compressing arbitrary geometry tensor networks using various methods. The methods are:
tensor_network_ag_compress_local_early
tensor_network_ag_compress_local_late
tensor_network_ag_compress_projector
tensor_network_ag_compress_superorthogonal
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.
support PBC in tn2d.contract_hotrg
, tn2d.contract_ctmrg
, tn3d.contract_hotrg
and the new function tn3d.contract_ctmrg
.
support PBC in gen_2d_bonds
and gen_3d_bonds
, with cyclic
kwarg.
support PBC in TN2D_rand_hidden_loop
and TN3D_rand_hidden_loop
, with cyclic
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:
Full Changelog: https://github.com/jcmgray/quimb/compare/v1.7.3...v1.8.0
Published by jcmgray 9 months ago
Enhancements:
dist="rademacher"
.dist
and other randn
options in various TN builders.Bug fixes:
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
Published by jcmgray 9 months ago
Bug fixes:
numba.generated_jit
decorator.Enhancements:
normalized=True
option to 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
and TensorNetwork.distance_normalized
added as aliases.TensorNetwork.cut_bond
for cutting a bond indexFull Changelog: https://github.com/jcmgray/quimb/compare/v1.7.1...v1.7.2
Published by jcmgray 9 months ago
Enhancements:
TensorNetwork.visualize_tensors
for visualizing the actual data entries of an entire tensor network.ham.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
, and building up gates from empty tensor networks using TensorNetwork.gate_inds_with_tn
.Tensor.expand_ind
and Tensor.new_ind
: repeat tiling mode and random padding mode.eigh_truncated
backend agnostic.tensor_compress_bond
: add reduced="left"
and reduced="right"
modes for when the pair of tensors is already in a canonical form.qtn.TN2D_embedded_classical_ising_partition_function
for constructing 2D (triangular) tensor networks representing all-to-all classical ising partition functions.Bug fixes:
kruas_op
when operator spanned multiple subsystems (#214)qr_stabilized
when the diagonal of R
has significant imaginary parts.Full Changelog: https://github.com/jcmgray/quimb/compare/v1.7.0...v1.7.1
Published by jcmgray 11 months ago
Breaking Changes
Circuit
: remove target_size
in preparation for all contraction specifications to be encapsulated at the contract level (e.g. with cotengra
)Enhancements:
Multi tag drawing support:
quimb.schematic
for main backend="matplotlib"
drawing. Enabling:
schematic
. Add methods text_between
, wedge
, line_offset
and other tweaks for future use by main TN drawing.cotengra
as the backendCircuit
: allow any gate to be controlled by any number of qubits.Circuit
: support for parsing openqasm2
specifications now with custom and nested gate definitions etc.is_cyclic_x
, is_cyclic_y
) and is_cyclic_z
to TensorNetwork2D and TensorNetwork3D.quimb.experimental.belief_propagation
: add various 1-norm/2-norm dense/lazy BP algorithms.Bug fixes:
Full Changelog: https://github.com/jcmgray/quimb/compare/v1.6.0...v1.7.0
Published by jcmgray about 1 year ago
Breaking Changes
Enhancements:
Circuit.from_openqasm2_file
Circuit
: add RXX, RYY, CRX, CRY, CRZ, toffoli, fredkin, givens gatesTensor.sum_reduce
and :meth:Tensor.vector_reduce
contract_compressed
, default to 'virtual-tree' gaugeTN_rand_tree
experimental.operatorbuilder
: fix parallel and heisenberg builderBug fixes:
Full Changelog: https://github.com/jcmgray/quimb/compare/v1.5.1...v1.6.0
Published by jcmgray about 1 year ago
Tensor.check()
and TensorNetwork.check()
for diagnosticsTensorNetwork.isconnected()
, TensorNetwork.istree()
Full Changelog: https://github.com/jcmgray/quimb/compare/v1.5.0...v1.5.1
Published by jcmgray over 1 year ago
Enhancements
quimb.tensor.decomp.isometrize
.~quimb.tensor.tensor_core.TensorNetwork.compute_reduced_factor
~quimb.tensor.tensor_core.TensorNetwork.insert_compressor_between_regions
mode="projector"
option for 2D tensor network contractions~quimb.tensor.tensor_2d.TensorNetwork2D.coarse_grain_hotrg
,~quimb.tensor.tensor_2d.TensorNetwork2D.contract_hotrg
,~quimb.tensor.tensor_3d.TensorNetwork3D.coarse_grain_hotrg
, and~quimb.tensor.tensor_3d.TensorNetwork3D.contract_hotrg
,~quimb.tensor.tensor_2d.TensorNetwork2D.contract_ctmrg
~quimb.tensor.tensor_builder.TN2D_corner_double_line
furo <https://pradyunsg.me/furo/>
_ theme,myst_nb <https://myst-nb.readthedocs.io/en/latest/>
_ for notebooks, andsphinx
extensions.'adabelief'
optimizer to~quimb.tensor.optimize.TNOptimizer
as well as a quick plotter:~quimb.tensor.optimize.TNOptimizer.plot
TensorNetwork.draw(dim=3, backend='matplotlib3d')
orTensorNetwork.draw(dim=3, backend='plotly')
backend='plotly'
can also be used for 2D interactive plots.~quimb.tensor.tensor_builder.HTN_from_cnf
to handle more~quimb.tensor.tensor_builder.cnf_file_parse
~quimb.tensor.tensor_builder.random_ksat_instance
~quimb.tensor.tensor_builder.TN_from_strings
~quimb.tensor.tensor_builder.convert_to_2d
~quimb.tensor.tensor_builder.TN2D_rand_hidden_loop
~quimb.tensor.tensor_builder.convert_to_3d
~quimb.tensor.tensor_builder.TN3D_corner_double_line
~quimb.tensor.tensor_builder.TN3D_rand_hidden_loop
'lu'
, 'polar_left'
and 'polar_right'
methods to~quimb.tensor.tensor_core.tensor_split
.~quimb.tensor.tensor_core.TensorNetwork
: allow empty constructor~quimb.tensor.tensor_core.TensorNetwork.drop_tags
: allow all tags to~quimb.tensor.tensor_core.TensorNetwork.combine
for unifiedquimb.experimental.cluster_update.py
Bug fixes:
~quimb.tensor.decomp.qr_stabilized
bug for strictly upperFull Changelog: https://github.com/jcmgray/quimb/compare/1.4.2...v1.5.0
Published by jcmgray almost 2 years ago
Add automatic building and publishing of quimb
to pypi
.
Published by jcmgray almost 2 years ago
Enhancements
quimb.tensor.tensor_arbgeom.TensorNetworkGen
~quimb.tensor.tensor_core.Tensor.visualize
for visualizing the~quimb.tensor.circuit.Gate
class for more robust tracking and~quimb.tensor.circuit.Circuit
~quimb.tensor.tensor_core.TensorNetwork.compute_hierarchical_grouping
~quimb.tensor.tensor_core.Tensor.as_network
~quimb.tensor.tensor_core.TensorNetwork.inds_size
~quimb.tensor.tensor_core.TensorNetwork.get_hyperinds
~quimb.tensor.tensor_core.TensorNetwork.outer_size
~quimb.tensor.tensor_core.TensorNetwork.group_inds
TNOptimizer
, e.g. for constantsexperimental
submodule for new sharing featuresjax
pytree interface150
)Bug fixes:
weight_attr
bug (:issue:126
)PTensor
objects (:issue:128
, :pull:131
)Published by jcmgray over 2 years ago
Enhancements
TNOptimizer
Circuit
simulation~quimb.tensor.tensor_core.tensor_network_sum
,~quimb.tensor.tensor_core.tensor_network_distance
and~quimb.tensor.tensor_core.TensorNetwork.fit
Enhancements
~quimb.evo.Evolution
when integrating a pure state - see :ref:time-dependent-evolution
- as well as supporting LinearOperator
defined hamiltonians (:pull:40
).~quimb.evo.Evolution
callback compute=
to optionally access the Hamiltonian (:pull:49
).quimb.tensor.tensor_core.Tensor.randomize
and :meth:quimb.tensor.tensor_core.TensorNetwork.randomize
to randomize tensor and tensor network entries.~quimb.tensor.tensor_1d.TensorNetwork1DFlat.compress_site
for compressing around single sites of MPS etc.~quimb.tensor.tensor_gen.MPS_ghz_state
and :func:~quimb.tensor.tensor_gen.MPS_w_state
for building bond dimension 2 open boundary MPS reprentations of those states.autoray <https://github.com/jcmgray/autoray>
_ to improve the agnostic-ness of tensor network operations with respect to the backend array type.~quimb.tensor.tensor_core.new_bond
on top of :meth:quimb.tensor.tensor_core.Tensor.new_ind
and :meth:quimb.tensor.tensor_core.Tensor.expand_ind
for more graph orientated construction of tensor networks, see :ref:tn-creation-graph-style
.~quimb.gen.operators.fsim
gate.numpy 1.17+
functionality rather than randomgen
(which can still be used as the underlying bit generator) (:pull:50
)contraction_complexity
to :meth:~quimb.tensor.tensor_core.TensorNetwork.contraction_width
.quimb.tensor.tensor_core.TensorNetwork.rank_simplify
, to handle hyper-edges.quimb.tensor.tensor_core.TensorNetwork.diagonal_reduce
, to automatically collapse all diagonal tensor axes in a tensor network, introducing hyper edges.quimb.tensor.tensor_core.TensorNetwork.antidiag_gauge
, to automatically flip all anti-diagonal tensor axes in a tensor network allowing subsequent diagonal reduction.quimb.tensor.tensor_core.TensorNetwork.column_reduce
, to automatically identify tensor axes with a single non-zero column, allowing the corresponding index to be cut.quimb.tensor.tensor_core.TensorNetwork.full_simplify
, to iteratively perform all the above simplifications in a specfied order until nothing is left to be done.num_tensors
and num_indices
attributes, show num_indices
in __repr__
.34
)~quimb.tensor.circuit_gen.circ_ansatz_1D_zigzag
,~quimb.tensor.circuit_gen.circ_ansatz_1D_brickwork
, and~quimb.tensor.circuit_gen.circ_ansatz_1D_rand
.~quimb.tensor.tensor_core.PTensor
and so trainable, TN based quantum circuits -- see :ref:example-tn-training-circuits
.Bug fixes:
~quimb.calc.fidelity
by making the unsquared version the default for the case when either state is pure, and always return a real number.j != 1.0
QUIMB_NUMBA_PAR
to set whether numba should use automatic parallelization - mainly to fix travis segfaults.petsc4py
and slepc4py
more robust.Published by jcmgray over 5 years ago
Enhancements
Added kraus_op
for general, noisy quantum operations
Added projector
for constructing projectors from observables
Added measure
for measuring and collapsing quantum states
Added cprint
pretty printing states in computational basis
Added simulate_counts
for simulating computational basis counts
TN: Add TensorNetwork.rank_simplify
TN: Add TensorNetwork.isel
TN: Add TensorNetwork.cut_iter
TN: Add 'split-gate'
gate mode
TN: Add optimize_tensorflow.TNOptimizer
for tensorflow based optimization
of arbitrary, contstrained tensor networks.
TN: Add Dense1D.rand
TN: Add tensor_core.connect
to conveniently set a shared index for tensors
TN: make many more tensor operations agnostic of the array backend (e.g. numpy, cupy,
tensorflow, ...)
TN: allow tensor_1d.align_TN_1D
to take an MPO as the first argument
TN: add SpinHam.build_sparse
TN: add Tensor.unitize
and TensorNetwork.unitize
to impose unitary/isometric constraints on tensors specified using the left_inds
kwarg
Many updates to tensor network quantum circuit simulation including:
CircuitMPS
CircuitDense
Add from quimb.gates import *
as shortcut to import X, Z, CNOT, ...
.
Add U_gate
for parametrized arbitrary single qubit unitary
Bug fixes:
pkron
for case len(dims) == len(inds)
(#17, #18).qarray
printing for older numpy
versionsnorm(X, 'trace')
for non-hermitian matricesautoray
as dependency (#21)