Skip to content

puncturedfem.MultiIndex

Integer multi-index with two components.

Attributes:

Name Type Description
x int

First component of the multi-index.

y int

Second component of the multi-index.

order int

Order of the multi-index.

idx int

Unique identifier of the multi-index.

Notes

  • A lexicographical ordering of the multi-indices can be obtained by associating a unique index k to each multi-index alpha. The index k is given by k = alpha_2 + ( m + 1 choose 2 ) where m = alpha_1 + alpha_2.
  • The multi-index alpha can be recovered from the index k by setting alpha_1 = m - k + ( m + 1 choose 2 ) and alpha_2 = k - ( m + 1 choose 2 ), where m = floor( ( -1 + sqrt(1 + 8k) ) / 2 ).

__add__(other)

Define the operation self + other.

Parameters:

Name Type Description Default
other object

Object to add to self. Must be a MultiIndex.

required

__eq__(other)

Return True iff self and other have the same multi-index.

Parameters:

Name Type Description Default
other object

Object to compare with self. Must be a MultiIndex.

required

Returns:

Type Description
bool

True iff self and other are the same multi-index.

__init__(alpha=None)

Integer multi-index with two components.

Parameters:

Name Type Description Default
alpha list[int], optional

List of two integers representing the multi-index. Default is None.

None

copy()

Return a copy of self.

Returns:

Type Description
MultiIndex

A copy of self.

set(alpha)

Set the multi-index to alpha.

Parameters:

Name Type Description Default
alpha list[int]

List of two integers representing the multi-index.

required

set_from_idx(idx)

Set the multi-index from its index.

idx : int Index identified with multi-index via lexicographical ordering.

validate(alpha)

Validate the multi-index alpha.