My Project
temptest.cc
Go to the documentation of this file.
1#include "coeffs/bigintmat.h"
2#include "temptest.h"
3#include "reporter/reporter.h"
4#include "coeffs/numbers.h"
5#include "coeffs/coeffs.h"
6#include "Singular/ipid.h"
7//#include "kernel/febase.h"
8#include "lattice.h"
9#include <iostream>
10
11
13
14using namespace std;
15
16//Temporary testfunction to play arround with new functions
17//NOTE: remove later
19 PrintS("This is a Test\n");
20 bigintmat* bim = new bigintmat(&a);
21 bim->Print();
22
23 cout << "TEST " << getCoeffType(bim->basecoeffs()) << '\n';
24// lattice* l = new lattice(bim);
25// l->LLL();
26// delete l;
27// l->MLLL();
28// bigintmat n = l->get_lattice();
29 bigintmat* c = bimAdd(bim,bim);
30 delete bim;
31 return c;
32}
33
34number temp_test2(number a) {
35 PrintS("This is a Test 2\n");
36 number b = nCopy(a);
37 number c = nCopy(a);//squareroot(b,currRing->cf,10);
38 coeffs coef = currRing->cf;//nInitChar(n_Q,NULL);
39
40 //cout << "CoeffType of currRing: " << getCoeffType(currRing->cf) << '\n';
41 //cout << "n_Greater(n_Init(3,coef),n_Init(3,coef),coef): " << n_Greater(n_Init(3,coef),n_Init(3,coef),coef) << '\n';
42 //Test enumerate
43
44 bigintmat *m = new bigintmat(3,3,coef);
45 for(int i=1; i<=3; i++) {
46 m->set(i,i,n_Init(1,coef), coef);
47 }
48 m->set(1,2,n_Init(1,coef), coef);
49 m->set(2,3,n_Init(1,coef), coef);
50 m->set(3,1,n_Init(1,coef), coef);
51
52 m->Print();
53 PrintS("\n");
54
55 lattice* l = new lattice(m);
56 //l->LLL();
57 bigintmat* enumer = NULL;// = new bigintmat(3,,coef);
58 enumer = l->enumerate_all(c);
59 //bigintmat *reduced = l->get_reduced_basis();
60 //reduced->Print();
61 if(enumer !=NULL){
62 enumer->transpose()->Print();
63 PrintS("\n");
64 }/*
65 PrintS("new number\n");
66 enumer = l->enumerate_next( c);
67 if(enumer !=NULL){
68 enumer->Print();
69 PrintS("\n");
70 }
71 PrintS("new number and bigintmat\n");
72 bigintmat* x= new bigintmat(3,1,coef);
73 x->set(2,1,n_Init(-4,coef), coef);
74 x->set(3,1,n_Init(1,coef), coef);
75 enumer = l->enumerate_next( c, x);
76 if(enumer !=NULL){
77 enumer->Print();
78 PrintS("\n");
79 }
80 for(int i=1;i<4;i++){
81 enumer = l->enumerate_next();
82 if(enumer !=NULL){
83 enumer->Print();
84 }
85 PrintS("\n");
86 }
87 PrintS("new bigintmat\n");
88 x->set(3,1,n_Init(8,coef), coef);
89 enumer = l->enumerate_next(x);
90 if(enumer !=NULL){
91 enumer->Print();
92 }
93 PrintS("til now it works\n");
94 delete l;
95 //*/
96
97 /*//test minkowski
98 PrintS("Test Minkowski\n");PrintS("Elements\n");
99 bigintmat ** elementarray = new bigintmat*[4];
100 elementarray[0] = new bigintmat(4,1,coef);
101 elementarray[1] = new bigintmat(4,1,coef);
102 elementarray[2] = new bigintmat(4,1,coef);
103 elementarray[3] = new bigintmat(4,1,coef);
104 elementarray[0]->rawset(2,1,n_Init(1,coef),coef);
105
106 elementarray[1]->rawset(1,1,n_Init(3,coef),coef);
107 elementarray[1]->rawset(2,1,n_Init(7,coef),coef);
108 elementarray[1]->rawset(3,1,n_Init(13,coef),coef);
109
110 elementarray[2]->rawset(1,1,n_Init(-1,coef),coef);
111 elementarray[2]->rawset(2,1,n_Init(42,coef),coef);
112 elementarray[2]->rawset(3,1,n_Init(-5,coef),coef);
113 elementarray[2]->rawset(4,1,n_Init(21,coef),coef);
114
115 elementarray[3]->rawset(1,1,n_Init(2,coef),coef);
116 elementarray[3]->rawset(2,1,n_Init(-1,coef),coef);
117 elementarray[3]->rawset(3,1,n_Init(-5,coef),coef);
118 elementarray[3]->rawset(4,1,n_Init(1,coef),coef);
119 /// poly with real and imag roots
120 PrintS("polynomial\n");
121 number * poly = new number[5];//(number *)omAlloc( (5) * sizeof( number ) );//new number[5];
122 //poly[0] = n_Init(6,coef);
123 //poly[1] = n_Init(0,coef);
124 //poly[2] = n_Init(5,coef);//positiv imagin??r, negatic reelle wurzeln
125 //poly[3] = n_Init(0,coef);
126 //poly[4] = n_Init(1,coef);
127 poly[0] = n_Init(-1,coef);
128 poly[1] = n_Init(0,coef);
129 poly[2] = n_Init(0,coef);
130 poly[3] = n_Init(3,coef);
131 poly[4] = n_Init(1,coef);
132 int prec = 42;
133 //coeffs rea = nInitChar(n_long_R,NULL);
134 //setGMPFloatDigits( prec, prec);
135 //number abc = n_Init(1,rea);
136 //abc = n_Div(abc,n_Init(3333,rea),rea);
137 //n_Print(abc,rea);
138 //PrintS("\n");
139 bigintmat * gitter = NULL;PrintS("Call function\n");
140 gitter = minkowksi(elementarray,4,poly,4,coef,prec);
141 if(gitter !=NULL){
142 gitter->Print();PrintS("\n");
143 //cout << "CoeffType of gitter: " << getCoeffType(gitter->basecoeffs()) << '\n';
144 coeffs rea = gitter->basecoeffs();
145 number sqrt = squareroot(n_Init(100,rea),rea,prec);
146 n_Print(sqrt,rea);
147 PrintS("\n");
148 }
149 //*/
150 //n_Print(c,currRing->cf);
151 PrintS("\n");
152
153 return b;
154}
155
bigintmat * bimAdd(bigintmat *a, bigintmat *b)
Matrix-Add/-Sub/-Mult so oder mit operator+/-/* ? @Note: NULL as a result means an error (non-compati...
Definition: bigintmat.cc:182
int l
Definition: cfEzgcd.cc:100
int m
Definition: cfEzgcd.cc:128
int i
Definition: cfEzgcd.cc:132
CanonicalForm b
Definition: cfModGcd.cc:4103
Matrices of numbers.
Definition: bigintmat.h:51
void Print()
IO: simply prints the matrix to the current output (screen?)
Definition: bigintmat.cc:443
bigintmat * transpose()
Definition: bigintmat.cc:37
coeffs basecoeffs() const
Definition: bigintmat.h:146
Definition: lattice.h:6
Coefficient rings, fields and other domains suitable for Singular polynomials.
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition: coeffs.h:422
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
Definition: coeffs.h:535
The main handler for Singular numbers which are suitable for Singular polynomials.
#define nCopy(n)
Definition: numbers.h:15
#define NULL
Definition: omList.c:12
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition: polys.cc:13
void PrintS(const char *s)
Definition: reporter.cc:284
number temp_test2(number a)
Definition: temptest.cc:34
bigintmat * temp_test(bigintmat &a)
Definition: temptest.cc:18