Loading...
Searching...
No Matches
nforder_ideal.cc File Reference
`#include "coeffs/bigintmat.h"`
`#include "nforder.h"`
`#include "reporter/reporter.h"`
`#include "coeffs/numbers.h"`
`#include "coeffs/coeffs.h"`
`#include "Singular/ipid.h"`
`#include "nforder_ideal.h"`

Go to the source code of this file.

## Functions

nforder_ideal * | nf_idAdd (nforder_ideal *A, nforder_ideal *B)
nforder_ideal * | nf_idMult (nforder_ideal *A, nforder_ideal *B)
nforder_ideal * | nf_idMult (nforder_ideal *A, number b)
nforder_ideal * | nf_idInit (int i, coeffs O)
nforder_ideal * | nf_idInit (number I, coeffs O)
nforder_ideal * | nf_idMult (nforder_ideal *A, int b)
nforder_ideal * | nf_idPower (nforder_ideal *A, int i)

## Function Documentation

## nf_idAdd()

nforder_ideal * nf_idAdd | ( | nforder_ideal * | A,
|  | nforder_ideal * | B )

Definition at line 101 of file nforder_ideal.cc.

{
assume(A->order() == B->order());
nforder * O = (nforder*) A->order()->data;
coeffs C = O->basecoeffs();
bigintmat * r = new bigintmat(O->getDim(), 2*O->getDim(), C),
*s1, *s2;
number den = NULL;
if (B->isFractional()) {
s1 = A->getBasis();
s1->skalmult(B->viewBasisDen(), C);
den = n_Copy(B->viewBasisDen(), C);
} else {
s1 = A->viewBasis();
}
if (A->isFractional()) {
s2 = B->getBasis();
s2->skalmult(A->viewBasisDen(), C);
if (den) {
number d = n_Mult(den, A->viewBasisDen(), C);
n_Delete(&den, C);
den = d;
} else {
den = n_Copy(A->viewBasisDen(), C);
}
} else {
s2 = B->viewBasis();
}
r->concatcol(s1, s2);
if (A->isFractional())
delete s2;
if (B->isFractional())
delete s1;
number modA = NULL, modB = NULL;
if (!(modA = A->viewMin())) {
modA = A->viewNorm();
}
if (!(modB = B->viewMin())) {
modB = B->viewNorm();
}
bigintmat *t2;
if (modA && modB) {
number mod = n_Gcd(modA, modB, C);
t2 = r->modhnf(mod, C);
n_Delete(&mod, C);
} else {
r->hnf();
t2 = new bigintmat(O->getDim(), O->getDim(), C);
t2->copySubmatInto(r, 1, O->getDim()+1, O->getDim(), O->getDim(), 1,1);
}
delete r;
if (den) {
t2->simplifyContentDen(&den);
}
nforder_ideal *D = new nforder_ideal(t2, A->order());
if (den)
D->setBasisDenTransfer(den);
if (O->oneIsOne())
D->setMinTransfer(t2->get(1,1), den ? n_Copy(den, C) : n_Init(1, C));
D->setNormTransfer(t2->det(), den ? n_Copy(den, C) : n_Init(1, C));
delete t2;
return D;
}
mod
CF_NO_INLINE FACTORY_PUBLIC CanonicalForm mod(const CanonicalForm &, const CanonicalForm &)
den
CanonicalForm den(const CanonicalForm &f)
Definition canonicalform.h:340
bigintmat
Matrices of numbers.
Definition bigintmat.h:51
bigintmat::det
number det()
det (via LaPlace in general, hnf for euc. rings)
Definition bigintmat.cc:1507
bigintmat::hnf
void hnf()
transforms INPLACE to HNF
Definition bigintmat.cc:1655
bigintmat::modhnf
bigintmat * modhnf(number p, coeffs c)
computes HNF(this | p*I)
Definition bigintmat.cc:1824
bigintmat::simplifyContentDen
void simplifyContentDen(number *den)
ensures that Gcd(den, content)=1 enden hier wieder
Definition bigintmat.cc:2672
bigintmat::get
number get(int i, int j) const
get a copy of an entry. NOTE: starts at [1,1]
Definition bigintmat.cc:117
bigintmat::concatcol
void concatcol(bigintmat *a, bigintmat *b)
Definition bigintmat.cc:1093
bigintmat::copySubmatInto
void copySubmatInto(bigintmat *, int sr, int sc, int nr, int nc, int tr, int tc)
copy the submatrix of b, staring at (a,b) having n rows, m cols into the given matrix at pos....
Definition bigintmat.cc:1282
nforder_ideal
Definition nforder_ideal.h:12
nforder
Definition nforder.h:24
nforder::oneIsOne
bool oneIsOne()
Definition nforder.h:84
nforder::basecoeffs
coeffs basecoeffs() const
Definition nforder.h:76
nforder::getDim
int getDim()
Definition nforder.cpp:235
n_Mult
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:639
n_Copy
static FORCE_INLINE number n_Copy(number n, const coeffs r)
return a copy of 'n'
Definition coeffs.h:457
n_Gcd
static FORCE_INLINE number n_Gcd(number a, number b, const coeffs r)
in Z: return the gcd of 'a' and 'b' in Z/nZ, Z/2^kZ: computed as in the case Z in Z/pZ,...
Definition coeffs.h:667
n_Delete
static FORCE_INLINE void n_Delete(number *p, const coeffs r)
delete 'p'
Definition coeffs.h:461
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
B
b *CanonicalForm B
Definition facBivar.cc:52
D
#define D(A)
Definition gentable.cc:128
assume
#define assume(x)
Definition mod2.h:389
coeffs
The main handler for Singular numbers which are suitable for Singular polynomials.
NULL
#define NULL
Definition omList.c:12
A
#define A
Definition sirandom.c:24

## nf_idInit() [1/2]

nforder_ideal * nf_idInit | ( | int | i,
|  | coeffs | O )

Definition at line 259 of file nforder_ideal.cc.

{
nforder *ord = (nforder*) O->data;
coeffs C = ord->basecoeffs();
bigintmat * r = new bigintmat(ord->getDim(), ord->getDim(), C);
r->one();
number I = n_Init(i, C);
r->skalmult(I, C);
nforder_ideal * A = new nforder_ideal(r, O);
delete r;
number n;
n_Power(I, ord->getDim(), &n, C);
A->setNormTransfer(n, n_Init(1, C));
A->setMinTransfer(I, n_Init(1, C));
return A;
}
i
int i
Definition cfEzgcd.cc:132
bigintmat::skalmult
bool skalmult(number b, coeffs c)
Multipliziert zur Matrix den Skalar b hinzu.
Definition bigintmat.cc:933
bigintmat::one
void one()
Macht Matrix (Falls quadratisch) zu Einheitsmatrix.
Definition bigintmat.cc:1320
n_Power
static FORCE_INLINE void n_Power(number a, int b, number *res, const coeffs r)
fill res with the power a^b
Definition coeffs.h:635

## nf_idInit() [2/2]

nforder_ideal * nf_idInit | ( | number | I,
|  | coeffs | O )

Definition at line 276 of file nforder_ideal.cc.

{
nforder *ord = (nforder*) O->data;
bigintmat * r = ord->elRepMat((bigintmat*)I);
nforder_ideal * A = new nforder_ideal(r, O);
delete r;
return A;
}

## nf_idMult() [1/3]

nforder_ideal * nf_idMult | ( | nforder_ideal * | A,
|  | int | b )

Definition at line 285 of file nforder_ideal.cc.

{
nforder * O = (nforder*) A->order()->data;
coeffs C = O->basecoeffs();
bigintmat * s = new bigintmat(A->viewBasis());
number bb = n_Init(b, C);
s->skalmult(bb, C);
n_Delete(&bb, C);
if (A->isFractional()) {
number d = n_Copy(A->viewBasisDen(), C);
s->simplifyContentDen(&d);
nforder_ideal * res = new nforder_ideal(s, A->order());
res->setBasisDenTransfer(d);
return res;
} else {
return new nforder_ideal(s, A->order());
}
}
b
CanonicalForm b
Definition cfModGcd.cc:4111
s
const CanonicalForm int s
Definition facAbsFact.cc:51
res
CanonicalForm res
Definition facAbsFact.cc:60

## nf_idMult() [2/3]

nforder_ideal * nf_idMult | ( | nforder_ideal * | A,
|  | nforder_ideal * | B )

Definition at line 170 of file nforder_ideal.cc.

{
assume(A->order() == B->order());
nforder * O = (nforder*) A->order()->data;
coeffs C = O->basecoeffs();
number den = NULL;
bigintmat * r= NULL;
bigintmat * c = new bigintmat(O->getDim(), 1, C),
*rep = new bigintmat(O->getDim(), O->getDim(), C);
for(int i=0; i<O->getDim(); i++) {
A->viewBasis()->getcol(i+1, c);
O->multmap(c, rep);
bigintmat * cc = bimMult(rep, B->viewBasis());
if (r) {
bigintmat * s = new bigintmat(O->getDim(), r->cols()+O->getDim(), C);
s->concatcol(r, cc);
delete r;
delete cc;
r = s;
} else {
r = cc;
}
}
delete c;
number modA = NULL, modB = NULL;
if (!(modA = A->viewMin())) {
modA = A->viewNorm();
}
if (!(modB = B->viewMin())) {
modB = B->viewNorm();
}
bigintmat * t1;
if (modA && modB) {
number mod = n_Mult(modA, modB, C);
t1 = r->modhnf(mod, C);
n_Delete(&mod, C);
} else {
r->hnf();
t1 = new bigintmat(O->getDim(), O->getDim(), C);
r->getColRange(r->cols()-O->getDim()+1, O->getDim(), t1);
}
delete r;
if (A->isFractional()) {
den = A->viewBasisDen();
}
if (B->isFractional()) {
if (den)
den = n_Mult(den, B->viewBasisDen(), C);
else
den = n_Copy(B->viewBasisDen(), C);
}
if (den) {
t1->simplifyContentDen(&den);
}
nforder_ideal *D = new nforder_ideal(t1, A->order());
if (den)
D->setBasisDenTransfer(den);
if (O->oneIsOne())
D->setMinTransfer(t1->get(1,1), den ? n_Copy(den, C) : n_Init(1, C));
D->setNormTransfer(t1->det(), den ? n_Copy(den, C) : n_Init(1, C));
delete t1;
return D;
}
bimMult
bigintmat * bimMult(bigintmat *a, bigintmat *b)
Definition bigintmat.cc:253
bigintmat::cols
int cols() const
Definition bigintmat.h:144
bigintmat::getColRange
void getColRange(int j, int no, bigintmat *a)
copies the no-columns staring by j (so j...j+no-1) into the pre-allocated a
Definition bigintmat.cc:773
nforder::multmap
void multmap(bigintmat *a, bigintmat *m)
Definition nforder.cpp:404

## nf_idMult() [3/3]

nforder_ideal * nf_idMult | ( | nforder_ideal * | A,
|  | number | b )

Definition at line 241 of file nforder_ideal.cc.

{
nforder * O = (nforder*) A->order()->data;
coeffs C = O->basecoeffs();
bigintmat * r = O->elRepMat((bigintmat*) b);
bigintmat * s = bimMult(r, A->viewBasis());
delete r;
if (A->isFractional()) {
number d = n_Copy(A->viewBasisDen(), C);
s->simplifyContentDen(&d);
nforder_ideal * res = new nforder_ideal(s, A->order());
res->setBasisDenTransfer(d);
return res;
} else {
return new nforder_ideal(s, A->order());
}
}
nforder::elRepMat
bigintmat * elRepMat(bigintmat *a)
Definition nforder.cpp:395

## nf_idPower()

nforder_ideal * nf_idPower | ( | nforder_ideal * | A,
|  | int | i )

Definition at line 305 of file nforder_ideal.cc.

{
if (i==0) {
return nf_idInit(1, A->order());
} else if (i==1) {
return new nforder_ideal(A, 1);
} else if (i<0) {
Werror("not done yet");
return NULL;
} else {
nforder_ideal *B = nf_idPower(A, i/2);
nforder_ideal *res = nf_idMult(B, B);
delete B;
if (i&1) {
nforder_ideal * C = nf_idMult(res, B);
delete res;
return C;
} else {
return res;
}
}
}
nf_idMult
nforder_ideal * nf_idMult(nforder_ideal *A, nforder_ideal *B)
Definition nforder_ideal.cc:170
nf_idPower
nforder_ideal * nf_idPower(nforder_ideal *A, int i)
Definition nforder_ideal.cc:305
nf_idInit
nforder_ideal * nf_idInit(int i, coeffs O)
Definition nforder_ideal.cc:259
Werror
void Werror(const char *fmt,...)
Definition reporter.cc:189