netket_foundation.operator.PauliStringsJax#
- class netket_foundation.operator.PauliStringsJax(hilbert, operators=None, weights=None, *, cutoff=1e-10, dtype=None)[source]#
Jax-compatible version of
netket.operator.PauliStringsNumba.- Parameters:
- __init__(hilbert, operators=None, weights=None, *, cutoff=1e-10, dtype=None)[source]#
Constructs a new
PauliStringsoperator given a set of Pauli operators. This class has two possible forms for initialization:PauliStrings(hilbert, operators, ...)orPauliStrings(operators, ...). When no hilbert argument is passed, the hilbert defaults to Qubit, where the number of qubits is automatically deduced from the operators.- Parameters:
hilbert (
AbstractHilbert) – A hilbert space, optional (is noAbstractHilbertis passed, default is Qubit)operators (
None|str|list[str]) – A list of Pauli operators in string format, e.g. [‘IXX’, ‘XZI’].weights (
None|float|complex|list[float|complex]) – A list of amplitudes of the corresponding Pauli operator.cutoff (
float) – a cutoff to remove small matrix elements (default = 1e-10)dtype (
Union[None,str,type[Any],dtype,_SupportsDType]) – The datatype to use for the matrix elements. Defaults to double precision if available.
Examples
Constructs a new
PauliStringsoperator X_0*X_1 + 3.*Z_0*Z_1 with both construction schemes.>>> import netket as nk >>> operators, weights = ['XX','ZZ'], [1,3] >>> op = nk.operator.PauliStrings(operators, weights) >>> op.hilbert Qubit(N=2) >>> op.hilbert.size 2 >>> hilbert = nk.hilbert.Spin(1/2, 2) >>> op = nk.operator.PauliStrings(hilbert, operators, weights) >>> op.hilbert Spin(s=1/2, N=2, ordering=new)
Methods
__init__(hilbert[, operators, weights, ...])Constructs a new
PauliStringsoperator given a set of Pauli operators.apply(v)collect()Returns a guaranteed concrete instance of an operator.
conj(*[, concrete])conjugate(*[, concrete])Returns the complex-conjugate of this operator.
copy(*[, dtype, cutoff])Returns a copy of the operator, while optionally changing the dtype of the operator.
from_openfermion(hilbert[, ...])Converts an openfermion QubitOperator into a netket PauliStrings.
get_conn(x)Finds the connected elements of the Operator.
get_conn_flattened(x, sections[, pad])Finds the connected elements of the Operator.
get_conn_padded(x)Finds the connected elements of the Operator.
identity(hilbert, **kwargs)n_conn(x)Return the number of states connected to x.
to_dense()Returns the dense matrix representation of the operator.
to_jax_operator()Return the JAX version of this operator.
to_linear_operator()to_numba_operator()Returns the standard numba version of this operator, which is an instance of
netket.operator.PauliStrings.to_qobj()Convert the operator to a qutip's Qobj.
to_sparse([jax_])Returns the sparse matrix representation of the operator.
transpose(*[, concrete])Returns the transpose of this operator.
tree_flatten()tree_unflatten(metadata, data)Attributes
HReturns the Conjugate-Transposed operator
TReturns the transposed operator
dtypeThe dtype of the operator's matrix elements ⟨σ|Ô|σ'⟩.
hilbertThe hilbert space associated to this observable.
is_hermitianReturns true if this operator is hermitian.
max_conn_sizeThe maximum number of non zero ⟨x|O|x'⟩ for every x.
operatorsweights