File: app_scarfisgeneric.cpp

package info (click to toggle)
gfan 0.5%2Bdfsg-6
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 8,348 kB
  • ctags: 5,683
  • sloc: cpp: 39,675; makefile: 454; sh: 1
file content (68 lines) | stat: -rw-r--r-- 1,793 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
57
58
59
60
61
62
63
64
65
66
67
68
#include "parser.h"
#include "printer.h"
#include "polynomial.h"
#include "division.h"
#include "buchberger.h"
#include "wallideal.h"
#include "lp.h"
#include "reversesearch.h"
#include "termorder.h"
#include "ep_standard.h"
#include "ep_xfig.h"
#include "gfanapplication.h"
#include "matrix.h"
#include "latticeideal.h"
#include "subspace.h"
#include "scarf.h"

class ScarfIsGenericApplication : public GFanApplication
{
public:
  bool includeInDefaultInstallation()
  {
    return false;
  }
  const char *helpText()
  {
    return "This program takes a matrix as input and checks if it satisfies Scarf's generality conditions. The rows of the matrix are listed on the input. The A1 condition is that there exists a strictly poistive vector in the co-kernel of the matrix. The A2 condition is that the maximal minors of the matrix are non-zero. A3\n";
  }
  ScarfIsGenericApplication()
  {
    registerOptions();
  }

  const char *name()
  {
    return "_scarf_isgeneric";
  }
  int main()
  {
    LpSolver::printList(Stdout);
    lpSetSolver("cddgmp");

    FileParser P(Stdin);

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

    bool s1=satisfiesA1(A);
    fprintf(Stdout,"A1 satisfied:%i\n",s1);
    if(s1)
      {
	IntegerVectorList N=neighbours(A);
	AsciiPrinter Q(Stdout);
	N=orientedNeighbours(N,-A[0]);
	Q.printVectorList(N);
	fprintf(Stdout,"A2 satisfied:%i\n",satisfiesA2(A));
	for(int i=0;i<A.getHeight();i++)
	  fprintf(Stdout,"A3(%i) satisfied:%i\n",i,satisfiesA3i(A,i,&N));
	fprintf(Stdout,"A3 satisfied:%i\n",satisfiesA3(A,&N));
      }
    else
      fprintf(Stdout,"Neighbours for this matrix cannot be computed with the implemented method.\n");

    return 0;
  }
};

static ScarfIsGenericApplication theApplication;