Bug Regarding Asymmetric Total Order Basis

When creating an asymmetric total order basis, the resulting index set plot displays as symmetric with the larger input order.

basis = eq.Basis('total-order', orders=[5,15])
basis.plot_index_set()

The following might work:

total_order = basis.elements

# To be added to basis.py in total_order_basis()
bool_entries = np.ones((total_order.shape[0]), dtype=bool) # True
for j in range(total_order.shape[0]):
    for d in range(total_order.shape[1]):
        if total_order[j,d] > basis.orders[d]:
            bool_entries[j] = False

total_order_new = total_order[bool_entries,:]

# Check
basis.elements = total_order_new
basis.plot_index_set()

new

Potential suggestion for vectorised approach using numpy.

basis = eq.Basis('total-order', orders=[5,15])
total_order = basis.elements

valid = np.prod(total_order <= basis.orders, axis=1).astype(bool)
total_order_new = total_order[valid, :]

# Check
basis.elements = total_order_new
basis.plot_index_set()

output

1 Like

So much more elegant! Cheers @bubald.