2.1. tnpy.operators.MatrixProductOperator#

class tnpy.operators.MatrixProductOperator(*args, **kwargs)[source]#

Bases: quimb.tensor.tensor_1d.MatrixProductOperator

__init__(*args, **kwargs)[source]#

Methods

__init__(*args, **kwargs)

add(t[, virtual, check_collisions])

Add Tensor, TensorNetwork or sequence thereof to self.

add_MPO(other[, inplace])

add_MPO_(other, *[, inplace])

add_tag(tag[, where, which])

Add tag to every tensor in this network, or if where is specified, the tensors matching those tags -- i.e. adds the tag to all tensors in self.select_tensors(where, which=which).

add_tensor(tensor[, tid, virtual])

Add a single tensor to this network - mangle its tid if neccessary.

add_tensor_network(tn[, virtual, ...])

align(*[, ind_ids, trace, inplace])

Align an arbitrary number of tensor networks in a stack-like geometry.

align_(*[, ind_ids, trace, inplace])

all_inds()

Return a tuple of all indices in this network.

amplitude(b)

Compute the amplitude of configuration b.

antidiag_gauge([output_inds, atol, cache, ...])

Flip the order of any bonds connected to antidiagonal tensors.

antidiag_gauge_([output_inds, atol, cache, ...])

apply(other[, compress])

Act with this MPO on another MPO or MPS, such that the resulting object has the same tensor network structure/indices as other.

apply_to_arrays(fn)

Modify every tensor's array inplace by applying fn to it.

as_cyclic([inplace])

Convert this flat, 1D, TN into cyclic form by adding a dummy bond between the first and last sites.

as_network([virtual])

Matching method (for ensuring object is a tensor network) to as_network(), which simply returns self if virtual=True.

aslinearoperator(left_inds, right_inds[, ...])

View this TensorNetwork as a TNLinearOperator.

astype(dtype[, inplace])

Convert the type of all tensors in this network to dtype.

astype_(dtype, *[, inplace])

balance_bonds([inplace])

Apply tensor_balance_bond() to all bonds in this tensor network.

balance_bonds_(*[, inplace])

bond(i, j)

Get the name of the index defining the bond between sites i and j.

bond_size(i, j)

Return the size of the bond between site i and j.

bond_sizes()

calc_current_orthog_center()

Calculate the site(s) of the current orthogonality center.

canonicalize(where[, cur_orthog, info, bra, ...])

Gauge this MPS into mixed canonical form, implying.

canonicalize_(where[, cur_orthog, info, ...])

canonize(where[, cur_orthog, info, bra, inplace])

canonize_around(tags[, which, min_distance, ...])

Expand a locally canonical region around tags.

canonize_around_(tags[, which, ...])

canonize_between(tags1, tags2[, absorb])

'Canonize' the bond between the two single tensors in this network specified by tags1 and tags2 using tensor_canonize_bond.

canonize_cyclic(i[, bra, method, inv_tol])

Bring this MatrixProductState into (possibly only approximate) canonical form at site(s) i.

check()

Check some basic diagnostics of the tensor network.

column_reduce([output_inds, atol, cache, ...])

Find bonds on this tensor network which have tensors where all but one column (of the respective index) is non-zero, allowing the 'cutting' of that bond.

column_reduce_([output_inds, atol, cache, ...])

combine(other, *[, virtual, check_collisions])

Combine this tensor network with another, returning a new tensor network.

compress([form])

Compress this 1D Tensor Network, possibly into canonical form.

compress_all([max_bond, cutoff, canonize, ...])

Compress all bonds one by one in this network.

compress_all_([max_bond, cutoff, canonize, ...])

compress_all_1d([max_bond, cutoff, ...])

Compress a tensor network that you know has a 1D topology, this proceeds by generating a spanning 'tree' from around the least central tensor, then optionally canonicalizing all bonds outwards and compressing inwards.

compress_all_1d_([max_bond, cutoff, ...])

compress_all_simple([max_bond, cutoff, ...])

compress_all_simple_([max_bond, cutoff, ...])

compress_all_tree([inplace])

Canonically compress this tensor network, assuming it to be a tree.

compress_all_tree_(*[, inplace])

compress_between(tags1, tags2[, max_bond, ...])

Compress the bond between the two single tensors in this network specified by tags1 and tags2 using tensor_compress_bond().

compress_simplify([output_inds, atol, ...])

compress_simplify_([output_inds, atol, ...])

compress_site(i[, canonize, info, bra])

Compress the bonds adjacent to site i, by default first setting the orthogonality center to that site.

compute_centralities()

compute_contracted_inds(*tids[, output_inds])

Get the indices describing the tensor contraction of tensors corresponding to tids.

compute_hierarchical_grouping(max_group_size)

Group tids (by default, all tensors) into groups of size max_group_size or less, using a hierarchical clustering.

compute_hierarchical_linkage([tids, method, ...])

compute_hierarchical_ordering([tids, ...])

compute_hierarchical_ssa_path([tids, ...])

Compute a hierarchical grouping of tids, as a ssa_path.

compute_reduced_factor(side, left_inds, ...)

Compute either the left or right 'reduced factor' of this tensor network.

compute_shortest_distances([tids, exclude_inds])

Compute the minimum graph distances between all or some nodes tids.

conj([mangle_inner, inplace])

Conjugate all the tensors in this network (leaves all indices).

conj_([mangle_inner, inplace])

contract([tags, output_inds, optimize, get, ...])

Contract some, or all, of the tensors in this network.

contract_([tags, output_inds, optimize, ...])

contract_around(tags[, which, min_distance, ...])

Perform a compressed contraction inwards towards the tensors identified by tags.

contract_around_(tags[, which, ...])

contract_around_center(**opts)

contract_around_corner(**opts)

contract_between(tags1, tags2, **contract_opts)

Contract the two tensors specified by tags1 and tags2 respectively.

contract_compressed(optimize[, output_inds, ...])

contract_compressed_(optimize[, ...])

contract_cumulative(tags_seq[, output_inds, ...])

Cumulative contraction of tensor network.

contract_ind(ind[, output_inds])

Contract tensors connected by ind.

contract_structured(tag_slice[, ...])

Perform a structured contraction, translating tag_slice from a slice or ... to a cumulative sequence of tags.

contract_tags(tags[, which, output_inds, ...])

Contract the tensors that match any or all of tags.

contract_tags_(tags[, which, output_inds, ...])

contraction_cost([optimize])

Compute the 'contraction cost' of this tensor network.

contraction_info([optimize])

Compute the opt_einsum.PathInfo object decsribing the contraction of this entire tensor network using path optimizer optimize.

contraction_path([optimize])

Compute the contraction path, a sequence of (int, int), for the contraction of this entire tensor network using path optimizer optimize.

contraction_tree([optimize, output_inds])

Return the cotengra.ContractionTree corresponding to contracting this entire tensor network with path finder optimize.

contraction_width([optimize])

Compute the 'contraction width' of this tensor network.

convert_to_zero()

Inplace conversion of this network to an all zero tensor network.

copy([virtual, deep])

Copy this TensorNetwork.

count_canonized()

cut_between(left_tags, right_tags, left_ind, ...)

Cut the bond between the tensors specified by left_tags and right_tags, giving them the new inds left_ind and right_ind respectively.

cut_bond(bond[, new_left_ind, new_right_ind])

Cut the bond index specified by bond between the tensors it connects.

cut_iter(*inds)

Cut and iterate over one or more indices in this tensor network.

delete(tags[, which])

Delete any tensors which match all or any of tags.

diagonal_reduce([output_inds, atol, cache, ...])

Find tensors with diagonal structure and collapse those axes.

diagonal_reduce_([output_inds, atol, cache, ...])

distance(tnB[, xAA, xAB, xBB, method, ...])

Compute the Frobenius norm distance between two tensor networks:

distance_normalized(tnB[, xAA, xAB, xBB, ...])

distribute_exponent()

Distribute the exponent p of this tensor network (i.e.

dot(other[, compress])

Act with this MPO on another MPO or MPS, such that the resulting object has the same tensor network structure/indices as other.

drape_bond_between(tagsa, tagsb, tags_target)

Take the bond(s) connecting the tensors tagged at tagsa and tagsb, and 'drape' it through the tensor tagged at tags_target, effectively adding an identity tensor between the two and contracting it with the third.

drape_bond_between_(tagsa, tagsb, tags_target)

draw([color, show_inds, show_tags, ...])

Plot this tensor network as a networkx graph using matplotlib, with edge width corresponding to bond dimension.

draw_3d([color, show_inds, show_tags, ...])

draw_3d_interactive([color, show_inds, ...])

draw_interactive([color, show_inds, ...])

draw_tree_span(tags[, which, min_distance, ...])

Visualize a generated tree span out of the tensors tagged by tags.

drop_tags([tags])

Remove a tag or tags from this tensor network, defaulting to all.

equalize_norms([value, inplace])

Make the Frobenius norm of every tensor in this TN equal without changing the overall value if value=None, or set the norm of every tensor to value by scalar multiplication only.

equalize_norms_([value, inplace])

expand_bond_dimension(new_bond_dim[, ...])

Expand the bond dimensions of this 1D tensor network to at least new_bond_dim.

expand_bond_dimension_(new_bond_dim[, mode, ...])

fill_empty_sites([mode, phys_dim, ...])

Fill any empty sites of this MPO with identity tensors, adding size 1 bonds or draping existing bonds where necessary such that the resulting tensor has nearest neighbor bonds only.

fill_empty_sites_([mode, phys_dim, ...])

filter_valid_site_tags(tags)

Get the valid site tags from tags.

fit(tn_target[, method, tol, inplace, progbar])

Optimize the entries of this tensor network with respect to a least squares fit of tn_target which should have the same outer indices.

fit_(tn_target[, method, tol, inplace, progbar])

flip(inds[, inplace])

Flip the dimension corresponding to indices inds on all tensors that share it.

flip_(inds, *[, inplace])

from_TN(tn[, like, inplace])

Construct a specific tensor network subclass (i.e.

from_dense(A[, dims, sites, L, tags, ...])

Build an MPO from a raw dense matrix.

from_fill_fn(fill_fn, L, bond_dim[, ...])

Create an MPO by supplying a 'filling' function to generate the data for each site.

full_simplify([seq, output_inds, atol, ...])

Perform a series of tensor network 'simplifications' in a loop until there is no more reduction in the number of tensors or indices.

full_simplify_([seq, output_inds, atol, ...])

fuse_multibonds([gauges, include, exclude, ...])

Fuse any multi-bonds (more than one index shared by the same pair of tensors) into a single bond.

fuse_multibonds_([gauges, include, exclude, ...])

gate_inds(G, inds[, contract, tags, info, ...])

Apply the 'gate' G to indices inds, propagating them to the outside, as if applying G @ x.

gate_inds_(G, inds[, contract, tags, info, ...])

gate_inds_with_tn(inds, gate, ...[, inplace])

Gate some indices of this tensor network with another tensor network. That is, rewire and then combine them such that the new tensor network has the same outer indices as before, but now includes gate::.

gate_inds_with_tn_(inds, gate, ...[, inplace])

gate_lower_with_op_lazy(A[, transpose, inplace])

Act lazily 'from the right' with the operator tensor network A, which should have matching structure, on this operator tensor network (B), like B @ A.

gate_lower_with_op_lazy_(A[, transpose, inplace])

gate_sandwich_with_op_lazy(A[, inplace])

Act lazily with the operator tensor network A, which should have matching structure, on this operator tensor network (B), like \(B \rightarrow A B A^\dagger\).

gate_sandwich_with_op_lazy_(A, *[, inplace])

gate_upper_with_op_lazy(A[, transpose, inplace])

Act lazily with the operator tensor network A, which should have matching structure, on this operator tensor network (B), like A @ B.

gate_upper_with_op_lazy_(A[, transpose, inplace])

gauge_all([method])

Gauge all bonds in this network using one of several strategies.

gauge_all_([method])

gauge_all_canonize([max_iterations, absorb, ...])

Iterative gauge all the bonds in this tensor network with a basic 'canonization' strategy.

gauge_all_canonize_([max_iterations, ...])

gauge_all_random([max_iterations, unitary, ...])

Gauge all the bonds in this network randomly.

gauge_all_random_([max_iterations, unitary, ...])

gauge_all_simple([max_iterations, tol, ...])

Iterative gauge all the bonds in this tensor network with a 'simple update' like strategy.

gauge_all_simple_([max_iterations, tol, ...])

gauge_local(tags[, which, max_distance, ...])

Iteratively gauge all bonds in the tagged sub tensor network according to one of several strategies.

gauge_local_(tags[, which, max_distance, ...])

gauge_simple_insert(gauges[, remove, ...])

Insert the simple update style bond gauges found in gauges if they are present in this tensor network.

gauge_simple_remove([outer, inner])

Remove the simple update style bond gauges inserted by gauge_simple_insert.

gauge_simple_temp(gauges[, smudge, ...])

Context manager that temporarily inserts simple update style bond gauges into this tensor network, before optionally ungauging them.

gen_inds_connected(max_length)

Generate all index 'patches' of size up to max_length.

gen_inds_loops([max_loop_length])

Generate all sequences of indices, up to a specified length, that represent loops in this tensor network.

gen_loops([max_loop_length])

Generate sequences of tids that represent loops in the TN.

gen_site_coos()

Generate the coordinates of all possible sites.

gen_sites_present()

Generate the sites which are currently present (e.g.

gen_tags_from_coos(coos)

Generate the site tags corresponding to the given coordinates.

geometry_hash([output_inds, strict_index_order])

A hash of this tensor network's shapes & geometry.

get_equation([output_inds])

Get the 'equation' describing this tensor network, in einsum style with a single unicode letter per index.

get_hyperinds([output_inds])

Get a tuple of all 'hyperinds', defined as those indices which don't appear exactly twice on either the tensors or in the 'outer' (i.e.

get_inputs_output_size_dict([output_inds])

Get a tuple of inputs, output and size_dict suitable for e.g.

get_multibonds([include, exclude])

Get a dict of 'multibonds' in this tensor network, i.e. groups of two or more indices that appear on exactly the same tensors and thus could be fused, for example.

get_params()

Get a pytree of the 'parameters', i.e. all underlying data arrays.

get_symbol_map()

Get the mapping of the current indices to einsum style single unicode characters.

get_tree_span(tids[, min_distance, ...])

Generate a tree on the tensor network graph, fanning out from the tensors identified by tids, up to a maximum of max_distance away.

graph([color, show_inds, show_tags, ...])

Plot this tensor network as a networkx graph using matplotlib, with edge width corresponding to bond dimension.

graph_tree_span(tags[, which, min_distance, ...])

Visualize a generated tree span out of the tensors tagged by tags.

hyperinds_resolve([mode, sorter, ...])

Convert this into a regular tensor network, where all indices appear at most twice, by inserting COPY tensor or tensor networks for each hyper index.

hyperinds_resolve_([mode, sorter, ...])

identity(**mpo_opts)

Get a identity matching this MPO.

ind_size(ind)

Find the size of ind.

ind_sizes()

Get dict of each index mapped to its size.

inds_size(inds)

Return the total size of dimensions corresponding to inds.

inner_inds()

Tuple of interior indices, assumed to be any indices that appear twice or more (this only holds generally for non-hyper tensor networks).

insert_compressor_between_regions(ltags, rtags)

Compute and insert a pair of 'oblique' projection tensors (see for example https://arxiv.org/abs/1905.02351) that effectively compresses between two regions of the tensor network.

insert_compressor_between_regions_(ltags, rtags)

insert_gauge(U, where1, where2[, Uinv, tol])

Insert the gauge transformation U^-1 @ U into the bond between the tensors, T1 and T2, defined by where1 and where2.

insert_operator(A, where1, where2[, tags, ...])

Insert an operator on the bond between the specified tensors, e.g..

insert_operator_(A, where1, where2[, tags, ...])

iscomplex()

isconnected()

Check whether this tensor network is connected, i.e. whether there is a path between any two tensors, (including size 1 indices).

isel(selectors[, inplace])

Select specific values for some dimensions/indices of this tensor network, thereby removing them.

isel_(selectors, *[, inplace])

isometrize([method, allow_no_left_inds, inplace])

Project every tensor in this network into an isometric form, assuming they have left_inds marked.

isometrize_([method, allow_no_left_inds, ...])

istree()

Check if this tensor network has a tree structure, (treating multibonds as a single edge).

item()

Return the scalar value of this tensor network, if it is a scalar.

largest_element()

Return the 'largest element', in terms of absolute magnitude, of this tensor network.

least_central_tid()

left_canonicalize([stop, start, normalize, ...])

Left canonicalize all or a portion of this TN (i.e. sweep the orthogonality center to the right). If this is a MPS, this implies that::.

left_canonicalize_([stop, start, normalize, ...])

left_canonize([stop, start, normalize, bra, ...])

left_canonize_site(i[, bra])

Left canonize this TN's ith site, inplace.

left_compress([start, stop, bra])

Compress this 1D TN, from left to right, such that it becomes left-canonical (unless absorb != 'right').

left_compress_site(i[, bra])

Left compress this 1D TN's ith site, such that the site is then left unitary with its right bond (possibly) reduced in dimension.

loop_simplify([output_inds, ...])

Try and simplify this tensor network by identifying loops and checking for low-rank decompositions across groupings of the loops outer indices.

loop_simplify_([output_inds, ...])

lower_ind(site)

Get the lower physical index name of site.

make_norm([mangle_append, layer_tags, ...])

Make the norm tensor network of this tensor network tn.H & tn.

make_tids_consecutive([tid0])

Reset the tids - node identifies - to be consecutive integers.

mangle_inner_([append, which])

Generate new index names for internal bonds, meaning that when this tensor network is combined with another, there should be no collisions.

max_bond()

Return the size of the largest bond in this network.

maybe_convert_coo(x)

Check if x is an integer and convert to the corresponding site tag if so.

most_central_tid()

multiply(x[, inplace, spread_over])

Scalar multiplication of this tensor network with x.

multiply_(x, *[, inplace, spread_over])

multiply_each(x[, inplace])

Scalar multiplication of each tensor in this tensor network with x.

multiply_each_(x, *[, inplace])

negate([inplace])

Negate this tensor network.

negate_(*[, inplace])

new([like])

Create a new tensor network, without any tensors, of type cls, with all the requisite properties specified by kwargs or inherited from like.

new_bond(tags1, tags2, **opts)

Inplace addition of a dummmy (size 1) bond between the single tensors specified by by tags1 and tags2.

norm(**contract_opts)

Frobenius norm of this tensor network.

outer_dims_inds()

Get the 'outer' pairs of dimension and indices, i.e. as if this tensor network was fully contracted.

outer_inds()

Tuple of exterior indices, assumed to be any lone indices (this only holds generally for non-hyper tensor networks).

outer_size()

Get the total size of the 'outer' indices, i.e. as if this tensor network was fully contracted.

pair_simplify([cutoff, output_inds, ...])

pair_simplify_([cutoff, output_inds, ...])

partial_transpose(sysa[, inplace])

Perform the partial transpose on this MPO by swapping the bra and ket indices on sites in sysa.

partition(tags[, which, inplace])

Split this TN into two, based on which tensors have any or all of tags.

partition_tensors(tags[, inplace, which])

Split this TN into a list of tensors containing any or all of tags and a TensorNetwork of the the rest.

permute_arrays([shape])

Permute the indices of each tensor in this MPO to match shape.

pop_tensor(tid)

Remove tensor with tid from this network, and return it.

rand_state(bond_dim, **mps_opts)

Get a random vector matching this MPO.

randomize([dtype, seed, inplace])

Randomize every tensor in this TN - see quimb.tensor.tensor_core.Tensor.randomize().

randomize_([dtype, seed, inplace])

rank_simplify([output_inds, equalize_norms, ...])

Simplify this tensor network by performing contractions that don't increase the rank of any tensors.

rank_simplify_([output_inds, ...])

reduce_inds_onto_bond(inda, indb[, tags, ...])

Use QR factorization to 'pull' the indices inda and indb off of their respective tensors and onto the bond between them.

reindex(index_map[, inplace])

Rename indices for all tensors in this network, optionally in-place.

reindex_(index_map, *[, inplace])

reindex_lower_sites(new_id[, where, inplace])

Update the lower site index labels to a new string specifier.

reindex_lower_sites_(new_id[, where, inplace])

reindex_upper_sites(new_id[, where, inplace])

Update the upper site index labels to a new string specifier.

reindex_upper_sites_(new_id[, where, inplace])

remove_all_tensors()

Remove all tensors from this network.

replace_section_with_svd(start, stop, eps, ...)

Take a 1D tensor network, and replace a section with a SVD.

replace_with_identity(where[, which, inplace])

Replace all tensors marked by where with an identity. E.g. if X denote where tensors::.

replace_with_svd(where, left_inds, eps, *[, ...])

Replace all tensors marked by where with an iteratively constructed SVD. E.g. if X denote where tensors::.

replace_with_svd_(where, left_inds, eps, *)

reset_cached_properties()

Reset any cached properties, one should call this when changing the actual geometry of a TN inplace, for example.

retag(tag_map[, inplace])

Rename tags for all tensors in this network, optionally in-place.

retag_(tag_map, *[, inplace])

retag_all(new_id[, inplace])

Retag all sites and change the site_tag_id.

retag_all_(new_id, *[, inplace])

retag_sites(new_id[, where, inplace])

Modify the site tags for all or some tensors in this tensor network (without changing the site_tag_id).

right_canonicalize([stop, start, normalize, ...])

Right canonicalize all or a portion of this TN (i.e.

right_canonicalize_([stop, start, ...])

right_canonize([stop, start, normalize, ...])

right_canonize_site(i[, bra])

Right canonize this TN's ith site, inplace.

right_compress([start, stop, bra])

Compress this 1D TN, from right to left, such that it becomes right-canonical (unless absorb != 'left').

right_compress_site(i[, bra])

Right compress this 1D TN's ith site, such that the site is then right unitary with its left bond (possibly) reduced in dimension.

select(tags[, which, virtual])

Get a TensorNetwork comprising tensors that match all or any of tags, inherit the network properties/structure from self.

select_all(tags, *[, which, virtual])

select_any(tags, *[, which, virtual])

select_local(tags[, which, max_distance, ...])

Select a local region of tensors, based on graph distance max_distance to any tagged tensors.

select_neighbors(tags[, which])

Select any neighbouring tensors to those specified by tags.self

select_tensors(tags[, which])

Return the sequence of tensors that match tags.

set_params(params)

Take a pytree of the 'parameters', i.e. all underlying data arrays, as returned by get_params and set them.

shift_orthogonality_center(current, new[, bra])

Move the orthogonality center of this MPS.

show([max_width])

singular_values(i[, info, method])

Find the singular values associated with the ith bond.

site_tag(i)

The name of the tag specifiying the tensor at site i.

slice2sites(tag_slice)

Take a slice object, and work out its implied start, stop and step, taking into account cyclic boundary conditions.

split(left_inds[, method, get, absorb, ...])

Decompose this tensor into two tensors.

split_simplify([atol, equalize_norms, ...])

Find tensors which have low rank SVD decompositions across any combination of bonds and perform them.

split_simplify_([atol, equalize_norms, ...])

split_tensor(tags, left_inds, **split_opts)

Split the single tensor uniquely identified by tags, adding the resulting tensors from the decomposition back into the network.

square()

Compute the square of MatrixProductOperator (MPO), which equivalently merges two MPO layers into one.

squeeze([fuse, include, exclude, inplace])

Drop singlet bonds and dimensions from this tensor network.

squeeze_([fuse, include, exclude, inplace])

strip_exponent(tid_or_tensor[, value])

Scale the elements of tensor corresponding to tid so that the norm of the array is some value, which defaults to 1.

subgraphs([virtual])

Split this tensor network into disconneceted subgraphs.

sum_reduce(ind[, inplace])

Sum over the index ind of this tensor network, removing it.

sum_reduce_(ind, *[, inplace])

tensors_sorted()

Return a tuple of tensors sorted by their respective tags, such that the tensors of two networks with the same tag structure can be iterated over pairwise.

tids_are_connected(tids)

Check whether nodes tids are connected.

to_dense(*inds_seq[, to_qarray])

Contract this tensor network 'operator' into a dense array.

to_qarray(*inds_seq[, to_qarray])

trace([left_inds, right_inds])

Take the trace of this MPO.

unitize([method, allow_no_left_inds, inplace])

Project every tensor in this network into an isometric form, assuming they have left_inds marked.

unitize_

Method descriptor with partial application of the given arguments and keywords.

upper_ind(site)

Get the upper physical index name of site.

vector_reduce(ind, v[, inplace])

Contract the vector v with the index ind of this tensor network, removing it.

vector_reduce_(ind, v, *[, inplace])

view_as(cls[, inplace])

View this tensor network as subclass cls.

view_as_(cls, *[, inplace])

view_like(like[, inplace])

View this tensor network as the same subclass cls as like inheriting its extra properties as well.

view_like_(like, *[, inplace])

visualize_tensors([mode, r, r_scale, figsize])

Visualize all the entries of every tensor in this network.

Attributes

H

Conjugate all the tensors in this network (leaves all indices).

L

The number of sites, i.e. length.

arrays

Get the tuple of raw arrays containing all the tensor network data.

dtype

The dtype of this TensorNetwork, this is the minimal common type of all the tensors data.

lower_ind_id

The string specifier for the lower phyiscal indices.

lower_inds

Return a tuple of all lower indices.

lower_inds_present

Return a tuple of all lower indices still present in the tensor network.

n_sites

nsites

The number of sites.

num_indices

The total number of indices in the tensor network.

num_tensors

The total number of tensors in the tensor network.

phys_dim

Get the physical dimension of site.

shape

Actual, i.e. exterior, shape of this TensorNetwork.

site_tag_id

The string specifier for tagging each site of this tensor network.

site_tags

All of the site tags.

site_tags_present

All of the site tags still present in this tensor network.

sites

Tuple of the possible sites in this tensor network.

tags

tensors

Get the tuple of tensors in this tensor network.

upper_ind_id

The string specifier for the upper phyiscal indices.

upper_inds

Return a tuple of all upper indices.

upper_inds_present

Return a tuple of all upper indices still present in the tensor network.

__init__(*args, **kwargs)[source]#
property n_sites: int#
property phys_dim: int#

Get the physical dimension of site.

square()[source]#

Compute the square of MatrixProductOperator (MPO), which equivalently merges two MPO layers into one.

Return type

squared_mpo