Create an Empty Multi-Index Set#

import minterpy as mp
import numpy as np

An empty MultiIndexSet contains an empty array as its exponents. Such a set may arise from some set operations involving MultiIndexSet.

This guide demonstrates how to create such an array and the corresponding conventions.

Construction#

An empty MultiIndexSet instance may be constructed by passing an empty two-dimensional array as the exponents to the default constructor:

exponent = np.empty((0, 0), dtype=int)
mi = mp.MultiIndexSet(exponent, lp_degree=1.0)
print(mi)
MultiIndexSet(m=0, n=None, p=1.0)
[]

Note that just like any other MultiIndexSet instances, the \(l_p\)-degree must be specified during the construction.

The cardinality of an empty set is 0:

len(mi)
0

An empty MultiIndexSet may have 0 spatial dimension:

mi.spatial_dimension
0

An empty two-dimensional array whose dimension other than 0 may also be used as the exponent of an empty MultiIndexSet. In that case, the spatial dimension follows the shape of the empty array. For example:

exponent = np.empty((0, 3), dtype=int)
mi = mp.MultiIndexSet(exponent, lp_degree=1.0)
mi.spatial_dimension
3

Note

As a shortcut a two-dimensional array np.array([[]]) may be passed to construct an empty MultiIndexSet. Strictly speaking, the shape of np.array([[]]) is (1, 0). The default constructor, however, yields the exponents of shape (0, 0).

To summarize, the main properties of an empty MultiIndexSet instance are:

  • exponents: a two-dimensional empty array as specified.

  • lp_degree: as specified during construction (float).

  • poly_degree: None (it cannot be computed).

  • spatial_dimension: according to the value of the second dimension of the given empty array (may be 0, int).

  • is_complete: False a priori.

  • is_downward_closed: False a priori.

  • __len__(): 0 (i.e., zero cardinality).

Union#

The union between any set with an empty set of the same dimension, yields the original set:

mi_1 = mp.MultiIndexSet(np.array([[0, 0, 0], [1, 0, 1]]), lp_degree=1.0)
print(mi_1)
MultiIndexSet(m=3, n=2, p=1.0)
[[0 0 0]
 [1 0 1]]
print(mi_1 | mi)
MultiIndexSet(m=3, n=2, p=1.0)
[[0 0 0]
 [1 0 1]]

If the empty set is of higher dimension, the dimension of the original set will be expanded:

mi_2 = mp.MultiIndexSet(np.empty((0, 5)), lp_degree=1.0)
print(mi_1 | mi_2)
MultiIndexSet(m=5, n=2, p=1.0)
[[0 0 0 0 0]
 [1 0 1 0 0]]

In fact, the resulting dimension is the maximum between the two operands as the convention of union between two MultiIndexSet’s. The same convention applies to the resulting \(l_p\)-degree.

Multiplication#

The multiplication between any set with an empty set of the same dimension, yields the empty set:

print(mi_1 * mi)
MultiIndexSet(m=3, n=None, p=1.0)
[]

Following the convention of multiplication between two MultiIndexSet’s, if the spatial dimensions of the two sets differ, the resulting set has the higher dimension. Similar convention applies to the \(l_p\)-degree of the product set.

Set membership#

The empty set is a subset of every set. For example:

mi.is_subset(mi_1)
True

Every set is a superset of the empty set. For example:

mi_1.is_superset(mi)
True

Disjoint set#

Every set is disjoint with the empty set, including the empty set itself:

mi.is_disjoint(mi)
True
mi_1.is_disjoint(mi)
True