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.
-
id_as_bitmap
(id: IdT) → int[source]¶ Convert the id of a single vector into a bitmap representation.
-
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]]) → clifford._layout_helpers.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: clifford._layout_helpers.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',)]
-