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 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
|
/*
* app_librarytest.cpp
*
* Created on: Sep 28, 2010
* Author: anders
*/
#include "gfanapplication.h"
#include "gfanlib.h"
#include "printer.h"
#include <iostream>
#include <fstream>
using namespace gfan;
class LibraryTestApplication : public GFanApplication
{
public:
bool includeInDefaultInstallation()
{
return false;
}
const char *helpText()
{
return "This program tests the gfan library.\n";
}
LibraryTestApplication()
{
registerOptions();
}
const char *name()
{
return "_librarytest";
}
int main()
{
int n=4;
QVector s(n);
QMatrix M(0,n);
for(int i=0;i<n;i++)
{
QVector v=QVector::standardVector(n,i);
std::cout << v;
s-=v;
M.append(QMatrix::rowVectorMatrix(s));
}
std::cout <<s<<M;
M.reduce();
std::cout <<s<<M;
std::cerr<<"---------A"<<std::endl;
ZMatrix A(3,2);
A[0][0]=2;A[0][1]=2;
A[1][0]=1;A[1][1]=2;
A[2][0]=-2;A[2][1]=1;
std::cout << ZCone::givenByRays(A,ZMatrix(0,2));
// ZMatrix A(3,2);
A[0][0]=2;A[0][1]=2;
A[1][0]=1;A[1][1]=2;
A[2][0]=-2;A[2][1]=1;
ZMatrix temp(0,2);
ZCone C(A,temp);
std::cout<<C;
C.canonicalize();
std::cout<<C;
std::cout<<"Relative interior point"<<endl<<C.getRelativeInteriorPoint()<<endl;
std::cout<<"Extreme rays"<<endl<<C.extremeRays()<<endl;
std::cout<<"Dual cone"<<endl<<C.dualCone()<<endl;
std::cout<<"Unique point"<<endl<<C.getUniquePoint()<<endl;
std::cout<<"Inequalities"<<endl<<C.getInequalities()<<endl;
std::cout<<"Generators of span"<<endl<<C.generatorsOfSpan()<<endl;
std::cout<<"Generators of lineality space"<<endl<<C.generatorsOfLinealitySpace()<<endl;
Permutation a=Permutation::transposition(4,0,1);
Permutation b=Permutation::cycle(4);
SymmetryGroup G(4);
G.computeClosure(a);
G.computeClosure(b);
std::cout<<G.size()<<":"<<G.orbitSize(ZVector::standardVector(4,0)+ZVector::standardVector(4,1))<<std::endl;
/* {
std::cerr<<"TEST"<<std::endl;
ZFan f(1);
//f.insert(ZCone::positiveOrthant(1));
std::cerr<<f.toString();
std::cerr<<"ENDTEST"<<std::endl;
}
*/
{
SymmetryGroup sym(4);
sym.computeClosure(Permutation::cycle(4));
ZFan F(sym);
F.insert(ZCone::positiveOrthant(4));
std::cout<<F.toString();
for(int i=0;i<10;i++)std::cerr<<F.numberOfConesOfDimension(i,false,false)<<std::endl;
for(int i=0;i<4;i++)std::cerr<<F.getCone(3,i,false,false)<<std::endl;
std::cerr<<"AAA\n";
}
std::cerr<<"AAA\n";
{
// stringstream s;
// std::string test="TEST";
// std::istringstream s(test);
std::cerr<<"1AAA\n";
std::fstream f;
std::cerr<<"2AAA\n";
f.open("fanfile");
std::cerr<<"3AAA\n";
ZFan G(f);
std::cerr<<"4AAA\n";
std::cout<<G.getAmbientDimension()<<std::endl;
std::cerr<<"5AAA\n";
std::cout<<G.toString();
ZFan H=ZFan::fullFan(2);
// std::cout<<ZFan::fullFan(2).toString();
ZFan H2=H;
std::cout<<H2.toString();
}
return 0;
}
};
static LibraryTestApplication theApplication;
|