1%feature("docstring") OT::HyperbolicAnisotropicEnumerateFunction
2"Hyperbolic and anisotropic enumerate function.
3
4Available constructors:
5    HyperbolicAnisotropicEnumerateFunction(*dim*)
6
7    HyperbolicAnisotropicEnumerateFunction(*dim, q*)
8
9    HyperbolicAnisotropicEnumerateFunction(*weight*)
10
11    HyperbolicAnisotropicEnumerateFunction(*weight, q*)
12
13Parameters
14----------
15dim : integer
16    Dimension of the :class:`~openturns.EnumerateFunction`. *dim* must be equal
17    to the dimension of the :class:`~openturns.OrthogonalBasis`.
18q : float
19    Correspond to the q-quasi norm parameter. If not precised, :math:`q = 0.4`.
20weight : sequence of float
21    Weights of the indices in each dimension. If not precised, all weights are
22    equals to :math:`w_i = 1`.
23
24See also
25--------
26EnumerateFunction, LinearEnumerateFunction
27
28Notes
29-----
30The hyperbolic truncation strategy is inspired by the so-called sparsity-of-
31effects principle, which states that most models are principally governed by
32main effects and low-order interactions. Accordingly, one wishes to define an
33enumeration strategy which first selects those multi-indices related to main
34effects, i.e. with a reasonably small number of nonzero components, prior to
35selecting those associated with higher-order interactions.
36
37For any real number :math:`q \in ]0, 1]`, one defines the anisotropic hyperbolic
38norm of a multi-index :math:`\vect{\alpha}` by:
39
40.. math::
41
42    \| \vect{\alpha} \|_{\vect{w}, q} = \left( \sum_{i=1}^{n_X} w_i \alpha_i^q \right)^{1/q}
43
44where :math:`n_X` is the number of input variables and :math:`(w_1, \dots , w_{n_X})` is a sequence of
45real positive numbers called weights.
46Functions of input variables with smaller weights are selected first
47for the functional basis.
48
49Examples
50--------
51
52In the following example, we create an hyperbolic enumerate function
53in 2 dimension with a quasi-norm equal to 0.5.
54Notice, for example, that the function with multi-index [3,0]
55come before [1,1], although the sum of marginal indices is lower: this
56is the result of the hyperbolic quasi-norm.
57
58>>> import openturns as ot
59>>> enumerateFunction = ot.HyperbolicAnisotropicEnumerateFunction(2, 0.5)
60>>> for i in range(10):
61...     print(enumerateFunction(i))
62[0,0]
63[1,0]
64[0,1]
65[2,0]
66[0,2]
67[3,0]
68[0,3]
69[1,1]
70[4,0]
71[0,4]
72
73In the following example, we create an hyperbolic enumerate function
74in 3 dimensions based on the weights [1,2,4].
75Notice that the first marginal index, with weight equal to 1, comes
76first in the enumeration.
77
78>>> import openturns as ot
79>>> enumerateFunction = ot.HyperbolicAnisotropicEnumerateFunction([1, 2, 4])
80>>> for i in range(20):
81...     print('i=', i, 'enum=', enumerateFunction(i))
82i= 0 enum= [0,0,0]
83i= 1 enum= [1,0,0]
84i= 2 enum= [0,1,0]
85i= 3 enum= [2,0,0]
86i= 4 enum= [3,0,0]
87i= 5 enum= [0,0,1]
88i= 6 enum= [0,2,0]
89i= 7 enum= [4,0,0]
90i= 8 enum= [5,0,0]
91i= 9 enum= [0,3,0]
92i= 10 enum= [6,0,0]
93i= 11 enum= [7,0,0]
94i= 12 enum= [0,0,2]
95i= 13 enum= [0,4,0]
96i= 14 enum= [8,0,0]
97i= 15 enum= [1,1,0]
98i= 16 enum= [9,0,0]
99i= 17 enum= [0,5,0]
100i= 18 enum= [10,0,0]
101i= 19 enum= [11,0,0]
102"
103
104// ---------------------------------------------------------------------
105
106%feature("docstring") OT::HyperbolicAnisotropicEnumerateFunction::getQ
107"Accessor to the norm.
108
109Returns
110-------
111q : float
112    q-quasi norm parameter."
113
114// ---------------------------------------------------------------------
115
116%feature("docstring") OT::HyperbolicAnisotropicEnumerateFunction::getWeight
117"Accessor to the weights.
118
119Returns
120-------
121w : :class:`~openturns.Point`
122    Weights of the indices in each dimension."
123
124// ---------------------------------------------------------------------
125
126%feature("docstring") OT::HyperbolicAnisotropicEnumerateFunction::setQ
127"Accessor to the norm.
128
129Parameters
130----------
131q : float
132    q-quasi norm parameter."
133
134// ---------------------------------------------------------------------
135
136%feature("docstring") OT::HyperbolicAnisotropicEnumerateFunction::setWeight
137"Accessor to the weights.
138
139Parameters
140----------
141w : sequence of float
142    Weights of the indices in each dimension."
143