tnpy.tsdrg.Node
4.1. tnpy.tsdrg.Node#
- class tnpy.tsdrg.Node(node_id, left=None, right=None, *args, **kwargs)[source]#
Bases:
quimb.tensor.tensor_core.TensorThe node of binary tree, while data structure is inherited from
quimb.Tensor.- Parameters
- __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
tnas 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 or multiple tags to this tensor.
almost_equals(other, **kwargs)Check if this tensor is almost the same as another.
apply_to_arrays(fn)Apply the function
fnto the underlying data array(s).as_network([virtual])Return a
TensorNetworkwith only this tensor.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()Do some basic diagnostics on this tensor, raising errors if something is wrong.
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])compute_reduced_factor(side, left_inds, ...)conj([inplace])Conjugate this tensors data (does nothing to indices).
conj_(*[, inplace])contract(*[, output_inds, optimize, get, ...])Contract a collection of tensors into a scalar or tensor, automatically aligning their indices and computing an optimized contraction path.
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:
distance_normalized(tnB[, xAA, xAB, xBB, ...])draw([color, show_inds, show_tags, ...])Plot this tensor network as a networkx graph using matplotlib, with edge width corresponding to bond dimension.
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[, mode, rand_strength, ...])Inplace increase the size of the dimension of
ind, the new array entries will be filled with zeros by default.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[, preserve_inds, inplace])Gate this tensor - contract a matrix into one of its indices without changing its indices.
gate_(G, ind[, preserve_inds, inplace])get_params()A simple function that returns the 'parameters' of the underlying data array.
graph([color, show_inds, show_tags, ...])Plot this tensor network as a networkx graph using matplotlib, with edge width corresponding to bond dimension.
idxmax([f])Get the index configuration of the maximum element of this tensor, optionally applying
ffirst.idxmin([f])Get the index configuration of the minimum element of this tensor, optionally applying
ffirst.ind_size(ind)Return the size of dimension corresponding to
ind.inds_size(inds)Return the total size of dimensions corresponding to
inds.inner_inds()Get all indices that appear on two or more tensors.
iscomplex()isel(selectors[, inplace])Select specific values for some dimensions/indices of this tensor, thereby removing them.
isel_(selectors, *[, inplace])isometrize([left_inds, method, inplace])Make this tensor unitary (or isometric) with respect to
left_inds.isometrize_([left_inds, method, inplace])item()Return the scalar value of this tensor, if it has a single element.
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.
moveindex(ind, axis[, inplace])Move the index
indto positionaxis.moveindex_(ind, axis, *[, inplace])multiply_index_diagonal(ind, x[, inplace])Multiply this tensor by 1D array
xas if it were a diagonal tensor being contracted into indexind.multiply_index_diagonal_(ind, x, *[, inplace])negate([inplace])Negate this tensor.
negate_(*[, inplace])new_bond(T2[, size, name, axis1, axis2])Inplace addition of a new bond between tensors
T1andT2.new_ind(name[, size, axis, mode, ...])Inplace add a new index - a named dimension.
new_ind_pair_with_identity(new_left_ind, ...)Expand this tensor with two new indices of size
d, by taking an (outer) tensor product with the identity operator.new_ind_pair_with_identity_(new_left_ind, ...)new_ind_with_identity(name, left_inds, ...)Inplace add a new index, where the newly stacked array entries form the identity from
left_indstoright_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
tnas an owner of this Tensor.retag(retag_map[, inplace])Rename the tags of this tensor, optionally, in-place.
retag_(retag_map, *[, inplace])set_params(params)A simple function that sets the 'parameters' of the underlying data array.
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, exclude, inplace])Drop any singlet dimensions from this tensor.
squeeze_([include, exclude, 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
ind1andind2.symmetrize_(ind1, ind2, *[, inplace])to_dense(*inds_seq[, to_qarray])Convert this Tensor into an dense array, with a single dimension for each of inds in
inds_seqs.to_qarray(*inds_seq[, to_qarray])trace(left_inds, right_inds[, ...])Trace index or indices
left_indswithright_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, method, inplace])Make this tensor unitary (or isometric) with respect to
left_inds.unitize_Method descriptor with partial application of the given arguments and keywords.
vector_reduce(ind, v[, inplace])Contract the vector
vwith the indexindof this tensor, removing it.vector_reduce_(ind, v, *[, inplace])visualize(**kwargs)Visualize all entries of a tensor, with indices mapped into the plane and values mapped into a color wheel.
Attributes
HConjugate this tensors data (does nothing to indices).
backendThe backend inferred from the data.
datadtypeThe data type of the array elements.
indsleft_indsndimThe number of dimensions.
ownersshapeThe size of each dimension.
sizeThe total number of array elements.
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#