My Project
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes
nforder Class Reference

#include <nforder.h>

Public Member Functions

void calcdisc ()
 
int ref_count_incref ()
 
int ref_count_decref ()
 
int ref_count ()
 
 nforder (int dim, bigintmat **m, const coeffs q)
 0 Konstruktoren/Destruktoren ///
 
 nforder (nforder *o, bigintmat *base, number div, const coeffs q)
 
 nforder (nforder *o, int)
 
 ~nforder ()
 
void Write ()
 
charString ()
 
void Print ()
 
nfordersimplify ()
 
number getDisc ()
 
number viewDisc ()
 
int getDim ()
 
coeffs basecoeffs () const
 
number getDiv ()
 
bool getMult (bigintmat **m)
 
nfordergetBase ()
 
bigintmatgetBasis ()
 
bigintmatviewBasis ()
 
bool oneIsOne ()
 
void setOneIsOne ()
 
bool isMaximalKnown ()
 
bool isMaximal ()
 
void setIsMaximal (bool is)
 
void elAdd (bigintmat *a, bigintmat *b)
 
void elSub (bigintmat *a, bigintmat *b)
 
void elMult (bigintmat *a, bigintmat *b)
 
number elTrace (bigintmat *a)
 
number elNorm (bigintmat *a)
 
bigintmatelRepMat (bigintmat *a)
 
void multmap (bigintmat *a, bigintmat *m)
 
bigintmattraceMatrix ()
 
void createmulttable (bigintmat **a)
 

Private Member Functions

void init ()
 

Private Attributes

int rc
 
number discriminant
 
int dimension
 
coeffs m_coeffs
 
bigintmat ** multtable
 
nforderbaseorder
 
bigintmatbasis
 
number divisor
 
bigintmatinv_basis
 
number inv_divisor
 
int flags
 

Detailed Description

Definition at line 23 of file nforder.h.

Constructor & Destructor Documentation

◆ nforder() [1/3]

nforder::nforder ( int  dim,
bigintmat **  m,
const coeffs  q 
)

0 Konstruktoren/Destruktoren ///

Definition at line 30 of file nforder.cpp.

30 {
31 init();
32 m_coeffs = q;
33 dimension = dim;
34 multtable = (bigintmat**)(omAlloc(dim*sizeof(bigintmat*)));
35 for (int i=0; i<dim; i++) {
36 multtable[i] = new bigintmat(m[i]);
37 }
38 basis = NULL;
40}
int m
Definition cfEzgcd.cc:128
int i
Definition cfEzgcd.cc:132
Matrices of numbers.
Definition bigintmat.h:51
coeffs m_coeffs
Definition nforder.h:32
int dimension
Definition nforder.h:31
bigintmat * basis
Definition nforder.h:35
bigintmat * inv_basis
Definition nforder.h:38
bigintmat ** multtable
Definition nforder.h:33
void init()
Definition nforder.cpp:16
#define omAlloc(size)
#define NULL
Definition omList.c:12
int dim(ideal I, ring r)

◆ nforder() [2/3]

nforder::nforder ( nforder o,
bigintmat base,
number  div,
const coeffs  q 
)

Definition at line 42 of file nforder.cpp.

42 {
43 init();
44 m_coeffs = q;
45 basis = new bigintmat(base);
46 //neue Ordnung erzeugen und übergebene Daten kopieren
47 baseorder = o;
49 //Gibt es eine Baseorder, brauchen wir keine Multtable. Könnte aber evtl. generiert werden
53 dimension = o->getDim();
55
56 inv_basis = new bigintmat(base->rows(), base->rows(), q);
60}
CF_NO_INLINE FACTORY_PUBLIC CanonicalForm div(const CanonicalForm &, const CanonicalForm &)
bool skalmult(number b, coeffs c)
Multipliziert zur Matrix den Skalar b hinzu.
Definition bigintmat.cc:934
void simplifyContentDen(number *den)
ensures that Gcd(den, content)=1 enden hier wieder
number pseudoinv(bigintmat *a)
Speichert in Matrix a die Pseudoinverse, liefert den Nenner zurück.
number discriminant
Definition nforder.h:30
nforder * baseorder
Definition nforder.h:34
coeffs basecoeffs() const
Definition nforder.h:76
number inv_divisor
Definition nforder.h:39
int ref_count_incref()
Definition nforder.h:50
number divisor
Definition nforder.h:36
int getDim()
Definition nforder.cpp:235
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
Definition coeffs.h:448
char N base

◆ nforder() [3/3]

nforder::nforder ( nforder o,
int   
)

Definition at line 62 of file nforder.cpp.

62 {
63 init();
64 m_coeffs = o->basecoeffs();
65 ::Print("copy called: %lx\n", (long unsigned int) m_coeffs);
66 // Kopiert die Daten der übergebenen Ordnung auf die erzeugte
67 if (o->discriminant)
69 // get-Funktionen liefern immer nur Kopien der Attribute zurück
70 dimension = o->getDim();
72 if (!o->getMult(multtable)) {
75 }
76 baseorder = o->getBase();
78 basis = o->getBasis();
79 if (o->divisor)
81 if (o->inv_basis) {
84 }
85}
void Print()
Definition nforder.cpp:126
nforder * getBase()
Definition nforder.cpp:268
bigintmat * getBasis()
Definition nforder.cpp:239
bool getMult(bigintmat **m)
Definition nforder.cpp:251
#define omFree(addr)

◆ ~nforder()

nforder::~nforder ( )

Definition at line 139 of file nforder.cpp.

139 {
140 if (multtable != NULL) {
141 for (int i=0; i<dimension; i++)
142 delete multtable[i];
144 }
145 else
146 {
147 // andernfalls werden baseorder und basis gelöscht
149 delete basis;
151 if (inv_basis) delete inv_basis;
153 }
155}
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition coeffs.h:452
void nforder_delete(nforder *o)
Definition nforder.cpp:132

Member Function Documentation

◆ basecoeffs()

coeffs nforder::basecoeffs ( ) const
inline

Definition at line 76 of file nforder.h.

76{ return m_coeffs; }

◆ calcdisc()

void nforder::calcdisc ( )

Definition at line 162 of file nforder.cpp.

162 {
163 // Determinante von Spurmatrix ist die Discriminante
164 if (discriminant) return;
165 if (baseorder == NULL) {
167 discriminant = m->det();
169 delete m;
170 }
171 else
172 {
174 number tmp, tmp2; //assumes that the basis is triangular!
175 for (int i=1; i<=dimension; i++) {
176 tmp2 = basis->view(i, i);
179 prod = tmp;
180 }
183 assume(disc);
186
187 for (int i=1; i<=2*dimension; i++) {
191 }
193 }
194}
number view(int i, int j) const
view an entry an entry. NOTE: starts at [1,1]
Definition bigintmat.cc:127
coeffs basecoeffs() const
Definition bigintmat.h:146
number viewDisc()
Definition nforder.h:74
void calcdisc()
Definition nforder.cpp:162
bigintmat * traceMatrix()
Definition nforder.cpp:196
static FORCE_INLINE number n_Mult(number a, number b, const coeffs r)
return the product of 'a' and 'b', i.e., a*b
Definition coeffs.h:633
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...
Definition coeffs.h:612
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
CFList tmp2
Definition facFqBivar.cc:75
fq_nmod_poly_t prod
Definition facHensel.cc:100
#define assume(x)
Definition mod2.h:389

◆ createmulttable()

void nforder::createmulttable ( bigintmat **  a)

Definition at line 677 of file nforder.cpp.

677 {
678 // Falls es eine Multtable gibt, liefere eine Kopie davon zurück
679 if (multtable != NULL) {
680 for (int i=0; i<dimension; i++) {
681 a[i] = new bigintmat(multtable[i]);
682 }
683 }
684 else {
685 // Sonst berechne sie auf kanonische Art und Weise
687 for (int i=0; i<dimension; i++) {
688 basis_elt(bas, i+1);
690 multmap(bas, a[i]);
691 }
692 }
693}
void multmap(bigintmat *a, bigintmat *m)
Definition nforder.cpp:404
void basis_elt(bigintmat *m, int i)
Definition nforder.cpp:422

◆ elAdd()

void nforder::elAdd ( bigintmat a,
bigintmat b 
)

Definition at line 301 of file nforder.cpp.

301 {
302 if ((a->cols() != 1) || (a->rows() != dimension) || (b->cols() != 1) || (b->rows() != dimension)) {
303 Werror("Error in elSub");
304 }
305 else {
306 a->add(b);
307 }
308}
CanonicalForm b
Definition cfModGcd.cc:4104
int cols() const
Definition bigintmat.h:144
bool add(bigintmat *b)
Addiert zur Matrix die Matrix b dazu. Return false => an error occurred.
Definition bigintmat.cc:890
int rows() const
Definition bigintmat.h:145
void Werror(const char *fmt,...)
Definition reporter.cc:189

◆ elMult()

void nforder::elMult ( bigintmat a,
bigintmat b 
)

Definition at line 321 of file nforder.cpp.

321 {
322 if ((a->cols() != 1) || (a->rows() != dimension) || (b->cols() != 1) || (b->rows() != dimension)) {
323 // Kein Zeilenvektor der korrekten Größe
324 Werror("Error in elMult");
325 }
326
327 coeffs C = a->basecoeffs();
328 assume(C == b->basecoeffs());
329 assume(C == this->basecoeffs());
330
331 if (multtable != NULL) {
332 // Multiplikation mit Hilfe von Multiplikationstabelle
333 // Zu Grunde liegende Formel: Basis w_i; Für alpha = sum a_i*w_i und beta = sum b_i*w_i gilt:
334 // alpha*beta = sum sum a_i*b_j*w_i*w_j
335 bigintmat *sum = new bigintmat(dimension, 1, C);
336 bigintmat *tmp = new bigintmat(dimension, 1, C);
337 number ntmp;
338
339 for (int i=1; i<=dimension; i++) {
340 // Laufe mit i durch Basiselemente
341 for (int j=1; j<=dimension; j++) {
342 // Laufe mit j durch Basiselemente
343 // Speichere Produkt von Basiselem. i mit Basiselem. j als Koeff.vektor in tmp
344
345 multtable[i-1]->getcol(j, tmp);
346 // Multipliziere ihn mit a[i] und b[j]
347 ntmp = n_Mult(a->view(i, 1), b->view(j, 1), C);
348 tmp->skalmult(ntmp, C);
349
350 n_Delete(&ntmp, C);
351 // und addiere alles auf
352 sum->add(tmp);
353 }
354 }
355 delete tmp;
356 // Am Ende überschreibe a mit dem Ergebnis
357 for (int i=0; i<dimension; i++)
358 a->set(i+1, 1, sum->get(i+1, 1));
359 delete sum;
360 } else {
361 // Multiplikation mit hilfe von baseorder:
362 bigintmat *sumb = new bigintmat(dimension, 1, C);
363 // Produkt von a (b) mit basis liefert Koeff-Vektor von a*divisor (b*divisor) in baseorder
364 bimMult(basis, a, a);
365 bimMult(basis, b, sumb);
366 // Multipliziere Elemente in baseorder (und speichere in suma)
367 baseorder->elMult(a, sumb);
368 delete sumb;
369 a->skaldiv(divisor);
370 bimMult(inv_basis, a, a);
372 a->skaldiv(divisor);
373 }
374}
bigintmat * bimMult(bigintmat *a, bigintmat *b)
Definition bigintmat.cc:255
void skaldiv(number b)
Macht Ganzzahldivision aller Matrixeinträge mit b.
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.
Definition bigintmat.cc:743
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]
Definition bigintmat.cc:95
void elMult(bigintmat *a, bigintmat *b)
Definition nforder.cpp:321
int j
Definition facHensel.cc:110
The main handler for Singular numbers which are suitable for Singular polynomials.

◆ elNorm()

number nforder::elNorm ( bigintmat a)

Definition at line 387 of file nforder.cpp.

388{
390 number n = rep_mat->det();
391 delete rep_mat;
392 return n;
393}
bigintmat * elRepMat(bigintmat *a)
Definition nforder.cpp:395

◆ elRepMat()

bigintmat * nforder::elRepMat ( bigintmat a)

Definition at line 395 of file nforder.cpp.

396{
398 multmap(a, b);
399 return b;
400}

◆ elSub()

void nforder::elSub ( bigintmat a,
bigintmat b 
)

Definition at line 311 of file nforder.cpp.

311 {
312 if ((a->cols() != 1) || (a->rows() != dimension) || (b->cols() != 1) || (b->rows() != dimension)) {
313 // Kein Zeilenvektor der korrekten Größe
314 Werror("Error in elSub");
315 }
316 else {
317 a->sub(b);
318 }
319}
bool sub(bigintmat *b)
Subtrahiert ...
Definition bigintmat.cc:912

◆ elTrace()

number nforder::elTrace ( bigintmat a)

Definition at line 379 of file nforder.cpp.

380{
382 number t = rep_mat->trace();
383 delete rep_mat;
384 return t;
385}

◆ getBase()

nforder * nforder::getBase ( )

Definition at line 268 of file nforder.cpp.

268 {
269 // returns the baseorder, if present. Does not incref the ref count.
270 if (baseorder == NULL)
271 return NULL;
272 return baseorder;
273}

◆ getBasis()

bigintmat * nforder::getBasis ( )

Definition at line 239 of file nforder.cpp.

239 {
240 // Falls basis ein NULL-Pointer ist, liefere NULL zurück, andernfalls liefere eine Kopie von basis
241 if (basis == NULL)
242 return NULL;
243 bigintmat *m = new bigintmat(basis); //wenn Fehler dann hier
244 return m;
245}

◆ getDim()

int nforder::getDim ( )

Definition at line 235 of file nforder.cpp.

235 {
236 return dimension;
237}

◆ getDisc()

number nforder::getDisc ( )

Definition at line 227 of file nforder.cpp.

227 {
228 // Falls Discriminante bisher noch nicht berechnet wurde, berechne diese
230 calcdisc();
231 }
232 return n_Copy(discriminant, basecoeffs());
233}
static FORCE_INLINE BOOLEAN n_IsZero(number n, const coeffs r)
TRUE iff 'n' represents the zero element.
Definition coeffs.h:461

◆ getDiv()

number nforder::getDiv ( )

Definition at line 264 of file nforder.cpp.

264 {
265 return n_Copy(divisor, basecoeffs());
266}

◆ getMult()

bool nforder::getMult ( bigintmat **  m)

Definition at line 251 of file nforder.cpp.

251 {
252 // Falls multtable ein NULL-Pointer ist, liefere NULL zurück, andernfalls erzeuge neues Array of Matrix, kopiere die Matrizen aus multtable dort hinein, und gib es zurück
253 if (multtable == NULL) {
254 return false;
255 }
256 for (int i=0; i<dimension; i++)
257 {
258 m[i] = new bigintmat(multtable[i]);
259 }
260 return true;
261}

◆ init()

void nforder::init ( )
private

Definition at line 16 of file nforder.cpp.

16 {
17 rc = 1;
18 // Gibt es eine Multtable, so gibt es keine Baseorder
20 basis = NULL;
21 // Discriminante wird erst berechnet, wenn sie benötigt wird
23 divisor = NULL;
24 flags = 0;
26 m_coeffs = NULL;
28}
int flags
Definition nforder.h:40
int rc
Definition nforder.h:29
void setOneIsOne()
Definition nforder.h:85

◆ isMaximal()

bool nforder::isMaximal ( )
inline

Definition at line 88 of file nforder.h.

88{return isMaximalKnown() && (flags & (1<<is_maximal_known));};
bool isMaximalKnown()
Definition nforder.h:87
@ is_maximal_known
Definition nforder.h:19

◆ isMaximalKnown()

bool nforder::isMaximalKnown ( )
inline

Definition at line 87 of file nforder.h.

87{return (flags & (1<<is_maximal_known)) != 0;};

◆ multmap()

void nforder::multmap ( bigintmat a,
bigintmat m 
)

Definition at line 404 of file nforder.cpp.

404 {
405 if ((m->cols() != dimension) || (m->rows() != dimension)) {
406 Werror("Error in multmap");
407 return;
408 }
410 for (int i=1; i<=dimension; i++) {
411 // Durchläuft alle Basiselemente
412 // Multipliziert i-tes Basiselement mit a
413 basis_elt(bas, i);
414 elMult(bas, a);
415 // Schreibt Ergebnis in i-te Zeile der Matrix m. Am Ende ist m dann die Abbildungsmatrix der Multiplikation mit a
416 m->setcol(i, bas);
417 }
418 delete bas;
419}

◆ oneIsOne()

bool nforder::oneIsOne ( )
inline

Definition at line 84 of file nforder.h.

84{return (flags & (1<<one_is_one)) != 0;}
@ one_is_one
Definition nforder.h:18

◆ Print()

void nforder::Print ( )

Definition at line 126 of file nforder.cpp.

126 {
127 char * s = String();
128 PrintS(s);
129 PrintS("\n");
130 omFree(s);
131}
char * String()
Definition nforder.cpp:121
const CanonicalForm int s
Definition facAbsFact.cc:51
void PrintS(const char *s)
Definition reporter.cc:284

◆ ref_count()

int nforder::ref_count ( )
inline

Definition at line 52 of file nforder.h.

52{return rc;};

◆ ref_count_decref()

int nforder::ref_count_decref ( )
inline

Definition at line 51 of file nforder.h.

51{return rc--;};

◆ ref_count_incref()

int nforder::ref_count_incref ( )
inline

Definition at line 50 of file nforder.h.

50{return rc++;};

◆ setIsMaximal()

void nforder::setIsMaximal ( bool  is)
inline

Definition at line 89 of file nforder.h.

89{flags = (flags & (~((1<<is_maximal_known) + (1<<is_maximal)))) | (1<<is_maximal_known) | (is*(1<<is_maximal));};
@ is_maximal
Definition nforder.h:20

◆ setOneIsOne()

void nforder::setOneIsOne ( )
inline

Definition at line 85 of file nforder.h.

85{flags |= (1<<one_is_one);}

◆ simplify()

nforder * nforder::simplify ( )

Definition at line 275 of file nforder.cpp.

275 {
276 coeffs c = basecoeffs();
277 if (!baseorder || !baseorder->baseorder) {
279 return this;
280 }
281 nforder * O = baseorder;
282 number den = n_Copy(divisor, c);
284 while (O->baseorder) {
285 bigintmat * b = bimMult(bas, O->viewBasis());
286 n_InpMult(den, O->divisor, c);
287 O = O->baseorder;
288 delete bas;
289 bas = b;
290 }
291 nforder * res = new nforder(O, bas, den, c);
292 if (discriminant)
293 res->discriminant = n_Copy(discriminant, c);
294
295 //TODO: copy multtable if we have it
296 delete bas;
297 n_Delete(&den, c);
298 return res;
299}
CanonicalForm den(const CanonicalForm &f)
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
Definition coeffs.h:638
CanonicalForm res
Definition facAbsFact.cc:60

◆ String()

char * nforder::String ( )

Definition at line 121 of file nforder.cpp.

121 {
122 StringSetS("");
123 Write();
124 return StringEndS();
125}
void Write()
Definition nforder.cpp:87
void StringSetS(const char *st)
Definition reporter.cc:128
char * StringEndS()
Definition reporter.cc:151

◆ traceMatrix()

bigintmat * nforder::traceMatrix ( )

Definition at line 196 of file nforder.cpp.

196 {
201 number sum;
202
203 for (int i=1; i<=dimension; i++) {
204 for (int j=i; j<=dimension; j++) {
205 // Berechnet Produkt von Basiselementen i und j und speichert es in base1
206 basis_elt(base1, i);
207 basis_elt(base2, j);
209 // Schreibt Abbildungsmatrix der Multiplikation mit base1 in mm
210 sum = elTrace(base1);
211 m->set(i, j, sum, basecoeffs());
212 if (i!=j)
213 m->set(j, i, sum, basecoeffs());
215 }
216 }
217 delete base1;
218 delete base2;
219 delete mm;
220 return m;
221}
number elTrace(bigintmat *a)
Definition nforder.cpp:379

◆ viewBasis()

bigintmat * nforder::viewBasis ( )

Definition at line 246 of file nforder.cpp.

246 {
247 if (basis == NULL)
248 return NULL;
249 return basis;
250}

◆ viewDisc()

number nforder::viewDisc ( )
inline

Definition at line 74 of file nforder.h.

74{return discriminant;};

◆ Write()

void nforder::Write ( )

Definition at line 87 of file nforder.cpp.

87 {
88 StringAppend("Order:\nof dimension %d and rc: %d\n", dimension, ref_count());
90 StringAppend("and discriminant: ");
92 StringAppend("\n");
93 }
94// coeffs
95 if (multtable) {
96 StringAppend("Multiplication table:\n");
97 for(int i=0; i<dimension; i++) {
98 StringAppend("%d: ", i);
99 multtable[i]->Write();
100 StringAppendS("\n");
101 }
102 }
103
104 if (baseorder) {
105 StringAppendS("as extension of:");
106 baseorder->Write();
107 StringAppendS("with basis:\n");
108 basis->Write();
109 StringAppendS("and denominator: ");
111 StringAppendS("\nwith inv_basis:\n");
112 inv_basis->Write();
113 StringAppendS("and inv_denominator: ");
115 StringAppendS("\n");
116 }
117
118 StringAppend("Flags: %lx\n", flags);
119}
void Write()
IO: writes the matrix into the current internal string buffer which must be started/ allocated before...
Definition bigintmat.cc:413
int ref_count()
Definition nforder.h:52
static FORCE_INLINE void n_Write(number n, const coeffs r, const BOOLEAN bShortOut=TRUE)
Definition coeffs.h:588
#define StringAppend
Definition emacs.cc:79
void StringAppendS(const char *st)
Definition reporter.cc:107

Field Documentation

◆ baseorder

nforder* nforder::baseorder
private

Definition at line 34 of file nforder.h.

◆ basis

bigintmat* nforder::basis
private

Definition at line 35 of file nforder.h.

◆ dimension

int nforder::dimension
private

Definition at line 31 of file nforder.h.

◆ discriminant

number nforder::discriminant
private

Definition at line 30 of file nforder.h.

◆ divisor

number nforder::divisor
private

Definition at line 36 of file nforder.h.

◆ flags

int nforder::flags
private

Definition at line 40 of file nforder.h.

◆ inv_basis

bigintmat* nforder::inv_basis
private

Definition at line 38 of file nforder.h.

◆ inv_divisor

number nforder::inv_divisor
private

Definition at line 39 of file nforder.h.

◆ m_coeffs

coeffs nforder::m_coeffs
private

Definition at line 32 of file nforder.h.

◆ multtable

bigintmat** nforder::multtable
private

Definition at line 33 of file nforder.h.

◆ rc

int nforder::rc
private

Definition at line 29 of file nforder.h.


The documentation for this class was generated from the following files: