Skip to content

Commit

Permalink
Efficient hyperbolic set added
Browse files Browse the repository at this point in the history
  • Loading branch information
NovakLBUT authored Apr 8, 2022
1 parent 6c58ecf commit f7782b2
Showing 1 changed file with 41 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,47 @@ def calculate_total_degree_recursive(N, w, rows):
row_start = row_end + 1

return subset


@staticmethod
def calculate_hyperbolic_set(inputs_number, degree,q):

xmono=np.zeros(inputs_number)
X=[]
X.append(xmono)

while np.sum(xmono)<=degree:
# generate multi-indices one by one
x=np.array(xmono)
i = 0
for j in range ( inputs_number, 0, -1 ):
if ( 0 < x[j-1] ):
i = j
break

if ( i == 0 ):
x[inputs_number-1] = 1
xmono=x
else:
if ( i == 1 ):
t = x[0] + 1
im1 = inputs_number
if ( 1 < i ):
t = x[i-1]
im1 = i - 1

x[i-1] = 0
x[im1-1] = x[im1-1] + 1
x[inputs_number-1] = x[inputs_number-1] + t - 1

xmono=x

# check the hyperbolic criterion
if (np.round(np.sum(xmono**q)**(1/q), 4) <= degree):
X.append(xmono)


return(np.array(X).astype(int))

@staticmethod
def calculate_tensor_product_set(inputs_number, degree):
orders = np.arange(0, degree + 1, 1).tolist()
Expand Down

0 comments on commit f7782b2

Please sign in to comment.