]> gitweb.michael.orlitzky.com - sage.d.git/blobdiff - mjo/hurwitz.py
matrix_algebra: fix element construction.
[sage.d.git] / mjo / hurwitz.py
index cad89ca177cbdcfbc065682d4a64af43aad6917a..57f65786ebf564e1f250d5c22c60e35dcd440c08 100644 (file)
@@ -312,19 +312,21 @@ class HurwitzMatrixAlgebraElement(MatrixAlgebraElement):
 
         SETUP::
 
-            sage: from mjo.hurwitz import HurwitzMatrixAlgebra
+            sage: from mjo.hurwitz import ComplexMatrixAlgebra
 
         EXAMPLES::
 
-            sage: A = HurwitzMatrixAlgebra(2, QQbar, ZZ)
+            sage: A = ComplexMatrixAlgebra(2, QQbar, ZZ)
             sage: M = A([ [ I,   2*I],
             ....:         [ 3*I, 4*I] ])
             sage: M.conjugate_transpose()
             +------+------+
-            | -1*I | -3*I |
+            | -I   | -3*I |
             +------+------+
             | -2*I | -4*I |
             +------+------+
+            sage: M.conjugate_transpose().to_vector()
+            (0, -1, 0, -3, 0, -2, 0, -4)
 
         """
         entries = [ [ self[j,i].conjugate()
@@ -337,16 +339,25 @@ class HurwitzMatrixAlgebraElement(MatrixAlgebraElement):
 
         SETUP::
 
-            sage: from mjo.hurwitz import HurwitzMatrixAlgebra
+            sage: from mjo.hurwitz import (ComplexMatrixAlgebra,
+            ....:                          HurwitzMatrixAlgebra)
 
         EXAMPLES::
 
-            sage: A = HurwitzMatrixAlgebra(2, QQbar, ZZ)
+            sage: A = ComplexMatrixAlgebra(2, QQbar, ZZ)
             sage: M = A([ [ 0,I],
             ....:         [-I,0] ])
             sage: M.is_hermitian()
             True
 
+        ::
+
+            sage: A = HurwitzMatrixAlgebra(2, AA, QQ)
+            sage: M = A([ [1, 1],
+            ....:         [1, 1] ])
+            sage: M.is_hermitian()
+            True
+
         """
         # A tiny bit faster than checking equality with the conjugate
         # transpose.
@@ -649,9 +660,9 @@ class QuaternionMatrixAlgebra(HurwitzMatrixAlgebra):
             (0, 0, 0, 1)
 
         """
-        from sage.modules.free_module import VectorSpace
+        from sage.modules.free_module import FreeModule
         d = len(self.entry_algebra_gens())
-        V = VectorSpace(self.entry_algebra().base_ring(), d)
+        V = FreeModule(self.entry_algebra().base_ring(), d)
         return V(entry.coefficient_tuple())
 
 class ComplexMatrixAlgebra(HurwitzMatrixAlgebra):
@@ -750,7 +761,7 @@ class ComplexMatrixAlgebra(HurwitzMatrixAlgebra):
             (0, 1)
 
         """
-        from sage.modules.free_module import VectorSpace
+        from sage.modules.free_module import FreeModule
         d = len(self.entry_algebra_gens())
-        V = VectorSpace(self.entry_algebra().base_ring(), d)
+        V = FreeModule(self.entry_algebra().base_ring(), d)
         return V((entry.real(), entry.imag()))