4.1. tnpy.tsdrg.Node#

class tnpy.tsdrg.Node(node_id, left=None, right=None, *args, **kwargs)[source]#

Bases: quimb.tensor.tensor_core.Tensor

The node of binary tree, while data structure is inherited from quimb.Tensor.

Parameters
  • node_id (int) – An integer ID of this node.

  • left (Node) – The left child node. Default None.

  • right (Node) – The right child node. Default None.

  • *args – Arguments to initialize quimb.Tensor.

  • **kwargs – Keywords to initialize quimb.Tensor.

__init__(node_id, left=None, right=None, *args, **kwargs)[source]#

The node of binary tree, while data structure is inherited from quimb.Tensor.

Parameters
  • node_id (int) – An integer ID of this node.

  • left (Optional[tnpy.tsdrg.Node]) – The left child node. Default None.

  • right (Optional[tnpy.tsdrg.Node]) – The right child node. Default None.

  • *args – Arguments to initialize quimb.Tensor.

  • **kwargs – Keywords to initialize quimb.Tensor.

Methods

__init__(node_id[, left, right])

The node of binary tree, while data structure is inherited from quimb.Tensor.

add_owner(tn, tid)

Add tn as owner of this Tensor - it's tag and ind maps will be updated whenever this tensor is retagged or reindexed.

add_tag(tag)

Add a tag to this tensor.

almost_equals(other, **kwargs)

Check if this tensor is almost the same as another.

astype(dtype[, inplace])

Change the type of this tensor to dtype.

astype_(dtype, *[, inplace])

bonds(other)

Return a tuple of the shared indices between this tensor and other.

check_owners()

Check if this tensor is 'owned' by any alive TensorNetworks.

collapse_repeated([inplace])

Take the diagonals of any repeated indices, such that each index only appears once.

collapse_repeated_(*[, inplace])

conj([inplace])

Conjugate this tensors data (does nothing to indices).

conj_(*[, inplace])

contract(*[, output_inds, get, backend, ...])

Efficiently contract multiple tensors, combining their tags.

copy([deep, virtual])

Copy this tensor.

direct_product(T2[, sum_inds, inplace])

Direct product of two Tensors.

direct_product_(T2[, sum_inds, inplace])

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

Compute the Frobenius norm distance between two tensor networks:

draw(*args, **kwargs)

Plot a graph of this tensor and its indices.

drop_tags([tags])

Drop certain tags, defaulting to all, from this tensor.

entropy(left_inds[, method])

Return the entropy associated with splitting this tensor according to left_inds.

expand_ind(ind, size)

Inplace increase the size of the dimension of ind, the new array entries will be filled with zeros.

filter_bonds(other)

Sort this tensor's indices into a list of those that it shares and doesn't share with another tensor.

flip(ind[, inplace])

Reverse the axis on this tensor corresponding to ind.

flip_(ind, *[, inplace])

fuse(fuse_map[, inplace])

Combine groups of indices into single indices.

fuse_(fuse_map, *[, inplace])

gate(G, ind[, inplace])

Gate this tensor - contract a matrix into one of its indices without changing its indices.

gate_(G, ind, *[, inplace])

graph(*args, **kwargs)

Plot a graph of this tensor and its indices.

ind_size(ind)

Return the size of dimension corresponding to ind.

inner_inds()

iscomplex()

isel(selectors[, inplace])

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

isel_(selectors, *[, inplace])

largest_element()

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

max_dim()

Return the maximum size of any dimension, or 1 if scalar.

modify(**kwargs)

Overwrite the data of this tensor in place.

multiply_index_diagonal(ind, x[, inplace])

Multiply this tensor by 1D array x as if it were a diagonal tensor being contracted into index ind.

multiply_index_diagonal_(ind, x, *[, inplace])

new_bond(T2[, size, name, axis1, axis2])

Inplace addition of a new bond between tensors T1 and T2.

new_ind(name[, size, axis])

Inplace add a new index - a named dimension.

new_ind_with_identity(name, left_inds, ...)

Inplace add a new index, where the newly stacked array entries form the identity from left_inds to right_inds.

norm()

Frobenius norm of this tensor:

normalize([inplace])

normalize_(*[, inplace])

randomize([dtype, inplace])

Randomize the entries of this tensor.

randomize_([dtype, inplace])

reindex(index_map[, inplace])

Rename the indices of this tensor, optionally in-place.

reindex_(index_map, *[, inplace])

remove_owner(tn)

Remove TensorNetwork tn as an owner of this Tensor.

retag(retag_map[, inplace])

Rename the tags of this tensor, optionally, in-place.

retag_(retag_map, *[, inplace])

shared_bond_size(other)

Get the total size of the shared index(es) with other.

singular_values(left_inds[, method])

Return the singular values associated with splitting this tensor according to left_inds.

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

Decompose this tensor into two tensors.

squeeze([include, inplace])

Drop any singlet dimensions from this tensor.

squeeze_([include, inplace])

sum_reduce(ind[, inplace])

Sum over index ind, removing it from this tensor.

sum_reduce_(ind, *[, inplace])

symmetrize(ind1, ind2[, inplace])

Hermitian symmetrize this tensor for indices ind1 and ind2.

to_dense(*inds_seq[, to_qarray])

Convert this Tensor into an dense array, with a single dimension for each of inds in inds_seqs.

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

Trace index or indices left_inds with right_inds, removing them.

transpose(*output_inds[, inplace])

Transpose this tensor - permuting the order of both the data and the indices.

transpose_(*output_inds[, inplace])

transpose_like(other[, inplace])

Transpose this tensor to match the indices of other, allowing for one index to be different.

transpose_like_(other, *[, inplace])

unfuse(unfuse_map, shape_map[, inplace])

Reshape single indices into groups of multiple indices

unfuse_(unfuse_map, shape_map, *[, inplace])

unitize([left_inds, inplace, method])

Make this tensor unitary (or isometric) with respect to left_inds.

unitize_([left_inds, inplace, method])

Attributes

H

Conjugate this tensors data (does nothing to indices).

data

dtype

inds

is_leaf

left

left_inds

ndim

node_id

owners

right

shape

size

tags

__init__(node_id, left=None, right=None, *args, **kwargs)[source]#

The node of binary tree, while data structure is inherited from quimb.Tensor.

Parameters
  • node_id (int) – An integer ID of this node.

  • left (Optional[tnpy.tsdrg.Node]) – The left child node. Default None.

  • right (Optional[tnpy.tsdrg.Node]) – The right child node. Default None.

  • *args – Arguments to initialize quimb.Tensor.

  • **kwargs – Keywords to initialize quimb.Tensor.

property node_id: int#
property left: tnpy.tsdrg.Node | None#
property right: tnpy.tsdrg.Node | None#
property is_leaf: bool#