MCPcopy Create free account
hub / github.com/Singular/Singular / rem

Function rem

kernel/linear_algebra/minpoly.cc:572–594  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

570
571
572void rem (unsigned long *a, unsigned long *q, unsigned long p, int &dega,
573 int degq)
574{
575 while(degq <= dega)
576 {
577 unsigned d = dega - degq;
578 long factor = multMod (a[dega], modularInverse (q[degq], p), p);
579 for(int i = degq; i >= 0; i--)
580 {
581 long tmp = p - multMod (factor, q[i], p);
582 a[d + i] += tmp;
583 if (a[d + i] >= p)
584 {
585 a[d + i] -= p;
586 }
587 }
588
589 while(dega >= 0 && a[dega] == 0)
590 {
591 dega--;
592 }
593 }
594}
595
596
597void quo (unsigned long *a, unsigned long *q, unsigned long p, int &dega,

Callers 2

modNTLFunction · 0.85
gcdFunction · 0.85

Calls 2

multModFunction · 0.85
modularInverseFunction · 0.85

Tested by

no test coverage detected