NetKet 3.18__tar.gz → 3.19.0__tar.gz
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.
- {netket-3.18 → netket-3.19.0}/.gitignore +4 -0
- {netket-3.18 → netket-3.19.0}/PKG-INFO +19 -48
- netket-3.19.0/README.md +55 -0
- netket-3.19.0/netket/_src/ngd/kwargs.py +42 -0
- netket-3.19.0/netket/_src/ngd/sr.py +70 -0
- netket-3.19.0/netket/_src/ngd/sr_srt_common.py +153 -0
- netket-3.19.0/netket/_src/ngd/srt.py +93 -0
- netket-3.19.0/netket/_src/ngd/srt_onthefly.py +241 -0
- netket-3.19.0/netket/_src/operator/hpsi_utils.py +48 -0
- {netket-3.18 → netket-3.19.0}/netket/_version.py +2 -2
- {netket-3.18 → netket-3.19.0}/netket/driver/abstract_variational_driver.py +5 -6
- {netket-3.18 → netket-3.19.0}/netket/driver/vmc.py +6 -0
- {netket-3.18 → netket-3.19.0}/netket/errors.py +9 -3
- netket-3.19.0/netket/experimental/driver/__init__.py +35 -0
- netket-3.19.0/netket/experimental/driver/infidelity_sr.py +407 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/driver/tdvp.py +1 -5
- {netket-3.18 → netket-3.19.0}/netket/experimental/driver/tdvp_common.py +3 -19
- {netket-3.18 → netket-3.19.0}/netket/experimental/driver/tdvp_schmitt.py +2 -6
- netket-3.19.0/netket/experimental/driver/vmc_sr.py +473 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/dynamics/_integrator.py +0 -3
- {netket-3.18 → netket-3.19.0}/netket/experimental/geometry/cell.py +1 -1
- netket-3.19.0/netket/experimental/observable/__init__.py +31 -0
- netket-3.19.0/netket/experimental/observable/infidelity/__init__.py +22 -0
- netket-3.19.0/netket/experimental/observable/infidelity/exact.py +90 -0
- netket-3.19.0/netket/experimental/observable/infidelity/expect.py +102 -0
- netket-3.19.0/netket/experimental/observable/infidelity/infidelity_operator.py +130 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/observable/renyi2/expect.py +3 -6
- {netket-3.18 → netket-3.19.0}/netket/experimental/observable/variance/exact.py +0 -2
- {netket-3.18 → netket-3.19.0}/netket/experimental/observable/variance/expect.py +0 -3
- {netket-3.18 → netket-3.19.0}/netket/experimental/operator/_particle_number_conserving_fermionic/_fermihubbard.py +1 -1
- {netket-3.18 → netket-3.19.0}/netket/experimental/operator/_particle_number_conserving_fermionic/_kernels.py +4 -5
- {netket-3.18 → netket-3.19.0}/netket/experimental/operator/_particle_number_conserving_fermionic/_operator_data.py +3 -3
- {netket-3.18 → netket-3.19.0}/netket/experimental/operator/_particle_number_conserving_fermionic/_operators.py +17 -12
- {netket-3.18 → netket-3.19.0}/netket/experimental/operator/pyscf.py +1 -1
- {netket-3.18 → netket-3.19.0}/netket/experimental/qsr/driver.py +1 -3
- {netket-3.18 → netket-3.19.0}/netket/experimental/qsr/logic_helpers.py +2 -8
- netket-3.19.0/netket/experimental/sampler/__init__.py +39 -0
- {netket-3.18 → netket-3.19.0}/netket/graph/_lattice_draw.py +0 -11
- {netket-3.18 → netket-3.19.0}/netket/graph/graph.py +0 -14
- {netket-3.18 → netket-3.19.0}/netket/graph/space_group.py +233 -115
- {netket-3.18 → netket-3.19.0}/netket/hilbert/abstract_hilbert.py +1 -1
- {netket-3.18 → netket-3.19.0}/netket/hilbert/fock.py +1 -1
- {netket-3.18 → netket-3.19.0}/netket/hilbert/qubit.py +1 -1
- {netket-3.18 → netket-3.19.0}/netket/hilbert/spin_orbital_fermions.py +0 -17
- {netket-3.18 → netket-3.19.0}/netket/jax/__init__.py +0 -1
- {netket-3.18 → netket-3.19.0}/netket/jax/_chunk_utils.py +47 -14
- {netket-3.18 → netket-3.19.0}/netket/jax/_expect.py +6 -15
- {netket-3.18 → netket-3.19.0}/netket/jax/_jacobian/logic.py +8 -9
- netket-3.19.0/netket/jax/_ntk/__init__.py +1 -0
- netket-3.19.0/netket/jax/_ntk/logic.py +475 -0
- netket-3.19.0/netket/jax/_ntk/utils.py +353 -0
- {netket-3.18 → netket-3.19.0}/netket/jax/_scanmap.py +22 -7
- {netket-3.18 → netket-3.19.0}/netket/jax/_utils_random.py +8 -39
- {netket-3.18 → netket-3.19.0}/netket/jax/_vjp_chunked.py +101 -46
- {netket-3.18 → netket-3.19.0}/netket/jax/_vmap_chunked.py +29 -37
- {netket-3.18 → netket-3.19.0}/netket/jax/sharding.py +53 -31
- {netket-3.18 → netket-3.19.0}/netket/logging/base.py +3 -3
- {netket-3.18 → netket-3.19.0}/netket/logging/tensorboard.py +2 -2
- {netket-3.18 → netket-3.19.0}/netket/models/autoreg.py +0 -10
- {netket-3.18 → netket-3.19.0}/netket/models/deepset.py +1 -1
- {netket-3.18 → netket-3.19.0}/netket/nn/__init__.py +2 -1
- {netket-3.18 → netket-3.19.0}/netket/nn/activation.py +0 -7
- netket-3.19.0/netket/nn/blocks/symmetry_sum.py +170 -0
- {netket-3.18 → netket-3.19.0}/netket/nn/symmetric_linear.py +2 -22
- {netket-3.18 → netket-3.19.0}/netket/nn/utils.py +12 -72
- {netket-3.18 → netket-3.19.0}/netket/operator/__init__.py +12 -6
- {netket-3.18 → netket-3.19.0}/netket/operator/_abstract_operator.py +41 -1
- {netket-3.18 → netket-3.19.0}/netket/operator/_bose_hubbard/__init__.py +3 -1
- {netket-3.18 → netket-3.19.0}/netket/operator/_bose_hubbard/base.py +15 -9
- {netket-3.18 → netket-3.19.0}/netket/operator/_bose_hubbard/jax.py +4 -4
- {netket-3.18 → netket-3.19.0}/netket/operator/_bose_hubbard/numba.py +1 -1
- {netket-3.18 → netket-3.19.0}/netket/operator/_continuous_operator.py +25 -27
- {netket-3.18 → netket-3.19.0}/netket/operator/_discrete_operator.py +2 -1
- {netket-3.18 → netket-3.19.0}/netket/operator/_discrete_operator_jax.py +45 -32
- {netket-3.18 → netket-3.19.0}/netket/operator/_fermion2nd/__init__.py +4 -1
- {netket-3.18 → netket-3.19.0}/netket/operator/_fermion2nd/base.py +46 -8
- {netket-3.18 → netket-3.19.0}/netket/operator/_fermion2nd/jax.py +13 -4
- {netket-3.18 → netket-3.19.0}/netket/operator/_fermion2nd/numba.py +2 -1
- netket-3.19.0/netket/operator/_graph_operator.py +145 -0
- {netket-3.18 → netket-3.19.0}/netket/operator/_hamiltonian.py +6 -3
- netket-3.19.0/netket/operator/_heisenberg.py +132 -0
- {netket-3.18 → netket-3.19.0}/netket/operator/_ising/__init__.py +4 -1
- {netket-3.18 → netket-3.19.0}/netket/operator/_ising/base.py +18 -6
- {netket-3.18 → netket-3.19.0}/netket/operator/_ising/jax.py +12 -7
- {netket-3.18 → netket-3.19.0}/netket/operator/_ising/numba.py +6 -4
- {netket-3.18 → netket-3.19.0}/netket/operator/_kinetic.py +20 -15
- {netket-3.18 → netket-3.19.0}/netket/operator/_local_liouvillian.py +15 -2
- {netket-3.18 → netket-3.19.0}/netket/operator/_local_operator/__init__.py +4 -1
- {netket-3.18 → netket-3.19.0}/netket/operator/_local_operator/base.py +8 -4
- {netket-3.18 → netket-3.19.0}/netket/operator/_local_operator/jax.py +7 -5
- {netket-3.18 → netket-3.19.0}/netket/operator/_local_operator/numba.py +5 -1
- {netket-3.18 → netket-3.19.0}/netket/operator/_pauli_strings/__init__.py +3 -1
- {netket-3.18 → netket-3.19.0}/netket/operator/_pauli_strings/base.py +14 -7
- {netket-3.18 → netket-3.19.0}/netket/operator/_pauli_strings/jax.py +4 -4
- {netket-3.18 → netket-3.19.0}/netket/operator/_pauli_strings/numba.py +6 -2
- {netket-3.18 → netket-3.19.0}/netket/operator/_potential.py +26 -41
- {netket-3.18/netket/experimental/driver → netket-3.19.0/netket/operator/_sum}/__init__.py +6 -7
- netket-3.19.0/netket/operator/_sum/base.py +211 -0
- netket-3.19.0/netket/operator/_sum/continuous.py +88 -0
- netket-3.19.0/netket/operator/_sum/discrete_jax_operator.py +84 -0
- netket-3.19.0/netket/operator/_sum/discrete_operator.py +61 -0
- netket-3.19.0/netket/operator/_sum/operator.py +37 -0
- {netket-3.18 → netket-3.19.0}/netket/operator/boson.py +36 -13
- {netket-3.18 → netket-3.19.0}/netket/operator/spin.py +49 -19
- {netket-3.18 → netket-3.19.0}/netket/optimizer/qgt/qgt_jacobian.py +4 -5
- {netket-3.18 → netket-3.19.0}/netket/optimizer/qgt/qgt_jacobian_common.py +1 -6
- {netket-3.18 → netket-3.19.0}/netket/optimizer/qgt/qgt_jacobian_dense.py +4 -5
- {netket-3.18 → netket-3.19.0}/netket/optimizer/qgt/qgt_jacobian_pytree.py +3 -5
- {netket-3.18 → netket-3.19.0}/netket/optimizer/qgt/qgt_onthefly.py +3 -4
- {netket-3.18 → netket-3.19.0}/netket/optimizer/qgt/qgt_onthefly_logic.py +8 -11
- {netket-3.18 → netket-3.19.0}/netket/optimizer/sr.py +5 -0
- {netket-3.18 → netket-3.19.0}/netket/sampler/base.py +22 -21
- {netket-3.18 → netket-3.19.0}/netket/sampler/metropolis.py +77 -102
- {netket-3.18 → netket-3.19.0}/netket/sampler/metropolis_numpy.py +6 -7
- {netket-3.18 → netket-3.19.0}/netket/sampler/parallel_tempering.py +54 -94
- {netket-3.18 → netket-3.19.0}/netket/sampler/rules/custom_numpy.py +3 -0
- {netket-3.18 → netket-3.19.0}/netket/sampler/rules/hamiltonian_numpy.py +8 -1
- {netket-3.18 → netket-3.19.0}/netket/sampler/rules/langevin.py +3 -1
- {netket-3.18 → netket-3.19.0}/netket/stats/mc_stats.py +55 -20
- {netket-3.18 → netket-3.19.0}/netket/stats/mc_stats_old.py +1 -1
- {netket-3.18 → netket-3.19.0}/netket/stats/mpi_stats.py +11 -24
- netket-3.19.0/netket/tools/check_mpi.py +0 -0
- netket-3.19.0/netket/tools/djaxrun.py +172 -0
- {netket-3.18 → netket-3.19.0}/netket/tools/info.py +1 -52
- netket-3.19.0/netket/utils/__init__.py +71 -0
- {netket-3.18 → netket-3.19.0}/netket/utils/_dependencies_check.py +1 -1
- {netket-3.18 → netket-3.19.0}/netket/utils/array.py +1 -1
- {netket-3.18 → netket-3.19.0}/netket/utils/config_flags.py +41 -85
- netket-3.19.0/netket/utils/dispatch.py +16 -0
- {netket-3.18 → netket-3.19.0}/netket/utils/display/__init__.py +1 -1
- {netket-3.18/netket/experimental/observable → netket-3.19.0/netket/utils/group}/__init__.py +5 -4
- {netket-3.18 → netket-3.19.0}/netket/utils/group/_group.py +288 -57
- {netket-3.18 → netket-3.19.0}/netket/utils/group/_permutation_group.py +19 -4
- {netket-3.18 → netket-3.19.0}/netket/utils/group/_point_group.py +26 -9
- {netket-3.18 → netket-3.19.0}/netket/utils/group/_semigroup.py +1 -0
- {netket-3.18 → netket-3.19.0}/netket/utils/group/axial.py +2 -2
- {netket-3.18 → netket-3.19.0}/netket/utils/group/cubic.py +6 -6
- {netket-3.18 → netket-3.19.0}/netket/utils/group/icosa.py +3 -3
- {netket-3.18 → netket-3.19.0}/netket/utils/group/planar.py +2 -2
- netket-3.19.0/netket/utils/history/__init__.py +7 -0
- {netket-3.18 → netket-3.19.0}/netket/utils/history/accum.py +70 -3
- {netket-3.18 → netket-3.19.0}/netket/utils/history/history.py +22 -15
- {netket-3.18 → netket-3.19.0}/netket/utils/history/history_dict.py +6 -8
- {netket-3.18 → netket-3.19.0}/netket/utils/jax.py +3 -3
- {netket-3.18 → netket-3.19.0}/netket/utils/model_frameworks/__init__.py +3 -3
- {netket-3.18 → netket-3.19.0}/netket/utils/model_frameworks/equinox.py +1 -1
- {netket-3.18 → netket-3.19.0}/netket/utils/model_frameworks/flax.py +1 -1
- {netket-3.18 → netket-3.19.0}/netket/utils/model_frameworks/haiku.py +1 -1
- {netket-3.18 → netket-3.19.0}/netket/utils/model_frameworks/jax.py +1 -1
- {netket-3.18 → netket-3.19.0}/netket/utils/model_frameworks/nnx.py +16 -3
- {netket-3.18 → netket-3.19.0}/netket/utils/model_frameworks/nnx_wrapped.py +1 -1
- netket-3.19.0/netket/utils/mpi/__init__.py +88 -0
- netket-3.19.0/netket/utils/mpi/mpi.py +31 -0
- {netket-3.18 → netket-3.19.0}/netket/utils/mpi/primitives.py +27 -134
- {netket-3.18 → netket-3.19.0}/netket/utils/numbers.py +3 -3
- {netket-3.18 → netket-3.19.0}/netket/utils/static_number.py +2 -2
- {netket-3.18 → netket-3.19.0}/netket/utils/static_range.py +4 -2
- {netket-3.18 → netket-3.19.0}/netket/utils/struct/__init__.py +9 -4
- {netket-3.18 → netket-3.19.0}/netket/utils/struct/dataclass.py +4 -4
- {netket-3.18 → netket-3.19.0}/netket/utils/struct/fields.py +28 -9
- {netket-3.18 → netket-3.19.0}/netket/utils/struct/pytree.py +43 -14
- {netket-3.18 → netket-3.19.0}/netket/utils/struct/pytree_serialization_sharding.py +25 -107
- {netket-3.18 → netket-3.19.0}/netket/utils/timing.py +23 -7
- {netket-3.18 → netket-3.19.0}/netket/utils/version_check.py +11 -4
- {netket-3.18 → netket-3.19.0}/netket/vqs/__init__.py +3 -11
- {netket-3.18 → netket-3.19.0}/netket/vqs/base.py +2 -2
- {netket-3.18 → netket-3.19.0}/netket/vqs/full_summ/expect.py +1 -1
- {netket-3.18 → netket-3.19.0}/netket/vqs/full_summ/state.py +1 -1
- {netket-3.18 → netket-3.19.0}/netket/vqs/mc/mc_mixed_state/state.py +1 -1
- {netket-3.18 → netket-3.19.0}/netket/vqs/mc/mc_state/expect.py +32 -19
- {netket-3.18 → netket-3.19.0}/netket/vqs/mc/mc_state/expect_chunked.py +5 -6
- {netket-3.18 → netket-3.19.0}/netket/vqs/mc/mc_state/expect_forces.py +1 -4
- {netket-3.18 → netket-3.19.0}/netket/vqs/mc/mc_state/expect_forces_chunked.py +3 -7
- {netket-3.18 → netket-3.19.0}/netket/vqs/mc/mc_state/expect_grad.py +1 -2
- {netket-3.18 → netket-3.19.0}/netket/vqs/mc/mc_state/state.py +13 -14
- {netket-3.18 → netket-3.19.0}/pyproject.toml +23 -13
- netket-3.18/README.md +0 -87
- netket-3.18/hatch.toml +0 -84
- netket-3.18/netket/driver/vmc_common.py +0 -44
- netket-3.18/netket/experimental/driver/vmc_srt.py +0 -322
- netket-3.18/netket/experimental/sampler/__init__.py +0 -65
- netket-3.18/netket/nn/blocks/symmetry_sum.py +0 -143
- netket-3.18/netket/operator/_graph_operator.py +0 -180
- netket-3.18/netket/operator/_heisenberg.py +0 -144
- netket-3.18/netket/operator/_sumoperators.py +0 -159
- netket-3.18/netket/tools/_mpi_info.py +0 -24
- netket-3.18/netket/tools/check_mpi.py +0 -61
- netket-3.18/netket/utils/__init__.py +0 -66
- netket-3.18/netket/utils/dispatch.py +0 -46
- netket-3.18/netket/utils/group/__init__.py +0 -20
- netket-3.18/netket/utils/history/__init__.py +0 -3
- netket-3.18/netket/utils/mpi/__init__.py +0 -48
- netket-3.18/netket/utils/mpi/gpu_autorank_util.py +0 -154
- netket-3.18/netket/utils/mpi/mpi.py +0 -125
- {netket-3.18 → netket-3.19.0}/LICENSE +0 -0
- {netket-3.18 → netket-3.19.0}/netket/__init__.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/callbacks/__init__.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/callbacks/convergence_stopping.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/callbacks/early_stopping.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/callbacks/invalid_loss_stopping.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/callbacks/timeout.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/driver/__init__.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/driver/steady_state.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/exact.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/__init__.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/dynamics/__init__.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/dynamics/_integrator_params.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/dynamics/_integrator_state.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/dynamics/_rk/__init__.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/dynamics/_rk/_solver.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/dynamics/_rk/_tableau.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/dynamics/_solver.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/dynamics/_utils.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/geometry/__init__.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/hilbert/__init__.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/hilbert/continuous_hilbert.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/hilbert/particle.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/hilbert/random/__init__.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/hilbert/random/particle.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/logging/__init__.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/logging/hdf5_log.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/models/__init__.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/models/fast_rnn.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/models/rnn.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/nn/__init__.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/nn/rnn/__init__.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/nn/rnn/cells.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/nn/rnn/layers.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/nn/rnn/layers_fast.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/nn/rnn/ordering.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/observable/renyi2/S2_operator.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/observable/renyi2/__init__.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/observable/renyi2/exact.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/observable/variance/__init__.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/observable/variance/variance_operator.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/operator/__init__.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/operator/_normal_order_utils.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/operator/_particle_number_conserving_fermionic/__init__.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/operator/_particle_number_conserving_fermionic/_conversion.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/operator/_pyscf_utils.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/operator/fermion.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/qsr/__init__.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/qsr/dataset.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/sampler/rules/__init__.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/vqs/__init__.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/experimental/vqs/io.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/graph/__init__.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/graph/_lattice_edge_logic.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/graph/abstract_graph.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/graph/common_lattices.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/graph/lattice.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/hilbert/__init__.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/hilbert/constraint/__init__.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/hilbert/constraint/base.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/hilbert/constraint/multiple.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/hilbert/constraint/sum.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/hilbert/constraint/sum_partition.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/hilbert/discrete_hilbert.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/hilbert/doubled_hilbert.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/hilbert/homogeneous.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/hilbert/index/__init__.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/hilbert/index/base.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/hilbert/index/constrained_generic.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/hilbert/index/constrained_sum.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/hilbert/index/constrained_sum_partitions.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/hilbert/index/unconstrained.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/hilbert/index/uniform_tensor.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/hilbert/random/__init__.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/hilbert/random/base.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/hilbert/random/doubled.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/hilbert/random/fock.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/hilbert/random/homogeneous.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/hilbert/random/qubit.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/hilbert/random/tensor_hilbert.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/hilbert/spin.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/hilbert/tensor_hilbert.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/hilbert/tensor_hilbert_discrete.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/jax/_grad.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/jax/_jacobian/__init__.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/jax/_jacobian/default_mode.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/jax/_jacobian/jacobian_dense.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/jax/_jacobian/jacobian_pytree.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/jax/_math.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/jax/_sort.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/jax/_sparse.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/jax/_utils_dtype.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/jax/_utils_tree.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/jax/_vjp.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/logging/__init__.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/logging/json_log.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/logging/runtime_log.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/logging/state_log.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/models/README.md +0 -0
- {netket-3.18 → netket-3.19.0}/netket/models/__init__.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/models/equivariant.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/models/fast_autoreg.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/models/full_space.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/models/gaussian.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/models/jastrow.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/models/mlp.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/models/ndm.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/models/rbm.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/models/slater.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/models/tensor_networks/__init__.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/models/tensor_networks/mpdo.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/models/tensor_networks/mps.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/models/utils.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/nn/blocks/__init__.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/nn/blocks/deepset.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/nn/blocks/mlp.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/nn/fast_masked_linear.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/nn/masked_linear.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/operator/_abstract_observable.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/operator/_abstract_super_operator.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/operator/_fermion2nd/utils.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/operator/_lazy.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/operator/_local_operator/compile_helpers.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/operator/_local_operator/convert.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/operator/_local_operator/helpers.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/operator/fermion.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/optimizer/__init__.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/optimizer/linear_operator.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/optimizer/preconditioner.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/optimizer/qgt/__init__.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/optimizer/qgt/common.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/optimizer/qgt/default.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/optimizer/solver/__init__.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/optimizer/solver/solvers.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/sampler/__init__.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/sampler/autoreg.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/sampler/exact.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/sampler/rules/__init__.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/sampler/rules/base.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/sampler/rules/continuous_gaussian.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/sampler/rules/exchange.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/sampler/rules/fermion_2nd.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/sampler/rules/fixed.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/sampler/rules/hamiltonian.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/sampler/rules/local.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/sampler/rules/local_numpy.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/sampler/rules/multiple.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/sampler/rules/tensor.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/stats/__init__.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/stats/_autocorr.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/tools/__init__.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/tools/_common.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/tools/_cpu_info.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/utils/_serialization.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/utils/api_utils.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/utils/deprecation.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/utils/display/repr.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/utils/float.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/utils/holomorphic.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/utils/model_frameworks/base.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/utils/moduletools.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/utils/optional_deps.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/utils/partial.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/utils/seed.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/utils/struct/utils.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/utils/summation.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/utils/types.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/vqs/full_summ/__init__.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/vqs/mc/__init__.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/vqs/mc/common.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/vqs/mc/kernels.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/vqs/mc/mc_mixed_state/__init__.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/vqs/mc/mc_mixed_state/expect.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/vqs/mc/mc_mixed_state/expect_chunked.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/vqs/mc/mc_state/__init__.py +0 -0
- {netket-3.18 → netket-3.19.0}/netket/vqs/mc/mc_state/expect_grad_chunked.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: NetKet
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.19.0
|
|
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/#
|
|
@@ -18,10 +18,11 @@ Classifier: Operating System :: Unix
|
|
|
18
18
|
Classifier: Programming Language :: Python :: 3
|
|
19
19
|
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
20
20
|
Requires-Python: >=3.11
|
|
21
|
+
Requires-Dist: einops>=0.8.1
|
|
21
22
|
Requires-Dist: equinox>=0.11.3
|
|
22
23
|
Requires-Dist: flax>=0.10.2
|
|
23
24
|
Requires-Dist: igraph>=0.10.0
|
|
24
|
-
Requires-Dist: jax<0.6,>=0.
|
|
25
|
+
Requires-Dist: jax<0.6,>=0.4.35
|
|
25
26
|
Requires-Dist: numba>=0.59
|
|
26
27
|
Requires-Dist: numpy<3.0,>=1.20
|
|
27
28
|
Requires-Dist: optax<0.3,>=0.2.2
|
|
@@ -31,8 +32,10 @@ Requires-Dist: rich>=12.0
|
|
|
31
32
|
Requires-Dist: scipy<2,>=1.5.3
|
|
32
33
|
Requires-Dist: sparse>=0.12.0
|
|
33
34
|
Requires-Dist: tqdm<5,>=4.60
|
|
35
|
+
Provides-Extra: cuda
|
|
36
|
+
Requires-Dist: jax[cuda12]; (sys_platform == 'linux') and extra == 'cuda'
|
|
34
37
|
Provides-Extra: dev
|
|
35
|
-
Requires-Dist: black==
|
|
38
|
+
Requires-Dist: black==25.1.0; extra == 'dev'
|
|
36
39
|
Requires-Dist: build>=1; extra == 'dev'
|
|
37
40
|
Requires-Dist: coverage>=5; extra == 'dev'
|
|
38
41
|
Requires-Dist: matplotlib>=3; extra == 'dev'
|
|
@@ -43,13 +46,16 @@ Requires-Dist: pytest-json-report>=1.3; extra == 'dev'
|
|
|
43
46
|
Requires-Dist: pytest-xdist[psutil]>=2; extra == 'dev'
|
|
44
47
|
Requires-Dist: pytest>=6; extra == 'dev'
|
|
45
48
|
Requires-Dist: qutip>=5; extra == 'dev'
|
|
46
|
-
Requires-Dist: ruff==0.
|
|
49
|
+
Requires-Dist: ruff==0.12.2; extra == 'dev'
|
|
47
50
|
Requires-Dist: wheel>=0.38.1; extra == 'dev'
|
|
48
51
|
Provides-Extra: docs
|
|
49
|
-
Requires-Dist:
|
|
52
|
+
Requires-Dist: ipywidgets>=8.1.7; extra == 'docs'
|
|
53
|
+
Requires-Dist: myst-nb<1.4,>=1.0; extra == 'docs'
|
|
50
54
|
Requires-Dist: myst-parser<4.1.0,>=2.0.0; extra == 'docs'
|
|
55
|
+
Requires-Dist: nbconvert>=7.16.6; extra == 'docs'
|
|
51
56
|
Requires-Dist: sphinx-autodoc-typehints<4.0,>=1.22; extra == 'docs'
|
|
52
57
|
Requires-Dist: sphinx-book-theme~=1.1.0; extra == 'docs'
|
|
58
|
+
Requires-Dist: sphinx-copybutton>=0.5.2; extra == 'docs'
|
|
53
59
|
Requires-Dist: sphinx-design>=0.4.0; extra == 'docs'
|
|
54
60
|
Requires-Dist: sphinxcontrib-fulltoc~=1.2.0; extra == 'docs'
|
|
55
61
|
Requires-Dist: sphinxcontrib-jsmath~=1.0.1; extra == 'docs'
|
|
@@ -59,9 +65,6 @@ Requires-Dist: h5py>=3.7.0; extra == 'extra'
|
|
|
59
65
|
Requires-Dist: openfermion>=1.0.0; extra == 'extra'
|
|
60
66
|
Requires-Dist: qutip>=4; extra == 'extra'
|
|
61
67
|
Requires-Dist: tensorboardx>=2.0.0; extra == 'extra'
|
|
62
|
-
Provides-Extra: mpi
|
|
63
|
-
Requires-Dist: mpi4jax>=0.3.9; extra == 'mpi'
|
|
64
|
-
Requires-Dist: mpi4py<5,>=3.0.1; extra == 'mpi'
|
|
65
68
|
Provides-Extra: pyscf
|
|
66
69
|
Requires-Dist: pyscf>=2.0; extra == 'pyscf'
|
|
67
70
|
Description-Content-Type: text/markdown
|
|
@@ -78,8 +81,7 @@ Description-Content-Type: text/markdown
|
|
|
78
81
|
[](https://codecov.io/gh/netket/netket)
|
|
79
82
|
[](https://join.slack.com/t/mlquantum/shared_invite/zt-19wibmfdv-LLRI6i43wrLev6oQX0OfOw)
|
|
80
83
|
|
|
81
|
-
NetKet is an open-source project delivering cutting-edge methods for the study
|
|
82
|
-
of many-body quantum systems with artificial neural networks and machine learning techniques.
|
|
84
|
+
NetKet is an open-source project delivering cutting-edge methods for the study of many-body quantum systems with artificial neural networks and machine learning techniques.
|
|
83
85
|
It is a Python library built on [JAX](https://github.com/google/jax).
|
|
84
86
|
|
|
85
87
|
NetKet is an affiliated project to [numFOCUS](https://numfocus.org).
|
|
@@ -93,55 +95,24 @@ NetKet is an affiliated project to [numFOCUS](https://numfocus.org).
|
|
|
93
95
|
|
|
94
96
|
## Installation and Usage
|
|
95
97
|
|
|
96
|
-
NetKet runs on MacOS and Linux. We recommend
|
|
97
|
-
It is often necessary to first update `pip` to a recent release (`>=20.3`) in order for upper compatibility bounds to be considered and avoid a broken installation.
|
|
98
|
-
For instructions on how to install the latest stable/beta release of NetKet see the [Get Started](https://www.netket.org/get_started/) page of our website or run the following command (Apple M1 users, follow that link for more instructions):
|
|
98
|
+
NetKet runs on MacOS and Linux and requires Python 3.11 or later. We recommend installing NetKet using `pip` or `uv`. **Do not use conda** as JAX has known issues when installed through conda.
|
|
99
99
|
|
|
100
100
|
```sh
|
|
101
101
|
pip install --upgrade pip
|
|
102
|
-
pip install
|
|
102
|
+
pip install netket
|
|
103
103
|
```
|
|
104
104
|
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
**With GPU support (Linux only):**
|
|
107
106
|
```sh
|
|
108
|
-
pip install
|
|
109
|
-
pip install 'git+https://github.com/netket/netket.git#egg=netket[all]'
|
|
107
|
+
pip install 'netket[cuda]'
|
|
110
108
|
```
|
|
111
109
|
|
|
112
|
-
|
|
113
|
-
can install the MPI-related dependencies by using `[mpi]` between square brackets.
|
|
114
|
-
|
|
110
|
+
**Development version:**
|
|
115
111
|
```sh
|
|
116
|
-
pip install
|
|
117
|
-
pip install --upgrade "netket[mpi]"
|
|
112
|
+
pip install git+https://github.com/netket/netket.git
|
|
118
113
|
```
|
|
119
114
|
|
|
120
|
-
|
|
121
|
-
However, if you do not have a working MPI compiler in your PATH this installation will most likely fail because
|
|
122
|
-
it will attempt to install `mpi4py`, which enables MPI support in netket.
|
|
123
|
-
|
|
124
|
-
The latest release of NetKet is always available on PyPi and can be installed with `pip`.
|
|
125
|
-
NetKet is also available on conda-forge, however the version available through `conda install`
|
|
126
|
-
can be slightly out of date compared to PyPi.
|
|
127
|
-
To check what is the latest version released on both distributions you can inspect the badges at the top of this readme.
|
|
128
|
-
|
|
129
|
-
### Extra dependencies
|
|
130
|
-
When installing `netket` with pip, you can pass the following extra variants as square brakets. You can install several of them by separating them with a comma.
|
|
131
|
-
- `"[dev]"`: installs development-related dependencies such as black, pytest and testing dependencies
|
|
132
|
-
- `"[mpi]"`: Installs `mpi4py` to enable multi-process parallelism. Requires a working MPI compiler in your path
|
|
133
|
-
- `"[extra]"`: Installs `tensorboardx` to enable logging to tensorboard, and openfermion to convert the QubitOperators.
|
|
134
|
-
- `"[all]"`: Installs all extra dependencies
|
|
135
|
-
|
|
136
|
-
### MPI Support
|
|
137
|
-
To enable MPI support you must install [mpi4jax](https://github.com/PhilipVinc/mpi4jax). Please note that we advise to install mpi4jax with the same tool (conda or pip) with which you install it's dependency `mpi4py`.
|
|
138
|
-
|
|
139
|
-
To check whether MPI support is enabled, check the flags
|
|
140
|
-
```python
|
|
141
|
-
>>> import netket
|
|
142
|
-
>>> netket.utils.mpi.available
|
|
143
|
-
True
|
|
144
|
-
```
|
|
115
|
+
For detailed installation instructions including GPU setup, see our [installation guide](https://netket.readthedocs.io/en/latest/install.html).
|
|
145
116
|
|
|
146
117
|
## Getting Started
|
|
147
118
|
|
netket-3.19.0/README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<img src="https://www.netket.org/logo/logo_simple.jpg" alt="logo" width="400"></img>
|
|
3
|
+
</div>
|
|
4
|
+
|
|
5
|
+
# __NetKet__
|
|
6
|
+
|
|
7
|
+
[](https://numfocus.org)
|
|
8
|
+
[](https://github.com/netket/netket/releases)
|
|
9
|
+
[](https://scipost.org/SciPostPhysCodeb.7/pdf)
|
|
10
|
+
[](https://codecov.io/gh/netket/netket)
|
|
11
|
+
[](https://join.slack.com/t/mlquantum/shared_invite/zt-19wibmfdv-LLRI6i43wrLev6oQX0OfOw)
|
|
12
|
+
|
|
13
|
+
NetKet is an open-source project delivering cutting-edge methods for the study of many-body quantum systems with artificial neural networks and machine learning techniques.
|
|
14
|
+
It is a Python library built on [JAX](https://github.com/google/jax).
|
|
15
|
+
|
|
16
|
+
NetKet is an affiliated project to [numFOCUS](https://numfocus.org).
|
|
17
|
+
|
|
18
|
+
- **Homepage:** <https://www.netket.org>
|
|
19
|
+
- **Citing:** <https://www.netket.org/cite/>
|
|
20
|
+
- **Documentation:** <https://netket.readthedocs.io/en/latest/index.html>
|
|
21
|
+
- **Tutorials:** <https://netket.readthedocs.io/en/latest/tutorials/gs-ising.html>
|
|
22
|
+
- **Examples:** <https://github.com/netket/netket/tree/master/Examples>
|
|
23
|
+
- **Source code:** <https://github.com/netket/netket>
|
|
24
|
+
|
|
25
|
+
## Installation and Usage
|
|
26
|
+
|
|
27
|
+
NetKet runs on MacOS and Linux and requires Python 3.11 or later. We recommend installing NetKet using `pip` or `uv`. **Do not use conda** as JAX has known issues when installed through conda.
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
pip install --upgrade pip
|
|
31
|
+
pip install netket
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**With GPU support (Linux only):**
|
|
35
|
+
```sh
|
|
36
|
+
pip install 'netket[cuda]'
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**Development version:**
|
|
40
|
+
```sh
|
|
41
|
+
pip install git+https://github.com/netket/netket.git
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
For detailed installation instructions including GPU setup, see our [installation guide](https://netket.readthedocs.io/en/latest/install.html).
|
|
45
|
+
|
|
46
|
+
## Getting Started
|
|
47
|
+
|
|
48
|
+
To get started with NetKet, we recommend you give a look at our [tutorials page](https://netket.readthedocs.io/en/latest/tutorials/gs-ising.html), by running them on your computer or on [Google Colaboratory](https://colab.research.google.com).
|
|
49
|
+
There are also many example scripts that you can download, run and edit that showcase some use-cases of NetKet, although they are not commented.
|
|
50
|
+
|
|
51
|
+
If you want to get in touch with us, feel free to open an issue or a discussion here on GitHub, or to join the MLQuantum slack group where several people involved with NetKet hang out. To join the slack channel just accept [this invitation](https://join.slack.com/t/mlquantum/shared_invite/zt-19wibmfdv-LLRI6i43wrLev6oQX0OfOw)
|
|
52
|
+
|
|
53
|
+
## License
|
|
54
|
+
|
|
55
|
+
[Apache License 2.0](https://github.com/netket/netket/blob/master/LICENSE)
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import inspect
|
|
2
|
+
|
|
3
|
+
from collections.abc import Callable
|
|
4
|
+
from functools import partial
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def ensure_accepts_kwargs(f: Callable, kwarg_name: str):
|
|
8
|
+
"""
|
|
9
|
+
Add a keyword argument to a function if it is not already present.
|
|
10
|
+
|
|
11
|
+
This is useful to make a function compatible with a certain interface, even if it does not
|
|
12
|
+
need the additional argument.
|
|
13
|
+
|
|
14
|
+
In this case, we use it to make the linear solver functions compatible with the QGT interface.
|
|
15
|
+
Some QGT solvers require the vector of local energies as an additional argument. The standard
|
|
16
|
+
solver interface however only requires the matrix and the right-hand side (jacobian @ local_energies).
|
|
17
|
+
|
|
18
|
+
Args:
|
|
19
|
+
f: The function to concretize.
|
|
20
|
+
kwarg_name: The name of the keyword argument to add.
|
|
21
|
+
|
|
22
|
+
Returns:
|
|
23
|
+
A new function that accepts the keyword argument `kwarg_name`.
|
|
24
|
+
"""
|
|
25
|
+
sig = inspect.signature(f)
|
|
26
|
+
params = sig.parameters
|
|
27
|
+
|
|
28
|
+
if kwarg_name in params:
|
|
29
|
+
return f
|
|
30
|
+
else:
|
|
31
|
+
to_concretize = f
|
|
32
|
+
if isinstance(f, partial):
|
|
33
|
+
to_concretize = f.func
|
|
34
|
+
|
|
35
|
+
def concretized_func(*args, **kwargs):
|
|
36
|
+
kwargs.pop(kwarg_name, None)
|
|
37
|
+
return to_concretize(*args, **kwargs)
|
|
38
|
+
|
|
39
|
+
if isinstance(f, partial):
|
|
40
|
+
concretized_func = partial(concretized_func, *f.args, **f.keywords)
|
|
41
|
+
|
|
42
|
+
return concretized_func
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
from collections.abc import Callable
|
|
2
|
+
from functools import partial
|
|
3
|
+
|
|
4
|
+
import jax
|
|
5
|
+
import jax.numpy as jnp
|
|
6
|
+
from jax.sharding import PositionalSharding
|
|
7
|
+
|
|
8
|
+
from netket import jax as nkjax
|
|
9
|
+
from netket.utils.types import Array
|
|
10
|
+
|
|
11
|
+
from netket._src.ngd.kwargs import ensure_accepts_kwargs
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@partial(
|
|
15
|
+
jax.jit,
|
|
16
|
+
static_argnames=(
|
|
17
|
+
"solver_fn",
|
|
18
|
+
"mode",
|
|
19
|
+
),
|
|
20
|
+
)
|
|
21
|
+
def _compute_sr_update(
|
|
22
|
+
O_L,
|
|
23
|
+
dv,
|
|
24
|
+
*,
|
|
25
|
+
diag_shift: float | Array,
|
|
26
|
+
solver_fn: Callable[[Array, Array], Array],
|
|
27
|
+
mode: str,
|
|
28
|
+
proj_reg: float | Array | None = None,
|
|
29
|
+
momentum: float | Array | None = None,
|
|
30
|
+
old_updates: Array | None = None,
|
|
31
|
+
params_structure,
|
|
32
|
+
):
|
|
33
|
+
# We concretize the solver function to ensure it accepts the additional argument `dv`.
|
|
34
|
+
# Typically solvers only accept the matrix and the right-hand side.
|
|
35
|
+
solver_fn = ensure_accepts_kwargs(solver_fn, "dv")
|
|
36
|
+
|
|
37
|
+
if (momentum is not None) or (old_updates is not None) or (proj_reg is not None):
|
|
38
|
+
raise ValueError("Not implemented")
|
|
39
|
+
|
|
40
|
+
# (np, #ns) x (#ns) -> (np) - where the sum over #ns is done automatically
|
|
41
|
+
F = O_L.T @ dv
|
|
42
|
+
|
|
43
|
+
# This does the contraction (np, #ns) x (#ns, np) -> (np, np).
|
|
44
|
+
matrix = O_L.T @ O_L
|
|
45
|
+
matrix_side = matrix.shape[-1] # * it can be ns or 2*ns, depending on mode
|
|
46
|
+
|
|
47
|
+
shifted_matrix = jax.lax.add(
|
|
48
|
+
matrix, diag_shift * jnp.eye(matrix_side, dtype=matrix.dtype)
|
|
49
|
+
)
|
|
50
|
+
updates = solver_fn(shifted_matrix, F, dv=dv)
|
|
51
|
+
|
|
52
|
+
# Some solvers return a tuple, some others do not.
|
|
53
|
+
if isinstance(updates, tuple):
|
|
54
|
+
updates, info = updates
|
|
55
|
+
if info is None:
|
|
56
|
+
info = {}
|
|
57
|
+
else:
|
|
58
|
+
info = {}
|
|
59
|
+
|
|
60
|
+
# If complex mode and we have complex parameters, we need
|
|
61
|
+
# To repack the real coefficients in order to get complex updates
|
|
62
|
+
if mode == "complex" and nkjax.tree_leaf_iscomplex(params_structure):
|
|
63
|
+
num_p = updates.shape[-1] // 2
|
|
64
|
+
updates = updates[:num_p] + 1j * updates[num_p:]
|
|
65
|
+
|
|
66
|
+
updates = jax.lax.with_sharding_constraint(
|
|
67
|
+
updates, PositionalSharding(jax.devices()).replicate()
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
return updates, old_updates, info
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
from collections.abc import Callable
|
|
2
|
+
from functools import partial
|
|
3
|
+
|
|
4
|
+
import jax
|
|
5
|
+
import jax.numpy as jnp
|
|
6
|
+
from jax.flatten_util import ravel_pytree
|
|
7
|
+
|
|
8
|
+
import netket.jax as nkjax
|
|
9
|
+
from netket.utils import timing
|
|
10
|
+
from netket.utils.types import Array, PyTree
|
|
11
|
+
|
|
12
|
+
from netket._src.ngd.sr import _compute_sr_update
|
|
13
|
+
from netket._src.ngd.srt import _compute_srt_update
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@partial(jax.jit, static_argnames=("mode",))
|
|
17
|
+
def _prepare_input(
|
|
18
|
+
O_L,
|
|
19
|
+
local_grad,
|
|
20
|
+
*,
|
|
21
|
+
mode: str,
|
|
22
|
+
) -> tuple[jax.Array, jax.Array]:
|
|
23
|
+
r"""
|
|
24
|
+
Prepare the input for the SR/SRt solvers.
|
|
25
|
+
|
|
26
|
+
The local eneriges and the jacobian are reshaped, centered and normalized by the number of Monte Carlo samples.
|
|
27
|
+
The complex case is handled by concatenating the real and imaginary parts of the jacobian and the local energies.
|
|
28
|
+
|
|
29
|
+
We use [Re_x1, Im_x1, Re_x2, Im_x2, ...] so that shards are contiguous, and jax can keep track of the sharding information.
|
|
30
|
+
This format is applied both to the jacobian and to the vector.
|
|
31
|
+
|
|
32
|
+
Args:
|
|
33
|
+
O_L: The jacobian of the ansatz.
|
|
34
|
+
local_grad: The local energies.
|
|
35
|
+
mode: The mode of the jacobian: `'real'` or `'complex'`.
|
|
36
|
+
|
|
37
|
+
Returns:
|
|
38
|
+
The reshaped jacobian and the reshaped local energies.
|
|
39
|
+
"""
|
|
40
|
+
N_mc = O_L.shape[0]
|
|
41
|
+
|
|
42
|
+
local_grad = local_grad.flatten()
|
|
43
|
+
de = local_grad - jnp.mean(local_grad)
|
|
44
|
+
|
|
45
|
+
O_L = O_L / jnp.sqrt(N_mc)
|
|
46
|
+
dv = 2.0 * de / jnp.sqrt(N_mc)
|
|
47
|
+
|
|
48
|
+
if mode == "complex":
|
|
49
|
+
# Concatenate the real and imaginary derivatives of the ansatz
|
|
50
|
+
# (#ns, 2, np) -> (#ns*2, np)
|
|
51
|
+
O_L = jax.lax.collapse(O_L, 0, 2)
|
|
52
|
+
|
|
53
|
+
# (#ns, 2) -> (#ns*2)
|
|
54
|
+
dv2 = jnp.stack([jnp.real(dv), jnp.imag(dv)], axis=-1)
|
|
55
|
+
dv = jax.lax.collapse(dv2, 0, 2)
|
|
56
|
+
elif mode == "real":
|
|
57
|
+
dv = dv.real
|
|
58
|
+
else:
|
|
59
|
+
raise NotImplementedError()
|
|
60
|
+
return O_L, dv
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
@timing.timed
|
|
64
|
+
@partial(
|
|
65
|
+
jax.jit,
|
|
66
|
+
static_argnames=(
|
|
67
|
+
"log_psi",
|
|
68
|
+
"solver_fn",
|
|
69
|
+
"mode",
|
|
70
|
+
"chunk_size",
|
|
71
|
+
"use_ntk",
|
|
72
|
+
),
|
|
73
|
+
)
|
|
74
|
+
def _sr_srt_common(
|
|
75
|
+
log_psi,
|
|
76
|
+
local_grad,
|
|
77
|
+
parameters,
|
|
78
|
+
model_state,
|
|
79
|
+
samples,
|
|
80
|
+
*,
|
|
81
|
+
diag_shift: float | Array,
|
|
82
|
+
solver_fn: Callable[[Array, Array], Array],
|
|
83
|
+
mode: str,
|
|
84
|
+
proj_reg: float | Array | None = None,
|
|
85
|
+
momentum: float | Array | None = None,
|
|
86
|
+
old_updates: PyTree | None = None,
|
|
87
|
+
chunk_size: int | None = None,
|
|
88
|
+
use_ntk: bool = False,
|
|
89
|
+
):
|
|
90
|
+
r"""
|
|
91
|
+
Compute the SR/Natural gradient update for the model specified by
|
|
92
|
+
`log_psi({parameters, model_state}, samples)` and the local gradient contributions `local_grad`.
|
|
93
|
+
|
|
94
|
+
Uses a code equivalent to QGTJacobianDense by default, or with the NTK/MinSR if `use_ntk` is True.
|
|
95
|
+
|
|
96
|
+
Args:
|
|
97
|
+
log_psi: The log of the wavefunction.
|
|
98
|
+
local_grad: The local values of the estimator.
|
|
99
|
+
parameters: The parameters of the model.
|
|
100
|
+
model_state: The state of the model.
|
|
101
|
+
diag_shift: The diagonal shift of the stochastic reconfiguration matrix. Typical values are 1e-4 ÷ 1e-3. Can also be an optax schedule.
|
|
102
|
+
proj_reg: Weight before the matrix `1/N_samples \\bm{1} \\bm{1}^T` used to regularize the linear solver in SPRING.
|
|
103
|
+
momentum: Momentum used to accumulate updates in SPRING.
|
|
104
|
+
linear_solver_fn: Callable to solve the linear problem associated to the updates of the parameters.
|
|
105
|
+
mode: The mode used to compute the jacobian of the variational state. Can be `'real'` or `'complex'` (defaults to the dtype of the output of the model).
|
|
106
|
+
|
|
107
|
+
Returns:
|
|
108
|
+
The new parameters, the old updates, and the info dictionary.
|
|
109
|
+
"""
|
|
110
|
+
_, unravel_params_fn = ravel_pytree(parameters)
|
|
111
|
+
_params_structure = jax.tree_util.tree_map(
|
|
112
|
+
lambda x: jax.ShapeDtypeStruct(x.shape, x.dtype), parameters
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
jacobians = nkjax.jacobian(
|
|
116
|
+
log_psi,
|
|
117
|
+
parameters,
|
|
118
|
+
samples,
|
|
119
|
+
model_state,
|
|
120
|
+
mode=mode,
|
|
121
|
+
dense=True,
|
|
122
|
+
center=True,
|
|
123
|
+
chunk_size=chunk_size,
|
|
124
|
+
) # jacobian is centered
|
|
125
|
+
|
|
126
|
+
O_L, dv = _prepare_input(jacobians, local_grad, mode=mode)
|
|
127
|
+
|
|
128
|
+
if old_updates is None and momentum is not None:
|
|
129
|
+
old_updates = jnp.zeros(jacobians.shape[-1], dtype=jacobians.dtype)
|
|
130
|
+
|
|
131
|
+
compute_update = _compute_srt_update if use_ntk else _compute_sr_update
|
|
132
|
+
|
|
133
|
+
# TODO: Add support for proj_reg and momentum
|
|
134
|
+
# At the moment SR does not support momentum, proj_reg.
|
|
135
|
+
# We raise an error if they are passed with a value different from None.
|
|
136
|
+
updates, old_updates, info = compute_update(
|
|
137
|
+
O_L,
|
|
138
|
+
dv,
|
|
139
|
+
diag_shift=diag_shift,
|
|
140
|
+
solver_fn=solver_fn,
|
|
141
|
+
mode=mode,
|
|
142
|
+
proj_reg=proj_reg,
|
|
143
|
+
momentum=momentum,
|
|
144
|
+
old_updates=old_updates,
|
|
145
|
+
params_structure=_params_structure,
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
return unravel_params_fn(updates), old_updates, info
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
sr = partial(_sr_srt_common, use_ntk=False)
|
|
152
|
+
|
|
153
|
+
srt = partial(_sr_srt_common, use_ntk=True)
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
from collections.abc import Callable
|
|
2
|
+
from functools import partial
|
|
3
|
+
|
|
4
|
+
import jax
|
|
5
|
+
import jax.numpy as jnp
|
|
6
|
+
from jax.sharding import PositionalSharding
|
|
7
|
+
|
|
8
|
+
from netket import jax as nkjax
|
|
9
|
+
from netket import config
|
|
10
|
+
from netket.utils import timing
|
|
11
|
+
from netket.utils.types import Array
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@timing.timed
|
|
15
|
+
@partial(
|
|
16
|
+
jax.jit,
|
|
17
|
+
static_argnames=(
|
|
18
|
+
"solver_fn",
|
|
19
|
+
"mode",
|
|
20
|
+
),
|
|
21
|
+
)
|
|
22
|
+
def _compute_srt_update(
|
|
23
|
+
O_L,
|
|
24
|
+
dv,
|
|
25
|
+
*,
|
|
26
|
+
diag_shift: float | Array,
|
|
27
|
+
solver_fn: Callable[[Array, Array], Array],
|
|
28
|
+
mode: str,
|
|
29
|
+
proj_reg: float | Array | None = None,
|
|
30
|
+
momentum: float | Array | None = None,
|
|
31
|
+
old_updates: Array | None = None,
|
|
32
|
+
params_structure,
|
|
33
|
+
):
|
|
34
|
+
if momentum is not None:
|
|
35
|
+
dv -= momentum * (O_L @ old_updates)
|
|
36
|
+
|
|
37
|
+
# (#ns, np) -> (ns, #np)
|
|
38
|
+
O_LT = O_L
|
|
39
|
+
if config.netket_experimental_sharding:
|
|
40
|
+
nkjax.sharding.pad_axis_for_sharding(O_LT, axis=1, padding_value=0.0)
|
|
41
|
+
O_LT = jax.lax.with_sharding_constraint(
|
|
42
|
+
O_LT,
|
|
43
|
+
PositionalSharding(jax.devices()).reshape(1, -1),
|
|
44
|
+
)
|
|
45
|
+
dv = jax.lax.with_sharding_constraint(
|
|
46
|
+
dv, PositionalSharding(jax.devices()).replicate()
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
# This does the contraction (ns, #np) x (#np, ns) -> (ns, ns).
|
|
50
|
+
# When using sharding the sum over #ns is done automatically.
|
|
51
|
+
# When using MPI we need to do it manually with an allreduce_sum.
|
|
52
|
+
matrix = O_LT @ O_LT.T
|
|
53
|
+
matrix_side = matrix.shape[-1] # * it can be ns or 2*ns, depending on mode
|
|
54
|
+
|
|
55
|
+
shifted_matrix = jax.lax.add(
|
|
56
|
+
matrix, diag_shift * jnp.eye(matrix_side, dtype=matrix.dtype)
|
|
57
|
+
)
|
|
58
|
+
# replicate
|
|
59
|
+
|
|
60
|
+
if proj_reg is not None:
|
|
61
|
+
shifted_matrix = jax.lax.add(
|
|
62
|
+
shifted_matrix, jnp.full_like(shifted_matrix, proj_reg / matrix_side)
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
aus_vector = solver_fn(shifted_matrix, dv)
|
|
66
|
+
|
|
67
|
+
# Some solvers return a tuple, some others do not.
|
|
68
|
+
if isinstance(aus_vector, tuple):
|
|
69
|
+
aus_vector, info = aus_vector
|
|
70
|
+
if info is None:
|
|
71
|
+
info = {}
|
|
72
|
+
else:
|
|
73
|
+
info = {}
|
|
74
|
+
|
|
75
|
+
# (np, #ns) x (#ns) -> (np).
|
|
76
|
+
updates = O_L.T @ aus_vector
|
|
77
|
+
if momentum is not None:
|
|
78
|
+
updates += momentum * old_updates
|
|
79
|
+
old_updates = updates
|
|
80
|
+
|
|
81
|
+
# If complex mode and we have complex parameters, we need
|
|
82
|
+
# To repack the real coefficients in order to get complex updates
|
|
83
|
+
if mode == "complex" and nkjax.tree_leaf_iscomplex(params_structure):
|
|
84
|
+
num_p = updates.shape[-1] // 2
|
|
85
|
+
updates = updates[:num_p] + 1j * updates[num_p:]
|
|
86
|
+
|
|
87
|
+
if config.netket_experimental_sharding:
|
|
88
|
+
out_shardings = (
|
|
89
|
+
PositionalSharding(jax.devices()).replicate().reshape((1,) * updates.ndim)
|
|
90
|
+
).replicate()
|
|
91
|
+
updates = jax.lax.with_sharding_constraint(updates, out_shardings)
|
|
92
|
+
|
|
93
|
+
return updates, old_updates, info
|