NetKet 3.22.0.dev1__py3-none-any.whl → 3.22.0.dev3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -229,6 +229,21 @@ class AbstractDriver(struct.Pytree, mutable=True):
229
229
  self.reset_step()
230
230
  # self._step_count = 0
231
231
 
232
+ def _accept_step(self) -> bool:
233
+ """
234
+ Called after :meth:`compute_loss_and_update` to decide whether the
235
+ current step should be accepted.
236
+
237
+ Return ``False`` to reject the step and retry (``_step_attempt`` will
238
+ be incremented before the next attempt). Subclasses can override this
239
+ to implement driver-level acceptance criteria such as adaptive
240
+ step-size control: mutate driver state (e.g. ``self.dt``) as needed
241
+ before returning ``False``.
242
+
243
+ The default implementation always accepts.
244
+ """
245
+ return True
246
+
232
247
  def reset_step(self, hard: bool = False):
233
248
  """
234
249
  Resets the state of the driver at the beginning of a new step.
@@ -442,7 +457,8 @@ class AbstractDriver(struct.Pytree, mutable=True):
442
457
  reject_step = callbacks.on_compute_update_end(
443
458
  self.step_count, step_log_data, self
444
459
  )
445
- if reject_step:
460
+ driver_reject_step = not self._accept_step()
461
+ if driver_reject_step or reject_step:
446
462
  self._step_attempt += 1
447
463
  continue
448
464
  else:
netket/_version.py CHANGED
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
28
28
  commit_id: COMMIT_ID
29
29
  __commit_id__: COMMIT_ID
30
30
 
31
- __version__ = version = '3.22.0.dev1'
32
- __version_tuple__ = version_tuple = (3, 22, 0, 'dev1')
31
+ __version__ = version = '3.22.0.dev3'
32
+ __version_tuple__ = version_tuple = (3, 22, 0, 'dev3')
33
33
 
34
34
  __commit_id__ = commit_id = None
@@ -108,24 +108,29 @@ bt_feuler = TableauRKExplicit(
108
108
 
109
109
 
110
110
  bt_midpoint = TableauRKExplicit(
111
- order = (2,),
111
+ order = (2,1),
112
112
  a = jnp.array([[0, 0],
113
113
  [1/2, 0]], dtype=default_dtype),
114
- b = jnp.array( [0, 1], dtype=default_dtype),
114
+ b = jnp.array([[0, 1], # midpoint, order 2
115
+ [1, 0]]), # Euler, order 1
115
116
  c = jnp.array( [0, 1/2], dtype=default_dtype),
116
117
  name = "Midpoint"
117
118
  )
118
119
 
119
120
 
120
121
  bt_heun = TableauRKExplicit(
121
- order = (2,),
122
+ order = (2,1),
122
123
  a = jnp.array([[0, 0],
123
124
  [1, 0]], dtype=default_dtype),
124
- b = jnp.array( [1/2, 1/2], dtype=default_dtype),
125
+ b = jnp.array([[1/2, 1/2], # Heun, order 2
126
+ [1, 0 ]]), # Euler, order 1
125
127
  c = jnp.array( [0, 1], dtype=default_dtype),
126
128
  name = "Heun"
127
129
  )
128
130
 
131
+ # Adaptive step:
132
+ # Heun Euler https://en.wikipedia.org/wiki/Runge–Kutta_methods
133
+ bt_rk12 = bt_heun
129
134
 
130
135
  bt_rk4 = TableauRKExplicit(
131
136
  order = (4,),
@@ -138,20 +143,6 @@ bt_rk4 = TableauRKExplicit(
138
143
  name = "RK4"
139
144
  )
140
145
 
141
-
142
- # Adaptive step:
143
- # Heun Euler https://en.wikipedia.org/wiki/Runge–Kutta_methods
144
- bt_rk12 = TableauRKExplicit(
145
- order = (2,1),
146
- a = jnp.array([[0, 0],
147
- [1, 0]], dtype=default_dtype),
148
- b = jnp.array([[1/2, 1/2],
149
- [1, 0]], dtype=default_dtype),
150
- c = jnp.array( [0, 1], dtype=default_dtype),
151
- name = "RK12"
152
- )
153
-
154
-
155
146
  # Bogacki–Shampine coefficients
156
147
  bt_rk23 = TableauRKExplicit(
157
148
  order = (3,2),
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: NetKet
3
- Version: 3.22.0.dev1
3
+ Version: 3.22.0.dev3
4
4
  Summary: Netket : Machine Learning toolbox for many-body quantum systems.
5
5
  Project-URL: homepage, https://www.netket.org
6
6
  Project-URL: documentation, https://netket.readthedocs.io/en/latest/#
@@ -54,7 +54,7 @@ Requires-Dist: myst-nb<1.5,>=1.0; extra == 'docs'
54
54
  Requires-Dist: myst-parser<5.1.0,>=2.0.0; extra == 'docs'
55
55
  Requires-Dist: nbconvert>=7.16.6; extra == 'docs'
56
56
  Requires-Dist: sphinx-autodoc-typehints<4.0,>=1.22; extra == 'docs'
57
- Requires-Dist: sphinx-book-theme~=1.1.0; extra == 'docs'
57
+ Requires-Dist: sphinx-book-theme<1.3,>=1.1; extra == 'docs'
58
58
  Requires-Dist: sphinx-copybutton>=0.5.2; extra == 'docs'
59
59
  Requires-Dist: sphinx-design>=0.4.0; extra == 'docs'
60
60
  Requires-Dist: sphinx<9.2.0,>=8.2.3; extra == 'docs'
@@ -1,6 +1,6 @@
1
1
  docs/sphinx_extensions/netket_citations.py,sha256=IkS9Uj_yv12vdKlGQwT_HZHgtr2rlTu7zpRBM6d6iYo,7990
2
2
  netket/__init__.py,sha256=bn46oMQ0ahZ3RgzQbx780aTWsGAVx1VO_tvtmGcPxto,1553
3
- netket/_version.py,sha256=5VwbeC7MNxrikogPRDBsdmr1xcOF3iadJTRlkaJa8hk,719
3
+ netket/_version.py,sha256=6p6qkvhXglYZXbFAvu3a2PworISwuesiQ7mV3qft6Zo,719
4
4
  netket/errors.py,sha256=ZVW-_MY3basQU5R-304NYuVW6m3VKe0br569RwoH-bk,60415
5
5
  netket/exact.py,sha256=o4vDhiEv0sew3VL-8_NjT7yMlJNXZIlVunytzI4NCBE,8713
6
6
  netket/_src/callbacks/auto_chunk_size.py,sha256=P9iggnZE-pz47vj3dRDE8sJRSRDlOEo5uEh1ZonIFyw,9562
@@ -14,7 +14,7 @@ netket/_src/callbacks/save_state.py,sha256=ojt2JEN2xtqyNYSbHlx1tg55kT0E33NBxN1pO
14
14
  netket/_src/callbacks/stop_at_time.py,sha256=tEWMX71be4r2CDp1W2v-tSjcaPhe-S1qkJteVxBNokE,1321
15
15
  netket/_src/driver/abstract_dynamics_driver.py,sha256=cKyVaf-_GCHMryMKW2X_wQRq70CzP-asOrulvCwic5k,7183
16
16
  netket/_src/driver/abstract_optimization_driver.py,sha256=EzEGYH_PYXxPeOdt6udqyWj1idyL0NBFPxF_qHRoH9A,3121
17
- netket/_src/driver/abstract_variational_driver.py,sha256=MGcjGI_OvwmPDruBw3tDovv4-hgmxrPYBNkBmHcGyuw,21169
17
+ netket/_src/driver/abstract_variational_driver.py,sha256=ChtxMqY-wkGyrwAHjet1GSDnRasGnt5Bn6DU2t7UpoU,21849
18
18
  netket/_src/driver/abstract_variational_driver_old.py,sha256=JkMy04pQukwvYMxbnnIU_IzB-PnGKwazL5N7xzg1dMA,16884
19
19
  netket/_src/driver/infidelity_sr.py,sha256=Vo119ITrcq-CZi_1AH0B87w6MwycqNxLnrdpjuXbEWg,17842
20
20
  netket/_src/driver/vmc_sr.py,sha256=OkpDUwErsRfVRgKmoiw5cIIhCtPVJBABYrda334uLNg,28954
@@ -76,7 +76,7 @@ netket/experimental/dynamics/_solver.py,sha256=-2gaEzWF2qxY9VSVVC8Xm22dQb3wFUYSx
76
76
  netket/experimental/dynamics/_utils.py,sha256=j0tq1W0HCGEr8y9iRlypVtVZBuHVU1FeqfnCQvSrFlE,3052
77
77
  netket/experimental/dynamics/_rk/__init__.py,sha256=sl2tCIuOqK-pzEaxjCui2v0kSeQQ2XwtH274fFpdWcE,66
78
78
  netket/experimental/dynamics/_rk/_solver.py,sha256=-mZyVuYiszTMkKBwzVXt9vlGSAiQHuPa3BTEezTtrA4,7532
79
- netket/experimental/dynamics/_rk/_tableau.py,sha256=WY1zCzA7KwgYJHBl5H--O0vcduwEwnmAsykcaZ4xVTE,8990
79
+ netket/experimental/dynamics/_rk/_tableau.py,sha256=TOyRICs-d5fCI17IcRsLxTXqIgg5M33zV_3M7aNwcu8,8746
80
80
  netket/experimental/geometry/__init__.py,sha256=xuiOXqqbFP8YiQS2XOEa643xZK0_FPyQYwzptARd0xI,133
81
81
  netket/experimental/geometry/cell.py,sha256=iaQM4nE-WMCIM2jaDVntaBoecWhBumaK9BrfCcbcLqU,2515
82
82
  netket/experimental/hilbert/__init__.py,sha256=A_5xRK8Cz4HsNKiDUDpfTIfnYUHpliCUOAszefUWKSY,834
@@ -405,8 +405,8 @@ netket/vqs/mc/mc_state/expect_forces_chunked.py,sha256=XcG2UvyqNkGy1lMoau2yzscLq
405
405
  netket/vqs/mc/mc_state/expect_grad.py,sha256=l_m5y4OQx1aRuklXg8fNQNbPOlHBS3OsHAweBJm51Fw,5260
406
406
  netket/vqs/mc/mc_state/expect_grad_chunked.py,sha256=H1NmakACgDKfTArO0tftVdG6dn3UdYAs_RSEL1HFiAQ,2322
407
407
  netket/vqs/mc/mc_state/state.py,sha256=A70TlejtZi1P81fGkXEyBRkxI4oHEDYAQV1qth0izOQ,40381
408
- netket-3.22.0.dev1.dist-info/METADATA,sha256=a86TqtrI6x32_W6KMtUgzDFyqVDxKrhoBb3x0SotP6o,5932
409
- netket-3.22.0.dev1.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
410
- netket-3.22.0.dev1.dist-info/entry_points.txt,sha256=mGOesl2TwrfDnkQVvYYb1jvA5TTzGPGchbCFPFpqHao,104
411
- netket-3.22.0.dev1.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
412
- netket-3.22.0.dev1.dist-info/RECORD,,
408
+ netket-3.22.0.dev3.dist-info/METADATA,sha256=wbSDOxxAxzu6xH3A86ANWBYCCrB8L6CLLW_X0meXfeA,5935
409
+ netket-3.22.0.dev3.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
410
+ netket-3.22.0.dev3.dist-info/entry_points.txt,sha256=mGOesl2TwrfDnkQVvYYb1jvA5TTzGPGchbCFPFpqHao,104
411
+ netket-3.22.0.dev3.dist-info/licenses/LICENSE,sha256=psuoW8kuDP96RQsdhzwOqi6fyWv0ct8CR6Jr7He_P_k,10173
412
+ netket-3.22.0.dev3.dist-info/RECORD,,