File: app_lll.cpp

package info (click to toggle)
gfan 0.3dfsg-1
  • links: PTS
  • area: main
  • in suites: lenny, squeeze
  • size: 2,012 kB
  • ctags: 1,935
  • sloc: cpp: 17,728; makefile: 251
file content (56 lines) | stat: -rw-r--r-- 1,266 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#include "vektor.h"
#include "printer.h"
#include "parser.h"
#include "gfanapplication.h"
#include "lll.h"

class LLLApplication : public GFanApplication
{
public:
  bool includeInDefaultInstallation()
  {
    return false;
  }
  LLLApplication()
  {
    registerOptions();
  }
  char *name()
  {
    return "_lll";
  }
  int main()
  {
    FileParser P(Stdin);

    IntegerVectorList ivl=P.parseIntegerVectorList();
    IntegerMatrix A=rowsToIntegerMatrix(ivl);


    AsciiPrinter Q(Stdout);

    Q.printString("Input generators:\n");
    AsciiPrinter(Stdout).printVectorList(ivl);

    IntegerMatrix Minv;
    IntegerMatrix A2=A;
    IntegerMatrix M=mlll(A,&Minv);
    Q.printString("LLL basis:\n");
    AsciiPrinter(Stdout).printVectorList(A.getRows());
    Q.printString("Transformation:\n");
    AsciiPrinter(Stdout).printVectorList(M.getRows());
    Q.printString("Inverse transformation:\n");
    AsciiPrinter(Stdout).printVectorList(Minv.getRows());

    Q.printString("Basis for integer kernal:\n");
    AsciiPrinter(Stdout).printVectorList(latticeKernelOfTransposed(A2).getRows());

    return 0;
  }
  const char *helpText()
  {
    return "Tests the LLL algorithm. Input is a list of lattice generators.\n";
  }
};

static LLLApplication theApplication;