Skip to content
Snippets Groups Projects
Select Git revision
  • 984aa9af58e65a17ee77cc243db468f1142505d5
  • main default protected
  • bachelor-thesis
  • keyring
  • v0.1-bachelor-thesis
5 results

weil.cpp

Blame
  • weil.cpp 14.68 KiB
    /* SPDX-FileCopyrightText: © 2022 Maik Herbers */
    /* SPDX-License-Identifier: GPL-3.0-or-later */
    
    #include <algorithm>
    #include <cstdlib>
    #include <cstring>
    #include <exception>
    #include <fstream>
    #include <iostream>
    #include <optional>
    #include <sstream>
    
    #ifndef _GNU_SOURCE
    #define _GNU_SOURCE
    #endif
    #include <getopt.h>
    #include <unistd.h>
    
    #include "common.hpp"
    #include "discriminant_form.hpp"
    #include "sl2z.hpp"
    
    int
    print_help(bool error)
    {
    	const char* s = "Usage:\n"
    			"\tweil [options] <command> [arguments]\n"
    			"\n"
    			"Commands:\n"
    			"  DS-info <file>                            output some information about the discriminant form associated\n"
    			"                                            to the gram matrix in `file'\n"
    			"  DS-c-kernel <file> <c>                    compute `D_c' where `D' is the discriminant form associated\n"
    			"                                            to the gram matrix in `file'\n"
    			"  DS-c-image <file> <c>                     compute `D^c' where `D' is the discriminant form associated\n"
    			"                                            to the gram matrix in `file'\n"
    			"  DS-c-star <file> <c>                      compute `D^c*' where `D' is the discriminant form associated\n"
    			"                                            to the gram matrix in `file'\n"
    			"  Lattice-smith-gram-matrix <file>          compute the gram matrix of the quadratic form in `file'  with\n"
    			"                                            respect to the smith basis\n"
    			"  DS-get-orbits <gram> <aut>                compute the orbits in the discriminant form associated to the gram\n"
    			"                                            matrix `gram' under the action induced by the automorphisms in `aut'\n"
    			"  SL2Z-split <m>                            split the matrix `m' in SL2Z into generators\n"
    			"  VV-Theta-Series [options] <file> <prec>   compute the vector valued theta series associated to the\n"
    			"                                            lattice with gram matrix in `file' up to precision `prec'\n"
    			"  Transformation-Matrix <file> <aut> <M>    compute the transformation matrix (up to a root of unity and a square root)\n"
    			"                                            of the action induced by `M' on the vector space spanned by the component\n"
    			"                                            functions of the vector-valued theta function of the lattice associated to\n"
    			"                                            the gram matrix in `file' modulo the modulo the automorphisms in `aut'\n"
    			"\n"
    			"Options:\n"
    			"  --help, -h                                show this help message\n"
    			"  --print-style=STYLE                       use this style to print things: pretty (default), sage, pari, latex\n"
    			"\n"
    			"Options specific to VV-Theta-series:\n"
    			"  --with-automorphisms=AUT                  compute the component functions only for one representative of the orbits\n"
    			"                                            induced by the automorphisms AUT each. this may significantly reduce the\n"
    			"                                            required memory at a cost of run time.";
    
    	(error ? std::cerr : std::cout) << s << std::endl;
    
    	return error ? EXIT_FAILURE : EXIT_SUCCESS;
    }
    
    static std::optional<weil::mpz_matrix>
    read_square_mpz_matrix(const char* file)
    {
    
    	std::vector<mpz_class> v;
    
    	std::ifstream in{ file };