profit.util.halton

Halton low discrepancy sequence.

This snippet implements the Halton sequence following the generalization of a sequence of Van der Corput in n-dimensions.


MIT License

Copyright (c) 2017 Pamphile Tupui ROY

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Module Contents

Functions

primes_from_2_to(n)

Prime number from 2 to n.

van_der_corput(n_sample[, base])

Van der Corput sequence.

halton(n_sample, dim)

Halton sequence.

profit.util.halton.primes_from_2_to(n)[source]

Prime number from 2 to n.

From StackOverflow.

Parameters:

n (int) – sup bound with n >= 6.

Returns:

primes in 2 <= p < n.

Return type:

list

profit.util.halton.van_der_corput(n_sample, base=2)[source]

Van der Corput sequence.

Parameters:
  • n_sample (int) – number of element of the sequence.

  • base (int) – base of the sequence.

Returns:

sequence of Van der Corput.

Return type:

list (n_samples,)

profit.util.halton.halton(n_sample, dim)[source]

Halton sequence.

Parameters:
  • n_sample (int) – number of samples.

  • dim (int) – dimension

Returns:

sequence of Halton.

Return type:

array_like (n_samples, n_features)