From 9181b7c41565efcc2cdc0e4263833634daaaa536 Mon Sep 17 00:00:00 2001
From: Andreas Kloeckner <inform@tiker.net>
Date: Sat, 5 Jul 2014 21:20:14 -0500
Subject: [PATCH] Shuffle around GA docs

---
 doc/geometric-algebra.rst     | 77 ----------------------------------
 pymbolic/geometric_algebra.py | 78 +++++++++++++++++++++++++++++++++++
 2 files changed, 78 insertions(+), 77 deletions(-)

diff --git a/doc/geometric-algebra.rst b/doc/geometric-algebra.rst
index 9179498..b313715 100644
--- a/doc/geometric-algebra.rst
+++ b/doc/geometric-algebra.rst
@@ -3,81 +3,4 @@ Geometric Algebra
 
 .. automodule:: pymbolic.geometric_algebra
 
-Also see :ref:`ga-examples`.
-
-Spaces
-------
-
-.. autoclass:: Space
-
-    .. autoattribute:: dimensions
-    .. autoattribute:: is_orthogonal
-    .. autoattribute:: is_euclidean
-
-.. autofunction:: get_euclidean_space
-
-Multivectors
-------------
-
-.. autoclass:: MultiVector
-
-.. _ga-examples:
-
-Example usage
--------------
-
-This first example demonstrates how to compute a cross product using
-:class:`MultiVector`:
-
-.. doctest::
-
-    >>> import numpy as np
-    >>> import pymbolic.geometric_algebra as ga
-    >>> MV = ga.MultiVector
-
-    >>> a = np.array([3.344, 1.2, -0.5])
-    >>> b = np.array([7.4, 1.1, -2.0])
-    >>> np.cross(a, b)
-    array([-1.85  ,  2.988 , -5.2016])
-
-    >>> mv_a = MV(a)
-    >>> mv_b = MV(b)
-    >>> print -mv_a.I*(mv_a^mv_b)
-    -1.85*e0 + 2.988*e1 + -5.2016*e2
-
-This simple example demonstrates how a complex number is simply a special
-case of a :class:`MultiVector`:
-
-.. doctest::
-
-    >>> import numpy as np
-    >>> import pymbolic.geometric_algebra as ga
-    >>> MV = ga.MultiVector
-    >>>
-    >>> sp = ga.Space(metric_matrix=-np.eye(1))
-    >>> sp
-    Space(['e0'], array([[-1.]]))
-
-    >>> one = MV(1, sp)
-    >>> one
-    MultiVector({0: 1}, Space(['e0'], array([[-1.]])))
-    >>> print one
-    1
-    >>> print one.I
-    1*e0
-    >>> print one.I ** 2
-    -1.0
-
-    >>> print (3+5j)*(2+3j)/(3j)
-    (6.33333333333+3j)
-    >>> print (3+5*one.I)*(2+3*one.I)/(3*one.I)
-    6.33333333333 + 3.0*e0
-
-The following test demonstrates the use of the object and shows many useful
-properties:
-
-.. literalinclude:: ../test/test_pymbolic.py
-   :start-after: START_GA_TEST
-   :end-before: END_GA_TEST
-
 .. vim: sw=4
diff --git a/pymbolic/geometric_algebra.py b/pymbolic/geometric_algebra.py
index 7eb2b91..149b810 100644
--- a/pymbolic/geometric_algebra.py
+++ b/pymbolic/geometric_algebra.py
@@ -32,6 +32,84 @@ See `Wikipedia <https://en.wikipedia.org/wiki/Geometric_algebra>`_ for an idea
 of what this is.
 
 .. versionadded:: 2013.2
+
+Also see :ref:`ga-examples`.
+
+Spaces
+------
+
+.. autoclass:: Space
+
+    .. autoattribute:: dimensions
+    .. autoattribute:: is_orthogonal
+    .. autoattribute:: is_euclidean
+
+.. autofunction:: get_euclidean_space
+
+Multivectors
+------------
+
+.. autoclass:: MultiVector
+
+.. _ga-examples:
+
+Example usage
+-------------
+
+This first example demonstrates how to compute a cross product using
+:class:`MultiVector`:
+
+.. doctest::
+
+    >>> import numpy as np
+    >>> import pymbolic.geometric_algebra as ga
+    >>> MV = ga.MultiVector
+
+    >>> a = np.array([3.344, 1.2, -0.5])
+    >>> b = np.array([7.4, 1.1, -2.0])
+    >>> np.cross(a, b)
+    array([-1.85  ,  2.988 , -5.2016])
+
+    >>> mv_a = MV(a)
+    >>> mv_b = MV(b)
+    >>> print -mv_a.I*(mv_a^mv_b)
+    MV(-1.85*e0 + 2.988*e1 + -5.2016*e2)
+
+This simple example demonstrates how a complex number is simply a special
+case of a :class:`MultiVector`:
+
+.. doctest::
+
+    >>> import numpy as np
+    >>> import pymbolic.geometric_algebra as ga
+    >>> MV = ga.MultiVector
+    >>>
+    >>> sp = ga.Space(metric_matrix=-np.eye(1))
+    >>> sp
+    Space(['e0'], array([[-1.]]))
+
+    >>> one = MV(1, sp)
+    >>> one
+    MultiVector({0: 1}, Space(['e0'], array([[-1.]])))
+    >>> print one
+    MV(1)
+    >>> print one.I
+    MV(1*e0)
+    >>> print one.I ** 2
+    MV(-1.0)
+
+    >>> print (3+5j)*(2+3j)/(3j)
+    (6.33333333333+3j)
+    >>> print (3+5*one.I)*(2+3*one.I)/(3*one.I)
+    MV(6.33333333333 + 3.0*e0)
+
+The following test demonstrates the use of the object and shows many useful
+properties:
+
+.. literalinclude:: ../test/test_pymbolic.py
+   :start-after: START_GA_TEST
+   :end-before: END_GA_TEST
+
 """
 
 
-- 
GitLab