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

weil: Name orbits in `DS-get-orbits'.

Note that the numbering (the letters) depend on the smith basis.

* src/weil.cpp (base26): New function.
(ds_info): Output orbit name for `Pretty' and 'LaTeX' output formats.
parent 47df24dd
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,7 @@
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <exception>
#include <fstream>
#include <iostream>
......@@ -272,6 +273,26 @@ lattice_smith_gram_matrix(int argc, const char** argv, weil::IOFormat style)
return EXIT_SUCCESS;
}
std::string
base26(uint64_t n)
{
const char* alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const uint64_t len = strlen(alphabet) - 1;
if (n == 0) {
return { alphabet[0] };
}
std::string s;
while (n > 0) {
s.push_back(alphabet[n % len]);
n /= len;
}
std::ranges::reverse(s);
return s;
}
int
ds_get_orbits(int argc, const char** argv, weil::IOFormat style)
{
......@@ -307,7 +328,7 @@ ds_get_orbits(int argc, const char** argv, weil::IOFormat style)
switch (style) {
using enum weil::IOFormat;
case Pretty:
start = "representative\tlength\tnorm\torder\n";
start = "representative\tname\tlength\tnorm\torder\n";
stop = "";
prefix = "";
infix = "\t";
......@@ -331,7 +352,7 @@ ds_get_orbits(int argc, const char** argv, weil::IOFormat style)
sep = ",\\\n";
break;
case LaTeX:
start = "\\begin{tabular}{c c c c}\n";
start = "\\begin{tabular}{c c c c c}\n";
stop = "\n\\end{tabular}";
prefix = "$";
infix = "$ & $";
......@@ -342,6 +363,8 @@ ds_get_orbits(int argc, const char** argv, weil::IOFormat style)
std::cout << start;
bool first{ true };
uint64_t offset_idx{ 0 };
mpz_class last_offset{ 0_mpz };
for (auto&& o : orbits) {
if (first) {
first = false;
......@@ -349,15 +372,27 @@ ds_get_orbits(int argc, const char** argv, weil::IOFormat style)
std::cout << sep;
}
mpz_class offset{ (D.level() * D.q(o.representative)) };
if (last_offset != offset) {
last_offset = offset;
offset_idx = 0;
}
std::cout << prefix;
format_eigen(std::cout, o.representative, style);
std::cout << infix;
if (style == weil::IOFormat::Pretty || style == weil::IOFormat::LaTeX) {
std::cout << offset << base26(offset_idx);
std::cout << infix;
}
std::cout << o.length;
std::cout << infix;
std::cout << D.q(o.representative);
std::cout << infix;
std::cout << D.element_order(o.representative);
std::cout << suffix;
offset_idx++;
}
std::cout << stop << std::endl;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment