Skip to content
Snippets Groups Projects
Verified Commit e8d17812 authored by Herbers, Maik's avatar Herbers, Maik
Browse files

Add auxilliary files.

* aux-files/aut.txt, aux-files/correction_matrices.sage,
aux-files/gram_matrix.txt, aux-files/smith_gram_matrix.txt: New files.
parent ac74fc77
No related branches found
No related tags found
No related merge requests found
This diff is collapsed.
#!/usr/bin/env sage
# SPDX-FileCopyrightText: © 2022 Maik Herbers
# SPDX-License-Identifier: GPL-3.0-or-later
def left_matrix(width, height, replacement_spec):
r"""
Output a projection that maps basis vectors onto combinations of others
INPUT:
- ``width`` - dimension of the input space
- ``height`` - dimension of the output space
- ``replacement_spec`` - dictionary that maps indices of input basis
vectors to lists of pairs of replacement basis indices and their
multiplicities; all basis vectors not specified are mapped onto
themselves.
"""
m = zero_matrix(height, width)
offset = 0
for idx in range(width):
if idx in replacement_spec:
# map `idx' onto specified linear combination
for replacement_idx, multiplicity in replacement_spec[idx]:
row = replacement_idx - offset
if replacement_idx > idx:
row -= 1
m[row, idx] = multiplicity
offset += 1
else:
m[idx - offset, idx] = 1
return m
def right_matrix(width, height, skip):
r"""
Output an embedding where into a specified subspace
INPUT:
- ``width`` - dimension of the input space
- ``height`` - dimension of the output space
- ``skip`` - list of basis vectors in the output space that are not in the
image
"""
m = zero_matrix(height, width)
offset = 0
for i in range(height):
if i in skip:
offset += 1
else:
m[i, i - offset] = 1
return m
def get_matrices(n, replacement_spec):
r"""
Compute the "change of basis" matrices
INPUT:
- ``n`` - size of the input basis
- ``replacement_spec`` - dictionary suitable for ``left_matrix``
"""
new_size = n - len(replacement_spec)
left = left_matrix(n, new_size, replacement_spec)
right = right_matrix(new_size, n, replacement_spec.keys())
return left, right
# 6A - 6E and 10A - 10C have indices 20 - 24 and 33 - 35 resp. in our
# list of component functions
replacement_spec = {
22: [(20, 2), (21, 2), (23, 1), (24, -4)],
34: [(33, -2), (35, 3)]
}
l, r = get_matrices(38, replacement_spec)
print(f"left matrix:\n{l}\n\nright matrix:\n{r}")
6 2 2 2 2 0
2 6 4 4 -2 2
2 4 6 4 -2 2
2 4 4 6 0 2
2 -2 -2 0 6 2
0 2 2 2 2 6
4 -2 2 -6 0 6
-2 16 -20 54 24 -12
2 -20 58 -144 -60 18
-6 54 -144 360 150 -48
0 24 -60 150 66 -18
6 -12 18 -48 -18 18
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment