Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Faster implementation of finite dimensional algebras
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-king-jena committed Aug 26, 2017
1 parent 037272c commit a34ee26
Show file tree
Hide file tree
Showing 4 changed files with 139 additions and 97 deletions.
2 changes: 2 additions & 0 deletions src/module_list.py
Expand Up @@ -188,6 +188,8 @@ def uname_specific(name, value, alternative):

Extension('*', sources = ['sage/algebras/letterplace/*.pyx']),

Extension('*', sources = ['sage/algebras/finite_dimensional_algebras/*.pyx']),

Extension('sage.algebras.quatalg.quaternion_algebra_cython',
sources = ['sage/algebras/quatalg/quaternion_algebra_cython.pyx'],
language='c++',
Expand Down
Expand Up @@ -20,7 +20,7 @@
from sage.rings.integer_ring import ZZ

from sage.categories.magmatic_algebras import MagmaticAlgebras
from sage.matrix.constructor import Matrix
from sage.matrix.constructor import Matrix, matrix
from sage.matrix.matrix import is_Matrix
from sage.modules.free_module_element import vector
from sage.rings.ring import Algebra
Expand Down Expand Up @@ -302,7 +302,7 @@ def __iter__(self):
sage: A = FiniteDimensionalAlgebra(GF(3), [Matrix([[1, 0], [0, 1]]), Matrix([[0, 1], [0, 0]])])
sage: list(A)
[0, e0, 2*e0, e1, e0 + e1, 2*e0 + e1, 2*e1, e0 + 2*e1, 2*e0 + 2*e1]
[0, e0, e1, 2*e0, e0 + e1, 2*e1, 2*e0 + e1, e0 + 2*e1, 2*e0 + 2*e1]
This is used in the :class:`Testsuite`'s when ``self`` is
finite.
Expand Down Expand Up @@ -554,7 +554,7 @@ def is_unitary(self):
n = self.degree()
k = self.base_ring()
if n == 0:
self._one = vector(k, [])
self._one = matrix(k, 1, n)
return True
B1 = reduce(lambda x, y: x.augment(y),
self._table, Matrix(k, n, 0))
Expand All @@ -564,7 +564,7 @@ def is_unitary(self):
# n times n identity matrix:
kone = k.one()
kzero = k.zero()
v = vector(k, (n - 1) * ([kone] + n * [kzero]) + [kone])
v = matrix(k, 1, n**2, (n - 1) * ([kone] + n * [kzero]) + [kone])
try:
sol1 = B1.solve_left(v)
sol2 = B2.solve_left(v)
Expand Down Expand Up @@ -719,8 +719,8 @@ def quotient_map(self, ideal):
pivots = f.pivot_rows()
table = []
for p in pivots:
v = vector(k, self.degree())
v[p] = 1
v = matrix(k, 1, self.degree())
v[0,p] = 1
v = self.element_class(self, v)
table.append(f.solve_right(v.matrix() * f))
B = FiniteDimensionalAlgebra(k, table)
Expand Down

0 comments on commit a34ee26

Please sign in to comment.