Class PathInfo

Class Documentation

class Jet::PathInfo

PathInfo represents a contraction path in a TensorNetwork.

Public Types

using NodeID_t = size_t

Type of a node ID.

using Path = std::vector<std::pair<NodeID_t, NodeID_t>>

Type of a contraction path.

using IndexToSizeMap = std::unordered_map<std::string, size_t>

Type of the index-to-size map.

using Steps = std::vector<PathStepInfo>

Type of a PathStepInfo sequence.

Public Functions

inline PathInfo()

Constructs an empty path.

template<typename Tensor>
inline PathInfo(const TensorNetwork<Tensor> &tn, const Path &path)

Constructs a populated path.

Warning

The program is aborted if the given path references a node ID which does not exist in the given tensor network.

Template Parameters

Tensor – Type of the tensor in the tensor network.

Parameters
  • tnTensor network associated with the contraction path.

  • path – Pairs of node IDs representing a raw contraction path.

inline const IndexToSizeMap &GetIndexSizes() const noexcept

Returns the index-to-size map of this path.

Returns

Map which associates each index with a dimension size.

inline size_t GetNumLeaves() const noexcept

Returns the number of leaf steps in this path.

Returns

Number of leaves.

inline const Path &GetPath() const noexcept

Returns the raw contraction path of this path.

Returns

Pairs of node IDs representing the contraction path.

inline const Steps &GetSteps() const noexcept

Returns the steps of this path.

Returns

Collection of path steps.

inline double GetPathStepFlops(size_t id) const

Computes the number of floating-point operations needed to execute a path step (excluding any dependencies or child steps).

Warning

The program is aborted if the given step ID does not exist.

Parameters

id – ID of a path step.

Returns

Number of floating-point multiplications and additions needed to compute the tensor associated with the path step.

inline double GetTotalFlops() const noexcept

Computes the total number of floating-point operations needed to contract the tensors represented by this path.

Parameters

id – ID of a path step.

Returns

Total number of floating-point multiplications and additions.

inline double GetPathStepMemory(size_t id) const

Computes the size of the tensor in a path step.

Warning

The program is aborted if the given step ID does not exist.

Parameters

id – ID of a path step.

Returns

Number of elements in the tensor associated with the path step.

inline double GetTotalMemory() const noexcept

Computes the total memory required (up to a constant sizeof factor) to hold the tensors represented by this path.

Returns

Total number of elements in the tensors.