HaselgroveSequence

(Source code, png, hires.png, pdf)

../../_images/openturns-HaselgroveSequence-1.png
class HaselgroveSequence(*args)

Haselgrove sequence.

Available constructors:

HaselgroveSequence(dimension=1)

HaselgroveSequence(base)

Parameters:

dimension : positive int

Dimension of the points.

base : sequence of positive float

Sequence of positive real values linearly independent over the integer ring, i.e. no linear combination with integer coefficients of these values can be zero excepted if all the coefficients are zero. The dimension of the sequence is given by the dimension of the base.

Examples

>>> import openturns as ot
>>> sequence = ot.HaselgroveSequence(2)
>>> print(sequence.generate(5))
0 : [ 0.414214  0.732051  ]
1 : [ 0.828427  0.464102  ]
2 : [ 0.242641  0.196152  ]
3 : [ 0.656854  0.928203  ]
4 : [ 0.0710678 0.660254  ]

Methods

ComputeStarDiscrepancy() Compute the star discrepancy of a sample uniformly distributed over [0, 1).
generate(*args) Generate a sample of pseudo-random vectors of numbers uniformly distributed over [0, 1).
getClassName() Accessor to the object’s name.
getDimension() Accessor to the dimension of the points of the low discrepancy sequence.
getId() Accessor to the object’s id.
getName() Accessor to the object’s name.
getShadowedId() Accessor to the object’s shadowed id.
getVisibility() Accessor to the object’s visibility state.
hasName() Test if the object is named.
hasVisibleName() Test if the object has a distinguishable name.
initialize(dimension) Initialize the sequence.
setName(name) Accessor to the object’s name.
setShadowedId(id) Accessor to the object’s shadowed id.
setVisibility(visible) Accessor to the object’s visibility state.
__init__(*args)
ComputeStarDiscrepancy()

Compute the star discrepancy of a sample uniformly distributed over [0, 1).

Parameters:

sample : 2-d sequence of float

Returns:

starDiscrepancy : float

Star discrepancy of a sample uniformly distributed over [0, 1).

Examples

>>> import openturns as ot
>>> # Create a sequence of 3 points of 2 dimensions
>>> sequence = ot.LowDiscrepancySequence(ot.SobolSequence(2))
>>> sample = sequence.generate(16)
>>> print(sequence.computeStarDiscrepancy(sample))
0.12890625
>>> sample = sequence.generate(64)
>>> print(sequence.computeStarDiscrepancy(sample))
0.0537109375
generate(*args)

Generate a sample of pseudo-random vectors of numbers uniformly distributed over [0, 1).

Parameters:

size : int

Number of points to be generated. Default is 1.

Returns:

sample : Sample

Sample of pseudo-random vectors of numbers uniformly distributed over [0, 1).

Examples

>>> import openturns as ot
>>> # Create a sequence of 3 points of 2 dimensions
>>> sequence = ot.LowDiscrepancySequence(ot.SobolSequence(2))
>>> print(sequence.generate(3))
0 : [ 0.5  0.5  ]
1 : [ 0.75 0.25 ]
2 : [ 0.25 0.75 ]
getClassName()

Accessor to the object’s name.

Returns:

class_name : str

The object class name (object.__class__.__name__).

getDimension()

Accessor to the dimension of the points of the low discrepancy sequence.

Returns:

dimension : int

Dimension of the points of the low discrepancy sequence.

getId()

Accessor to the object’s id.

Returns:

id : int

Internal unique identifier.

getName()

Accessor to the object’s name.

Returns:

name : str

The name of the object.

getShadowedId()

Accessor to the object’s shadowed id.

Returns:

id : int

Internal unique identifier.

getVisibility()

Accessor to the object’s visibility state.

Returns:

visible : bool

Visibility flag.

hasName()

Test if the object is named.

Returns:

hasName : bool

True if the name is not empty.

hasVisibleName()

Test if the object has a distinguishable name.

Returns:

hasVisibleName : bool

True if the name is not empty and not the default one.

initialize(dimension)

Initialize the sequence.

Parameters:

dimension : int

Dimension of the points of the low discrepancy sequence.

Examples

>>> import openturns as ot
>>> # Create a sequence of 3 points of 2 dimensions
>>> sequence = ot.LowDiscrepancySequence(ot.SobolSequence(2))
>>> print(sequence.generate(3))
0 : [ 0.5  0.5  ]
1 : [ 0.75 0.25 ]
2 : [ 0.25 0.75 ]
>>> print(sequence.generate(3))
0 : [ 0.375 0.375 ]
1 : [ 0.875 0.875 ]
2 : [ 0.625 0.125 ]
>>> sequence.initialize(2)
>>> print(sequence.generate(3))
0 : [ 0.5  0.5  ]
1 : [ 0.75 0.25 ]
2 : [ 0.25 0.75 ]
setName(name)

Accessor to the object’s name.

Parameters:

name : str

The name of the object.

setShadowedId(id)

Accessor to the object’s shadowed id.

Parameters:

id : int

Internal unique identifier.

setVisibility(visible)

Accessor to the object’s visibility state.

Parameters:

visible : bool

Visibility flag.