Changeset e5be1c in git


Ignore:
Timestamp:
Jul 29, 2014, 4:23:29 PM (10 years ago)
Author:
Claus Fieker <fieker@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '8c6038b526213d378981739e978a9f7b485dab94')
Children:
8171d314f9caa19be1e89c132f9948a0faddeb29
Parents:
d21b700adb5e8106ab69ce599d924b7818ffb9ad
git-author:
Claus Fieker <fieker@mathematik.uni-kl.de>2014-07-29 16:23:29+02:00
git-committer:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2014-07-29 17:10:18+02:00
Message:
comments - documentation
Location:
libpolys/coeffs
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • libpolys/coeffs/bigintmat.cc

    rd21b70 re5be1c  
    11851185}
    11861186
    1187 // copy the submatrix of b, staring at (a,b) having n rows, m cols into
    1188 // the given matrix at pos. (c,d)
    1189 // needs c+n, d+m <= rows, cols
    1190 //       a+n, b+m <= b.rows(), b.cols()
     1187/// copy the submatrix of b, staring at (a,b) having n rows, m cols into
     1188/// the given matrix at pos. (c,d)
     1189/// needs c+n, d+m <= rows, cols
     1190///       a+n, b+m <= b.rows(), b.cols()
    11911191void bigintmat::copySubmatInto(bigintmat *B, int a, int b, int n, int m, int c, int d)
    11921192{
     
    24362436
    24372437
    2438 //create Z/nA of type n_Zn
     2438///create Z/nA of type n_Zn
    24392439coeffs numbercoeffs(number n, coeffs c) {
    24402440  mpz_t p;
  • libpolys/coeffs/bigintmat.h

    rd21b70 re5be1c  
    33****************************************/
    44/*
    5 * ABSTRACT: class bigintmat: matrizes of big integers
     5* ABSTRACT: class bigintmat: matrices of number
     6*
     7* Matrices are stored as 1-dim c-arrays but interpreted 2-dim as matrices.
     8* Both modes of addressing are supported, note however, that the 1-dim
     9* adressing starts at 0, the 2-dim at 1.
     10*
     11* Matrices are meant to represent column modules, thus the default
     12* operations are always by column.
     13*
     14* While basic operations are supported over any ring (coeff), some more
     15* advanced ones require more special rings: eg. echelon forms, solving
     16* of linear equations is only effective over principal ideal or even
     17* Euclidean rings.
     18*
     19* Be careful with the get/set/view/rawset functions to understand which
     20* arguments are copied/ deleted or only assigned.
    621*/
    722
     
    2843
    2944    bigintmat * transpose();
     45
     46    /// transpose in place
    3047    void inpTranspose();
    3148
     49
     50    /// constructor: the r times c zero-matrix. Beware that the creation
     51    /// of a large zero matrix is expensive in terms of time and memory.
    3252    bigintmat(int r, int c, const coeffs n): m_coeffs(n), v(NULL), row(r), col(c)
    3353    {
     
    4969    }
    5070
     71    /// copy constructor
    5172    bigintmat(const bigintmat *m): m_coeffs(m->basecoeffs()), v(NULL), row(m->rows()), col(m->cols())
    5273    {
     
    7091      }
    7192    }
     93    /// dubious: 1-dim access to 2-dim array. Entries are read row by row.
    7294    inline number& operator[](int i)
    7395    {
     
    98120    /// UEberladener *=-Operator (fuer int und bigint)
    99121    /// Frage hier: *= verwenden oder lieber = und * einzeln?
     122    /// problem: what about non-commuting rings. Is this from left or right?
    100123    void operator*=(int intop);
    101124
     125    /// inplace versio of skalar mult. CHANGES input.
    102126    void inpMult(number bintop, const coeffs C = NULL);
    103127
     
    107131    inline coeffs basecoeffs() const { return m_coeffs; }
    108132
     133    /// canonical destructor.
    109134    ~bigintmat()
    110135    {
     
    117142    }
    118143
     144    /// helper function to map from 2-dim coordinates, starting by 1 to
     145    /// 1-dim coordinate, starting by 0
    119146    int index(int r, int c) const
    120147    {
     
    138165    /// get a copy of an entry. NOTE: starts at [0]
    139166    number get(int i) const;
     167    /// view an entry. NOTE: starts at [0]
    140168    number view(int i) const;
    141169
     
    150178
    151179    /// replace an entry with the given number n (only delete old).
    152     /// NOTE: starts at [0]
     180    /// NOTE: starts at [0]. Should be named set_transfer
    153181    inline void rawset(int i, number n, const coeffs C = NULL)
    154182    {
     
    170198    }
    171199
     200    /// as above, but the 2-dim version
    172201    inline void rawset(int i, int j, number n, const coeffs C = NULL)
    173202    {
     
    175204    }
    176205
     206    ///IO: String returns a singular string containing the matrix, needs
     207    /// freeing afterwards
    177208    char * String();
     209    ///IO: writes the matrix into the current internal string buffer which
     210    /// must be started/ allocated before (e.g. @StringSetS)
    178211    void Write();
     212    ///IO: simply prints the matrix to the current output (screen?)
    179213    void Print();
    180214/***
     
    191225    // !WICHTIG: Überall, wo eine number ÃŒbergeben wird, und damit gearbeitet wird, die coeffs mitÃŒbergeben und erst
    192226    // ÃŒberprÃŒfen, ob diese mit basecoeffs ÃŒbereinstimmen. Falls nein: Breche ab!
    193     // Genauere Beschreibung der Funktionen in der Funktionen.odt
    194     void swap(int i, int j); // Vertauscht i-te und j-te Spalte
    195     void swaprow(int i, int j); // Vertauscht i-te und j-te Zeile
    196     int findnonzero(int i); // liefert Index des ersten nicht-Null Eintrages in Zeile i
    197     int findcolnonzero(int j); // ---"--- Spalte j
    198     void getcol(int j, bigintmat *a); // Schreibt j-te Spalte in Vektor (Matrix) a
    199                                       // matrix needs to be pre-allocated
    200     void getColRange(int j, int no, bigintmat *a); // copies col j..j+no-1 into cols 1..no of a
     227    /// swap columns i and j
     228    void swap(int i, int j);
     229
     230    /// swap rows i and j
     231    void swaprow(int i, int j);
     232
     233    ///find index of 1st non-zero entry in row i
     234    int findnonzero(int i);
     235
     236    ///find index of 1st non-zero entry in column j
     237    int findcolnonzero(int j);
     238
     239    ///copies the j-th column into the matrix a - which needs to be pre-allocated with the correct size.
     240    void getcol(int j, bigintmat *a);
     241                                   
     242    ///copies the no-columns staring by j (so j...j+no-1) into the pre-allocated a
     243    void getColRange(int j, int no, bigintmat *a);
     244
    201245    void getrow(int i, bigintmat *a); // Schreibt i-te Zeile in Vektor (Matrix) a
    202246    void setcol(int j, bigintmat *m); // Setzt j-te Spalte gleich ÃŒbergebenem Vektor (Matrix) m
    203247    void setrow(int i, bigintmat *m); // Setzt i-te Zeile gleich ÃŒbergebenem Vektor (Matrix) m
    204     void appendCol (bigintmat *a);  // horizontally joins the matrices. Old 1st
     248
     249    ///horizontally join the matrices, m <- m|a
     250    void appendCol (bigintmat *a); 
     251
     252    ///append i zero-columns to the matrix
    205253    void extendCols (int i);
     254
    206255    bool add(bigintmat *b); // Addiert zur Matrix die Matrix b dazu. Return false => an error occured
    207256    bool sub(bigintmat *b); // Subtrahiert ...
     
    210259    bool addrow(int i, int j, number a, coeffs c); // ... Zeile ...
    211260    void colskalmult(int i, number a, coeffs c); // Multipliziert zur i-ten Spalte den Skalar a hinzu
     261    void rowskalmult(int i, number a, coeffs c); // ... Zeile ...
    212262    void coltransform(int i, int j, number a, number b, number c, number d); //  transforms cols (i,j) using the 2x2 matrix ((a,b)(c,d)) (hopefully)
    213     void rowskalmult(int i, number a, coeffs c); // ... Zeile ...
    214263    void concatrow(bigintmat *a, bigintmat *b); // FÃŒgt zwei Matrixen untereinander/nebeneinander in gegebene Matrix ein, bzw spaltet gegebenen Matrix auf
    215264    void concatcol(bigintmat *a, bigintmat *b);
     
    230279    number det(); // det (via LaPlace in general, hnf for euc. rings)
    231280    number hnfdet(); // det via HNF
    232     // Primzahlen als long long int, mÃŒssen noch in number umgewandelt werden?
     281    /// Primzahlen als long long int, mÃŒssen noch in number umgewandelt werden?
    233282    void hnf(); // transforms INPLACE to HNF
    234283    void howell(); //dito, but Howell form (only different for zero-divsors)
     
    240289    void mod(number p, coeffs c); // Reduziert komplette Matrix modulo p
    241290    bigintmat* inpmod(number p, coeffs c); // Liefert Kopie der Matrix zurÃŒck, allerdings im Ring Z modulo p
    242     number content();  //the content
     291    number content(); //the content, the gcd of all entries. Only makes sense for Euclidean rings (or possibly constructive PIR)
    243292    void simplifyContentDen(number *den); // ensures that Gcd(den, content)=1
    244293    // enden hier wieder
     
    257306bigintmat * bimMult(bigintmat * a, int b);
    258307bigintmat * bimMult(bigintmat * a, number b, const coeffs cf);
     308
     309///same as copy constructor - apart from it being able to accept NULL as input
    259310bigintmat * bimCopy(const bigintmat * b);
    260311
     
    266317bigintmat * bimChangeCoeff(bigintmat *a, coeffs cnew); // Liefert Kopier von Matrix a zurÃŒck, mit coeffs cnew statt den ursprÃŒnglichen
    267318void bimMult(bigintmat *a, bigintmat *b, bigintmat *c); // Multipliziert Matrix a und b und speichert Ergebnis in c
     319
     320///solve Ax=b*d. x needs to be pre-allocated to the same number of columns as b.
     321/// the minimal denominator d is returned. Currently available for Z, Q and Z/nZ (and possibly for all fields: d=1 there)
     322///Beware that the internal functions can find the kernel as well - but the interface is lacking.
    268323number solveAx(bigintmat *A, bigintmat *b, bigintmat *x); // solves Ax=b*d for a minimal denominator d. if x needs to have as many cols as b
     324
     325///a basis for the nullspace of a mod p: only used internally in Round2.
     326/// Don't use it.
    269327int kernbase (bigintmat *a, bigintmat *c, number p, coeffs q);
    270328coeffs numbercoeffs(number n, coeffs c);
  • libpolys/coeffs/coeffs.h

    rd21b70 re5be1c  
    487487/// !!! Do not follow this recommendation: while writing polys,
    488488/// !!! between 2 monomials will be an additional + iff !n_GreaterZero(next coeff)
     489///     Then change definition to include n_GreaterZero => printing does NOT
     490///     start with -
    489491///
    490492static inline BOOLEAN n_GreaterZero(number n, const coeffs r)
Note: See TracChangeset for help on using the changeset viewer.