Loading...
Searching...
No Matches
temptest.cc
Go to the documentation of this file.
#include "coeffs/bigintmat.h"
#include "temptest.h"
#include "reporter/reporter.h"
#include "coeffs/numbers.h"
#include "coeffs/coeffs.h"
#include "Singular/ipid.h"
//#include "kernel/febase.h"
#include "lattice.h"
#include <iostream>
#include "kernel/numeric/mpr_numeric.h"
using namespace std;
//Temporary testfunction to play arround with new functions
//NOTE: remove later
bigintmat* temp_test(bigintmat& a) {
PrintS("This is a Test\n");
bigintmat* bim = new bigintmat(&a);
bim->Print();
cout << "TEST " << getCoeffType(bim->basecoeffs()) << '\n';
// lattice* l = new lattice(bim);
// l->LLL();
// delete l;
// l->MLLL();
// bigintmat n = l->get_lattice();
bigintmat* c = bimAdd(bim,bim);
delete bim;
return c;
}
number temp_test2(number a) {
PrintS("This is a Test 2\n");
number b = nCopy(a);
number c = nCopy(a);//squareroot(b,currRing->cf,10);
coeffs coef = currRing->cf;//nInitChar(n_Q,NULL);
//cout << "CoeffType of currRing: " << getCoeffType(currRing->cf) << '\n';
//cout << "n_Greater(n_Init(3,coef),n_Init(3,coef),coef): " << n_Greater(n_Init(3,coef),n_Init(3,coef),coef) << '\n';
//Test enumerate
bigintmat *m = new bigintmat(3,3,coef);
for(int i=1; i<=3; i++) {
m->set(i,i,n_Init(1,coef), coef);
}
m->set(1,2,n_Init(1,coef), coef);
m->set(2,3,n_Init(1,coef), coef);
m->set(3,1,n_Init(1,coef), coef);
m->Print();
PrintS("\n");
lattice* l = new lattice(m);
//l->LLL();
bigintmat* enumer = NULL;// = new bigintmat(3,,coef);
enumer = l->enumerate_all(c);
//bigintmat *reduced = l->get_reduced_basis();
//reduced->Print();
if(enumer !=NULL){
enumer->transpose()->Print();
PrintS("\n");
}/*
PrintS("new number\n");
enumer = l->enumerate_next( c);
if(enumer !=NULL){
enumer->Print();
PrintS("\n");
}
PrintS("new number and bigintmat\n");
bigintmat* x= new bigintmat(3,1,coef);
x->set(2,1,n_Init(-4,coef), coef);
x->set(3,1,n_Init(1,coef), coef);
enumer = l->enumerate_next( c, x);
if(enumer !=NULL){
enumer->Print();
PrintS("\n");
}
for(int i=1;i<4;i++){
enumer = l->enumerate_next();
if(enumer !=NULL){
enumer->Print();
}
PrintS("\n");
}
PrintS("new bigintmat\n");
x->set(3,1,n_Init(8,coef), coef);
enumer = l->enumerate_next(x);
if(enumer !=NULL){
enumer->Print();
}
PrintS("til now it works\n");
delete l;
//*/
/*//test minkowski
PrintS("Test Minkowski\n");PrintS("Elements\n");
bigintmat ** elementarray = new bigintmat*[4];
elementarray[0] = new bigintmat(4,1,coef);
elementarray[1] = new bigintmat(4,1,coef);
elementarray[2] = new bigintmat(4,1,coef);
elementarray[3] = new bigintmat(4,1,coef);
elementarray[0]->rawset(2,1,n_Init(1,coef),coef);
elementarray[1]->rawset(1,1,n_Init(3,coef),coef);
elementarray[1]->rawset(2,1,n_Init(7,coef),coef);
elementarray[1]->rawset(3,1,n_Init(13,coef),coef);
elementarray[2]->rawset(1,1,n_Init(-1,coef),coef);
elementarray[2]->rawset(2,1,n_Init(42,coef),coef);
elementarray[2]->rawset(3,1,n_Init(-5,coef),coef);
elementarray[2]->rawset(4,1,n_Init(21,coef),coef);
elementarray[3]->rawset(1,1,n_Init(2,coef),coef);
elementarray[3]->rawset(2,1,n_Init(-1,coef),coef);
elementarray[3]->rawset(3,1,n_Init(-5,coef),coef);
elementarray[3]->rawset(4,1,n_Init(1,coef),coef);
/// poly with real and imag roots
PrintS("polynomial\n");
number * poly = new number[5];//(number *)omAlloc( (5) * sizeof( number ) );//new number[5];
//poly[0] = n_Init(6,coef);
//poly[1] = n_Init(0,coef);
//poly[2] = n_Init(5,coef);//positiv imagin??r, negatic reelle wurzeln
//poly[3] = n_Init(0,coef);
//poly[4] = n_Init(1,coef);
poly[0] = n_Init(-1,coef);
poly[1] = n_Init(0,coef);
poly[2] = n_Init(0,coef);
poly[3] = n_Init(3,coef);
poly[4] = n_Init(1,coef);
int prec = 42;
//coeffs rea = nInitChar(n_long_R,NULL);
//setGMPFloatDigits( prec, prec);
//number abc = n_Init(1,rea);
//abc = n_Div(abc,n_Init(3333,rea),rea);
//n_Print(abc,rea);
//PrintS("\n");
bigintmat * gitter = NULL;PrintS("Call function\n");
gitter = minkowksi(elementarray,4,poly,4,coef,prec);
if(gitter !=NULL){
gitter->Print();PrintS("\n");
//cout << "CoeffType of gitter: " << getCoeffType(gitter->basecoeffs()) << '\n';
coeffs rea = gitter->basecoeffs();
number sqrt = squareroot(n_Init(100,rea),rea,prec);
n_Print(sqrt,rea);
PrintS("\n");
}
//*/
//n_Print(c,currRing->cf);
PrintS("\n");
return b;
}
bimAdd
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:180
bigintmat.h
l
int l
Definition cfEzgcd.cc:100
m
int m
Definition cfEzgcd.cc:128
i
int i
Definition cfEzgcd.cc:132
b
CanonicalForm b
Definition cfModGcd.cc:4111
bigintmat
Matrices of numbers.
Definition bigintmat.h:51
bigintmat::Print
void Print()
IO: simply prints the matrix to the current output (screen?).
Definition bigintmat.cc:437
bigintmat::transpose
bigintmat * transpose()
Definition bigintmat.cc:35
bigintmat::basecoeffs
coeffs basecoeffs() const
Definition bigintmat.h:146
lattice
Definition lattice.h:6
coeffs.h
Coefficient rings, fields and other domains suitable for Singular polynomials.
getCoeffType
static FORCE_INLINE n_coeffType getCoeffType(const coeffs r)
Returns the type of coeffs domain.
Definition coeffs.h:431
n_Init
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:541
ipid.h
lattice.h
mpr_numeric.h
coeffs
The main handler for Singular numbers which are suitable for Singular polynomials.
numbers.h
nCopy
#define nCopy(n)
Definition numbers.h:15
NULL
#define NULL
Definition omList.c:12
currRing
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
Definition polys.cc:13
PrintS
void PrintS(const char *s)
Definition reporter.cc:288
reporter.h
temp_test2
number temp_test2(number a)
Definition temptest.cc:34
temp_test
bigintmat * temp_test(bigintmat &a)
Definition temptest.cc:18
temptest.h