29# define DEBUG_BLOCK(x) bool debug_block = x;
33# define DEBUG_PRINT(x) do {if(debug_block) {Print x ;}} while(0)
34# define DEBUG_CMD(x) do {if(debug_block) {x;}} while(0)
35# define DEBUG_VAR(x) do {if(debug_block) {std::cout<<#x<<": "<<x<<std::endl;}} while(0)
36# define DEBUG_N(x) do {if(debug_block) {Print(#x);Print(": ");n_Print(x,coef);Print("\n");}} while(0)
37# define DEBUG_BIM(x) do {if(debug_block) {Print(#x);Print(": ");x->Print();Print("\n");}} while(0)
39# define DEBUG_BLOCK(x) do {} while (0)
40# define DEBUG_PRINT(x) do {} while (0)
41# define DEBUG_CMD(x) do {} while (0)
42# define DEBUG_VAR(x) do {} while (0)
43# define DEBUG_N(x) do {} while (0)
44# define DEBUG_BIM(x) do {} while (0)
55 n = basismatrix->
cols();
56 m = basismatrix->
rows();
66 for(
int i=1;
i<=
n;
i++) {
95 for(
int i=0;
i<=
n;
i++) {
102 for(
int i=0;
i<=
n;
i++) {
109 for(
int i=0;
i<=
n;
i++) {
137 number default_c =
n_Div(three,four,
coef);
149 for(
int j=1;
j<=
n;
j++) {
154 for(
int j=1;
j<=
n;
j++) {
162 for(
int j=0;
j<=
n;
j++) {
166 for(
int j=0;
j<=
n;
j++) {
175 for(
int j=0;
j<=
n;
j++) {
241 if(
n_Greater(
n_Mult(
n_Sub(
c,
n_Mult(
my->
view(
k,
k-1),
my->
view(
k,
k-1),
coef),
coef),
B[
k-1],
coef),
B[
k],
coef)){
251 for(
int l=
k-2;
l>0;
l--){
289 number my_klplus1div2;
291 my_klplus1div2 =
n_Add(my_kl, n_1div2,
coef);
293 my_klplus1div2 =
n_Add(my_kl, n_neg1div2,
coef);
308 for(
int i=1;
i<=
l-1;
i++){
316 DEBUG_PRINT((
"Start SWAP with k=%d and k_max=%d\n",
k,k_max));
326 for(
int j = 1;
j <=
k-2;
j++){
349 for(
int i =
k+1;
i <= k_max;
i++){
358 DEBUG_PRINT((
"Start SWAPG with k=%d and k_max=%d\n",
k,k_max));
368 for(
int j = 1;
j <=
k-2;
j++){
380 number tempnumber =
B[
k];
388 for(
int i =
k+1;
i <= k_max;
i++){
389 number tempnumber =
my->
get(
i,
k);
400 for(
int i =
k+1;
i <= k_max;
i++){
421 for(
int i =
k+1;
i <= k_max;
i++){
436 for(
int j=1;
j<
k;
j++) {
445 Werror(
"did not form a basis\n");
457 for(
int j=1;
j<
k;
j++) {
467 for(
int j=1;
j<
k;
j++) {
535 DEBUG_PRINT((
"Initialize vector and other variables\n"));
536 std::vector<std::pair<number,bigintmat*> > elementsvector;
554 for(
int i = 2;
i<
n+1;
i++){
570 for(
unsigned i=1;
i<elementsvector.size();
i++){
572 elementsvector.pop_back();
578 if(elementsvector.size() >= 1000000){
579 elementsvector.pop_back();
590 for(
unsigned i=1;
i<elementsvector.size();
i++){
594 for(
unsigned i=1;
i<elementsvector.size();
i++){
607 DEBUG_PRINT((
"Start enumerate_next number and bigintmat\n"));
648 for(
int j =
n;
j>1;
j--){
680 Werror(
"no bound for elements given\n");
695 Werror(
"not initialized\n");
720 DEBUG_PRINT((
"enumerate_get_next\t\t\t\t\taaaaaaaaaaaaa\n"));
748 }
else if(
index == 1){
811 for(
int j = 1;
j<
i;
j++){
834 for(
int i=1;
i<=
n;
i++) {
835 for(
int j=1;
j<=
n;
j++) {
876 for(
int j=1;
j<=
n;
j++) {
884 for(
int j=1;
j<=
n;
j++) {
917 Werror(
"a->cols()!=1 in scalarproduct(a,b)\n");
921 Werror(
"b->cols()!=1 in scalarproduct(a,b)\n");
924 if(a->
rows()!=
b->rows()) {
925 Werror(
"b->cols()!=1 in scalarproduct(a,b)\n");
929 Werror(
"a->basecoeffs()!=b->basecoeffs() in scalarproduct(a,b)\n");
935 for(
int i = 1;
i <=
b->rows();
i++){
952 if(elementarray ==
NULL || poly ==
NULL || coef != elementarray[0]->basecoeffs()){
957 for(
int i=1;
i<size_elementarray;
i++){
958 if(coef != elementarray[0]->basecoeffs()){
967 WerrorS(
"Ground field not implemented!\n");
972 WerrorS(
"degree of polynomial to small\n");
985 char* n[] = {(
char*)
"i"};
986 ring newring =
rDefault(coef, 1, n);
991 rootcont->
solver( precision+12);
993 if(number_roots != deg){
994 WerrorS(
"something went wrong: \n\tnot all roots found\n");
1000 paramComp.
par_name=(
const char*)
"i";
1004 number* roots =
new number[deg+1];
1005 number* complexroots =
new number[deg+1];
1008 for(
int j=0;
j<deg;
j++){
1026 for(
int j=0;
j<r2;
j++){
1030 delete complexroots;
1033 for(
int i=0;
i<size_elementarray;
i++){
1039 for(
int i=1;
i<= r1;
i++){
1041 for(
int l=0;
l< deg;
l++){
1042 for(
int j=0;
j<size_elementarray;
j++){
1057 for(
int i=1;
i<= r2;
i++){
1059 for(
int l=0;
l< deg;
l++){
1060 for(
int j=0;
j<size_elementarray;
j++){
1068 for(
int j=1;
j<=size_elementarray;
j++){
1076 for(
int i=0;
i<size_elementarray;
i++){
1080 for(
int i=0;
i<r1+r2;
i++){
1089 paramComp.
par_name=(
const char*)
"i";
1118 number two =
n_Init(2,coef);
1121 for(
int i=0;
i<prec;
i++){
static int si_min(const int a, const int b)
bigintmat * bimChangeCoeff(bigintmat *a, coeffs cnew)
Liefert Kopier von Matrix a zurück, mit coeffs cnew statt den ursprünglichen.
bigintmat * bimCopy(const bigintmat *b)
same as copy constructor - apart from it being able to accept NULL as input
bigintmat * bimMult(bigintmat *a, bigintmat *b)
bigintmat * bimSub(bigintmat *a, bigintmat *b)
bigintmat * bimAdd(bigintmat *a, bigintmat *b)
Matrix-Add/-Sub/-Mult so oder mit operator+/-/* ? @Note: NULL as a result means an error (non-compati...
void Print()
IO: simply prints the matrix to the current output (screen?)
void zero()
Setzt alle Einträge auf 0.
void appendCol(bigintmat *a)
horizontally join the matrices, m <- m|a
void swap(int i, int j)
swap columns i and j
bool addcol(int i, int j, number a, coeffs c)
addiert a-faches der j-ten Spalte zur i-ten dazu
void setcol(int j, bigintmat *m)
Setzt j-te Spalte gleich übergebenem Vektor (Matrix) m.
bool skalmult(number b, coeffs c)
Multipliziert zur Matrix den Skalar b hinzu.
void getcol(int j, bigintmat *a)
copies the j-th column into the matrix a - which needs to be pre-allocated with the correct size.
number get(int i, int j) const
get a copy of an entry. NOTE: starts at [1,1]
number view(int i, int j) const
view an entry an entry. NOTE: starts at [1,1]
void one()
Macht Matrix (Falls quadratisch) zu Einheitsmatrix.
void rawset(int i, number n, const coeffs C=NULL)
replace an entry with the given number n (only delete old). NOTE: starts at [0]. Should be named set_...
coeffs basecoeffs() const
void set(int i, int j, number n, const coeffs C=NULL)
replace an entry with a copy (delete old + copy new!). NOTE: starts at [1,1]
bool sub(bigintmat *b)
Subtrahiert ...
bool quadratic_supplement()
void SWAP(int k, int k_max)
void SWAPG(int k, int k_max)
void increase_x(int index)
bigintmat * get_transformation_matrix()
lattice(bigintmat *basis)
void compute_gram_matrix()
bigintmat * enumerate_all(number a)
number enumerate_get_next()
number check_bound(int index)
bigintmat * enumerate_next()
void gram_schmidt_MLLL(int k)
bigintmat * get_reduced_basis()
complex root finder for univariate polynomials based on laguers algorithm
gmp_complex * getRoot(const int i)
void fillContainer(number *_coeffs, number *_ievpoint, const int _var, const int _tdg, const rootType _rt, const int _anz)
bool solver(const int polishmode=PM_NONE)
Coefficient rings, fields and other domains suitable for Singular polynomials.
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
static FORCE_INLINE number n_Add(number a, number b, const coeffs r)
return the sum of 'a' and 'b', i.e., a+b
static FORCE_INLINE number n_GetDenom(number &n, const coeffs r)
return the denominator of n (if elements of r are by nature not fractional, result is 1)
static FORCE_INLINE BOOLEAN nCoeff_is_Z(const coeffs r)
static FORCE_INLINE BOOLEAN nCoeff_is_long_R(const coeffs r)
@ n_long_R
real floating point (GMP) numbers
@ n_long_C
complex floating point (GMP) numbers
short float_len2
additional char-flags, rInit
static FORCE_INLINE BOOLEAN n_GreaterZero(number n, const coeffs r)
ordered fields: TRUE iff 'n' is positive; in Z/pZ: TRUE iff 0 < m <= roundedBelow(p/2),...
static FORCE_INLINE nMapFunc n_SetMap(const coeffs src, const coeffs dst)
set the mapping function pointers for translating numbers from src to dst
const char * par_name
parameter name
static FORCE_INLINE number n_Div(number a, number b, const coeffs r)
return the quotient of 'a' and 'b', i.e., a/b; raises an error if 'b' is not invertible in r exceptio...
static FORCE_INLINE number n_RePart(number i, const coeffs cf)
static FORCE_INLINE BOOLEAN nCoeff_is_Q(const coeffs r)
coeffs nInitChar(n_coeffType t, void *parameter)
one-time initialisations for new coeffs in case of an error return NULL
static FORCE_INLINE BOOLEAN n_Greater(number a, number b, const coeffs r)
ordered fields: TRUE iff 'a' is larger than 'b'; in Z/pZ: TRUE iff la > lb, where la and lb are the l...
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
static FORCE_INLINE number n_Sub(number a, number b, const coeffs r)
return the difference of 'a' and 'b', i.e., a-b
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
static FORCE_INLINE number n_Init(long i, const coeffs r)
a number representing i in the given coeff field/ring r
static FORCE_INLINE void n_InpMult(number &a, number b, const coeffs r)
multiplication of 'a' and 'b'; replacement of 'a' by the product a*b
short float_len
additional char-flags, rInit
static FORCE_INLINE BOOLEAN n_Equal(number a, number b, const coeffs r)
TRUE iff 'a' and 'b' represent the same number; they may have different representations.
static FORCE_INLINE number n_GetNumerator(number &n, const coeffs r)
return the numerator of n (if elements of r are by nature not fractional, result is n)
static FORCE_INLINE number n_ImPart(number i, const coeffs cf)
number(* nMapFunc)(number a, const coeffs src, const coeffs dst)
maps "a", which lives in src, into dst
static FORCE_INLINE BOOLEAN nCoeff_is_R(const coeffs r)
static FORCE_INLINE BOOLEAN nCoeff_is_long_C(const coeffs r)
static FORCE_INLINE void n_InpAdd(number &a, number b, const coeffs r)
addition of 'a' and 'b'; replacement of 'a' by the sum a+b
int comp(const CanonicalForm &A, const CanonicalForm &B)
compare polynomials
void WerrorS(const char *s)
bool IsReal(number a, coeffs coef)
number scalarproduct(bigintmat *a, bigintmat *b)
bigintmat * minkowksi(bigintmat **elementarray, int size_elementarray, number *poly, int deg, coeffs coef, int precision)
number squareroot(number a, coeffs coef, int prec)
bool ImagGreaterZero(number a, coeffs coef)
STATIC_VAR bool debug_block
number scalarproduct(bigintmat *a, bigintmat *b)
void mult(unsigned long *result, unsigned long *a, unsigned long *b, unsigned long p, int dega, int degb)
void setGMPFloatDigits(size_t digits, size_t rest)
Set size of mantissa digits - the number of output digits (basis 10) the size of mantissa consists of...
The main handler for Singular numbers which are suitable for Singular polynomials.
static int index(p_Length length, p_Ord ord)
void rChangeCurrRing(ring r)
VAR ring currRing
Widely used global variable which specifies the current polynomial ring for Singular interpreter and ...
void Werror(const char *fmt,...)
void rDelete(ring r)
unconditionally deletes fields in r
ring rDefault(const coeffs cf, int N, char **n, int ord_size, rRingOrder_t *ord, int *block0, int *block1, int **wvhdl, unsigned long bitmask)
static void view(const intvec *v)