clifford.BasisVectorIds¶
- class clifford.BasisVectorIds(blade_ids: Sequence[IdT])[source]¶
Stores ids for the ordered set of basis vectors, typically integers.
Provides helpers to convert between bitmaps indicating which vectors are present in a blade, and tuples of the original ids.
For example:
>>> ids = BasisVectorIds([11, 22, 33]) >>> ids.bitmap_as_tuple(0b110) (22, 33) >>> sign, bitmap = ids.tuple_as_sign_and_bitmap((33, 22)) >>> assert sign, bitmap == (-1, 0b110)
- bitmap_as_tuple(bitmap: int) Tuple[IdT][source]¶
Convert a bitmap representation into a tuple of ids.
- tuple_as_sign_and_bitmap(blade: Tuple[IdT]) Tuple[int, int][source]¶
Convert a blade from a tuple of ids into a bitmap representation.
- order_from_tuples(blades: Sequence[Tuple[IdT]]) BasisBladeOrder[source]¶
Produce an ordering from a set of tuples.
This is the inverse of
order_as_tuples().>>> ids = BasisVectorIds(['x', 'y']) >>> ids.order_from_tuples([(), ('y',), ('x', 'y'), ('x',)]) BasisBladeOrder([0b00, 0b10, 0b11, 0b01])
- order_as_tuples(ordering: BasisBladeOrder) List[Tuple[IdT]][source]¶
Represent an ordering with these ids.
This is the inverse of
order_from_tuples().>>> ids = BasisVectorIds(['x', 'y']) >>> ids.order_as_tuples(BasisBladeOrder([0b00, 0b10, 0b11, 0b01])) [(), ('y',), ('x', 'y'), ('x',)]
- classmethod ordered_integers(n: int, *, first_index: int = 1) BasisVectorIds[int][source]¶
Create a set of n sequential integers as ids, starting from first_index.
- augmented_with(n: int) BasisVectorIds[source]¶
Return a new copy with n new ids at the end.