design question for a custom operator #1143
-
Hi, I need to compute a observable which was problematic to implement using LocalOperator because of the sheer number of operators I need #457 . There i was told that a custom operator like the way I understand it, I will need to define at least the following:
that returns connected states and the corresponding matrix elements for I would be very thankful for some tipps on this |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 19 replies
-
OperatorLean as presented in the custom operator documentation basically ask you to provide a function through If you have different observables In short, I think you should be able to take the example in here and edit only |
Beta Was this translation helpful? Give feedback.
-
An alternative would be to implement an operator inheriting from netket/netket/operator/_hamiltonian.py Line 252 in 216092e In this case you'd have to define a function (ideally numbajitted) that computes the connected elements. The point of not adding a new dimension is because, in general, an operator represent the matrix ( |
Beta Was this translation helpful? Give feedback.
-
thank you for the quick answer as always! I guess this makes inheriting |
Beta Was this translation helpful? Give feedback.
An alternative would be to implement an operator inheriting from
DiscreteOperator
, likeIsing
:netket/netket/operator/_hamiltonian.py
Line 252 in 216092e
In this case you'd have to define a function (ideally numbajitted) that computes the connected elements.
As those operators correspond to a matrix, again, you cannot add new axes arbitrarily but you can flatten it yourself.
The point of not adding a new dimension is because, in general, an operator represent the matrix (
X_1HX_1 + X_1 H X_2 + X_2H X_1 + X_2 H X_2 + etc...
) , and not the single terms.