Skip to content

Commit

Permalink
TensorNetwork: add .backend and .dtype_name properties
Browse files Browse the repository at this point in the history
  • Loading branch information
jcmgray committed Dec 13, 2024
1 parent e928b29 commit 1dc14d5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions quimb/tensor/tensor_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -10683,8 +10683,21 @@ def dtype(self):
"""The dtype of this TensorNetwork, this is the minimal common type
of all the tensors data.
"""
# TODO: support non numpy dtypes here
return get_common_dtype(*self.arrays)

@property
def dtype_name(self):
"""The name of the data type of the array elements."""
return next(iter(self.tensor_map.values())).dtype_name

@property
def backend(self):
"""Get the backend of any tensor in this network, asssuming it to be
the same for all tensors.
"""
return next(iter(self.tensor_map.values())).backend

def iscomplex(self):
return iscomplex(self)

Expand Down

0 comments on commit 1dc14d5

Please sign in to comment.