cuquantum.cutensornet.ContractionPath¶
- class cuquantum.cutensornet.ContractionPath(int num_contractions, uintptr_t data)¶
A proxy object to hold a
cutensornetContractionPath_t
struct.Users provide the number of contractions and a pointer address to the actual contraction path, and this object creates an
cutensornetContractionPath_t
instance and fills in the provided information.Example
# the pairwise contraction order is stored as C int path = np.asarray([(1, 3), (1, 2), (0, 1)], dtype=np.int32) path_obj = ContractionPath(path.size//2, path.ctypes.data) # get the pointer address to the underlying `cutensornetContractionPath_t` my_func(..., path_obj.get_data(), ...) # path must outlive path_obj! del path_obj del path
- Parameters
Note
Users are responsible for managing the lifetime of the underlying path data (i.e. the validity of the
data
pointer).Warning
The design of how
cutensornetContractionPath_t
is handled in Python is experimental and subject to change in a future release.Methods
- __init__(self, int num_contractions, uintptr_t data)¶
- get_path(self)¶
Get the pointer address to the underlying
cutensornetContractionPath_t
struct.- Returns
The pointer address.
- Return type
uintptr_t
- get_size(self)¶
Get the size of the
cutensornetContractionPath_t
struct.- Returns
sizeof(cutensornetContractionPath_t)
.- Return type
size_t