Skip to content

Add Kronecker sampler as well as tests and a demonstrating notebook - #326

Open
Samuel-Vangu wants to merge 1 commit into
theochem:masterfrom
Samuel-Vangu:feature/add-kronecker-sampler
Open

Add Kronecker sampler as well as tests and a demonstrating notebook#326
Samuel-Vangu wants to merge 1 commit into
theochem:masterfrom
Samuel-Vangu:feature/add-kronecker-sampler

Conversation

@Samuel-Vangu

Copy link
Copy Markdown

Adds a Kronecker sampling class for integration on (hyper)cubic grids,
following up on the discussion in #322.

What's included

  • src/grid/kronecker.py: Kronecker(n_points, dimension, seed=None, randomize=True, origin=None, axes=None). Generates the sequence
    $x_i = {i \cdot \sqrt{p_j}}$ using the square roots of the first $d$ primes
    (via sympy.sieve) as irrational multipliers; randomize=False gives the
    deterministic sequence (whose first point is always the origin),
    randomize=True applies a random Cranley-Patterson shift. No power-of-2
    or other special constraint on n_points is required. Supports mapping
    onto an arbitrary parallelepiped via origin/axes.
  • src/grid/tests/test_kronecker.py: tests covering validation, weights,
    domain mapping, integration accuracy, reproducibility, and properties
    specific to Kronecker sequences (construction verified directly against
    an independent calculation with sqrt(2)/sqrt(3)/sqrt(5), origin as first
    point when unrandomized, and the prefix/nesting property -- an N-point
    design is always an exact prefix of a larger design with the same seed).
image
  • An example notebook in examples/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant