Skip to content

Commit

Permalink
Encapsulate ordering and naming conventions in separate classes. (#273)
Browse files Browse the repository at this point in the history
The end goal here is to be able to more clearly separate which bits of `Layout` are specific to the algebra, and which are specific to the choice of blade names and numbers.

This changes the signature of the `Layout` function.
It's likely no one was using it, but just in case we support the old signature and emit a deprecation warning.
  • Loading branch information
eric-wieser committed Mar 23, 2020
1 parent c24b36d commit d92ffb3
Show file tree
Hide file tree
Showing 9 changed files with 673 additions and 162 deletions.
12 changes: 12 additions & 0 deletions clifford/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@
Layout
ConformalLayout
Advanced algebra configuration
------------------------------
It is unlikely you will need these features, but they remain as a better
spelling for features which have always been in ``clifford``.
.. autosummary::
:toctree: generated/
BasisBladeOrder
BasisVectorIds
Global configuration functions
==============================
These functions are used to change the global behavior of ``clifford``.
Expand Down Expand Up @@ -304,6 +315,7 @@ def val_get_right_gmt_matrix(mt: sparse.COO, x):
from ._layout import Layout # noqa: E402
from ._multivector import MultiVector # noqa: E402
from ._conformal_layout import ConformalLayout # noqa: E402
from ._layout_helpers import BasisVectorIds, BasisBladeOrder # noqa: F401
from ._mvarray import MVArray, array # noqa: F401
from ._frame import Frame # noqa: F401
from ._blademap import BladeMap # noqa: F401
Expand Down
5 changes: 4 additions & 1 deletion clifford/_conformal_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ def __init__(self, *args, layout=None, **kwargs):
def _from_base_layout(cls, layout, added_sig=[1, -1], **kwargs) -> 'ConformalLayout':
""" helper to implement :func:`clifford.conformalize` """
sig_c = list(layout.sig) + added_sig
return cls._from_sig(sig=sig_c, firstIdx=layout.firstIdx, layout=layout, **kwargs)
return cls(
sig_c,
ids=layout._basis_vector_ids.augmented_with(len(added_sig)),
layout=layout, **kwargs)

# some convenience functions
def up(self, x: MultiVector) -> MultiVector:
Expand Down

0 comments on commit d92ffb3

Please sign in to comment.