Changeset 4094445 in git


Ignore:
Timestamp:
Mar 28, 2014, 4:35:48 PM (9 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
Children:
921690ebf8f0d44823a8ac66bed9ad966eda11ec
Parents:
4fccbc56dabb217a3412ff62cddfe3dc88be1da623a78e8b3bf0711bab934f457ec78ae86fbd64d7
Message:
Merge pull request #551 from adipopescu/LinearAlg

Separation of LinearAlgebra-related code inside Kernel
Files:
4 added
19 edited
10 moved

Legend:

Unmodified
Added
Removed
  • Singular/claptmpl.cc

    r4fccbc r4094445  
    117117/* next lines are templates used in new minor code */
    118118#include <list>
    119 #include <kernel/Minor.h>
     119#include <kernel/linear_algebra/Minor.h>
    120120#include <kernel/Cache.h>
    121121
  • Singular/eigenval_ip.cc

    r4fccbc r4094445  
    2323#include <polys/matpol.h>
    2424#include <polys/clapsing.h>
    25 #include <kernel/eigenval.h>
     25#include <kernel/linear_algebra/eigenval.h>
    2626#include <Singular/eigenval_ip.h>
    2727
  • Singular/eigenval_ip.h

    r4fccbc r4094445  
    99#define EIGENVAL_IP_H
    1010#ifdef HAVE_EIGENVAL
    11 #include <kernel/eigenval.h>
     11#include <kernel/linear_algebra/eigenval.h>
    1212
    1313BOOLEAN evSwap(leftv res,leftv h);
  • Singular/extra.cc

    r4fccbc r4094445  
    7575
    7676#include <kernel/shiftgb.h>
    77 #include <kernel/linearAlgebra.h>
     77#include <kernel/linear_algebra/linearAlgebra.h>
    7878
    7979#include <kernel/combinatorics/hutil.h>
  • Singular/iparith.cc

    r4fccbc r4094445  
    5050#include <kernel/tgb.h>
    5151#include <kernel/groebner_walk/walkProc.h>
    52 #include <kernel/linearAlgebra.h>
     52#include <kernel/linear_algebra/linearAlgebra.h>
    5353#include <kernel/syz.h>
    5454#include <kernel/timer.h>
     
    6969#include <Singular/attrib.h>
    7070#include <Singular/links/silink.h>
    71 #include <kernel/MinorInterface.h>
     71#include <kernel/linear_algebra/MinorInterface.h>
    7272#include <Singular/misc_ip.h>
    7373#include <Singular/linearAlgebra_ip.h>
     
    75017501{
    75027502  /* compute two factors of h(x,y) modulo x^(d+1) in K[[x]][y],
    7503      see a detailed documentation in /kernel/linearAlgebra.h
     7503     see a detailed documentation in /kernel/linear_algebra/linearAlgebra.h
    75047504
    75057505     valid argument lists:
  • Singular/ipid.cc

    r23a78e r4094445  
    605605const char * piProcinfo(procinfov pi, const char *request)
    606606{
    607   if(pi == NULL) return "empty proc";
     607  if((pi == NULL)||(pi->language==LANG_NONE)) return "empty proc";
    608608  else if (strcmp(request, "libname")  == 0) return pi->libname;
    609609  else if (strcmp(request, "procname") == 0) return pi->procname;
  • Singular/linearAlgebra_ip.cc

    r4fccbc r4094445  
    44#include <kernel/mod2.h>
    55#include <Singular/lists.h>
    6 #include <kernel/linearAlgebra.h>
     6#include <kernel/linear_algebra/linearAlgebra.h>
    77
    88/**
  • Singular/linearAlgebra_ip.h

    r4fccbc r4094445  
    22#define LINEARALGEBRA_H
    33#include <Singular/lists.h>
    4 #include <kernel/linearAlgebra.h>
     4#include <kernel/linear_algebra/linearAlgebra.h>
    55
    66/**
  • Singular/test.cc

    r4fccbc r4094445  
    8888#include <kernel/spectrum/splist.h>
    8989#include <kernel/spectrum/multicnt.h>
    90 #include <kernel/eigenval.h>
     90#include <kernel/linear_algebra/eigenval.h>
    9191#include <kernel/units.h>
    9292#include <kernel/ratgring.h>
     
    9999// #include "CCRing.h" // Too old!
    100100#include <kernel/digitech.h>
    101 #include <kernel/eigenval.h>
     101#include <kernel/linear_algebra/eigenval.h>
    102102#include <kernel/fast_maps.h>
    103103#include <kernel/fast_mult.h>
     
    130130#include <kernel/khstd.h>
    131131
    132 #include <kernel/linearAlgebra.h>
     132#include <kernel/linear_algebra/linearAlgebra.h>
    133133
    134134
  • Tst/Short/ok_s.lst

    r23a78e r4094445  
    7676bug_idlen
    7777bug_interpol
     78bug_misc
    7879bug_mres
    7980bug_napMultT
  • configure.ac

    r4fccbc r4094445  
    206206AC_CONFIG_FILES([kernel/combinatorics/Makefile])
    207207AC_CONFIG_FILES([kernel/spectrum/Makefile])
     208AC_CONFIG_FILES([kernel/linear_algebra/Makefile])
    208209
    209210AC_CONFIG_SUBDIRS([gfanlib])
  • kernel/Makefile.am

    r4fccbc r4094445  
    22# TODO: use ${top_srcdir} instead of .. in the above?
    33
    4 SUBDIRS=sample numeric fglm groebner_walk combinatorics spectrum
     4SUBDIRS=sample numeric fglm groebner_walk combinatorics spectrum linear_algebra
    55# kernelsample   
    66
     
    2222    syz.cc syz0.cc syz1.cc syz2.cc syz3.cc \
    2323    timer.cc \
    24     eigenval.cc units.cc \
     24    units.cc \
    2525    fast_mult.cc digitech.cc \
    2626    tgb.cc tgbgauss.cc ringgb.cc f5data.cc f5lists.cc f5gb.cc f5c.cc \
    2727    ratgring.cc shiftgb.cc \
    28     linearAlgebra.cc preimage.cc \
     28    preimage.cc \
    2929    mod2.h \
    30     janet.cc interpolation.cc minpoly.cc \
    31     Minor.cc MinorInterface.cc MinorProcessor.cc
     30    janet.cc interpolation.cc minpoly.cc
    3231 
    33 
    3432libkernel_la_SOURCES   = $(SOURCES)
    3533
     
    4240        kutil.h \
    4341        khstd.h kstd1.h \
    44         eigenval.h units.h \
     42        units.h \
    4543        ratgring.h shiftgb.h nc.h \
    4644        preimage.h timer.h kInline.h fast_mult.h \
    4745        digitech.h tgb.h ringgb.h tgbgauss.h tgb_internal.h \
    48         linearAlgebra.h \
    4946        f5c.h f5data.h f5gb.h f5lists.h \
    5047        janet.h interpolation.h minpoly.h \
    51         Minor.h MinorInterface.h MinorProcessor.h Cache.h CacheImplementation.h
     48        Cache.h CacheImplementation.h
    5249
    5350libkernel_la_includedir  =${includedir}/singular/kernel
     
    6158${builddir}/combinatorics/libcombinatorics.la \
    6259${builddir}/spectrum/libspectrum.la \
     60${builddir}/linear_algebra/liblinear_algebra.la \
    6361${USEPPROCSDYNAMICLDFLAGS} ${USEPPROCSDYNAMICLD} \
    6462${abs_top_builddir}/libpolys/polys/libpolys.la
  • kernel/ideals.cc

    r23a78e r4094445  
    20992099  ring orig_ring=currRing;
    21002100  ring syz_ring=rAssure_SyzComp(orig_ring, TRUE); rChangeCurrRing(syz_ring);
    2101   rSetSyzComp(length, syz_ring);
     2101  if (TEST_OPT_RETURN_SB)
     2102    rSetSyzComp(id_RankFreeModule(temp,orig_ring), syz_ring);
     2103  else
     2104    rSetSyzComp(length, syz_ring);
    21022105  ideal s_temp;
    21032106
  • kernel/linear_algebra/Minor.cc

    r4fccbc r4094445  
    44#include <kernel/mod2.h>
    55
    6 #include "Minor.h"
     6#include <kernel/linear_algebra/Minor.h>
    77
    88#include <kernel/structs.h>
  • kernel/linear_algebra/MinorInterface.cc

    r4fccbc r4094445  
    77// #include <cstdio>
    88
    9 #include "MinorInterface.h"
    10 #include "MinorProcessor.h"
     9#include <kernel/linear_algebra/MinorInterface.h>
     10#include <kernel/linear_algebra/MinorProcessor.h>
    1111
    1212#include <polys/simpleideals.h>
  • kernel/linear_algebra/MinorProcessor.cc

    r4fccbc r4094445  
    44#include <kernel/mod2.h>
    55
    6 #include "MinorProcessor.h"
     6#include <kernel/linear_algebra/MinorProcessor.h>
    77
    88#include <polys/kbuckets.h>
  • kernel/linear_algebra/MinorProcessor.h

    r4fccbc r4094445  
    22#define MINOR_PROCESSOR_H
    33
    4 #include "Cache.h"
     4#include <kernel/Cache.h>
    55#include "Minor.h"
    66
  • kernel/linear_algebra/eigenval.cc

    r4fccbc r4094445  
    2323#include <polys/matpol.h>
    2424#include <polys/clapsing.h>
    25 #include <kernel/eigenval.h>
     25#include <kernel/linear_algebra/eigenval.h>
    2626
    2727
  • kernel/linear_algebra/linearAlgebra.cc

    r4fccbc r4094445  
    1919#include "singularconfig.h"
    2020#endif /* HAVE_CONFIG_H */
    21 #include "mod2.h"
     21#include <kernel/mod2.h>
    2222
    2323#include <coeffs/coeffs.h>
     
    3333#include <kernel/structs.h>
    3434#include <kernel/ideals.h>
    35 #include <kernel/linearAlgebra.h>
     35#include <kernel/linear_algebra/linearAlgebra.h>
    3636
    3737/**
  • kernel/numeric/mpr_inout.cc

    r23a78e r4094445  
    5656#define TIMING_EPR(t,msg) TIMING_END_AND_PRINT(t,msg);TIMING_RESET(t);
    5757
    58 extern size_t gmp_output_digits;
    5958//<-
    6059
  • kernel/numeric/mpr_numeric.cc

    r23a78e r4094445  
    4343//#include "longrat.h"
    4444
     45#include "mpr_base.h"
    4546#include "mpr_numeric.h"
    4647
    4748#include <math.h>
    48 
    49 extern size_t gmp_output_digits;
    5049//<-
    5150
  • kernel/test.cc

    r4fccbc r4094445  
    9393#include <kernel/spectrum/splist.h>
    9494#include <kernel/spectrum/multicnt.h>
    95 #include <kernel/eigenval.h>
     95#include <kernel/linear_algebra/eigenval.h>
    9696#include <kernel/units.h>
    9797#include <kernel/ratgring.h>
     
    103103// #include "CCRing.h" // Too old!
    104104#include <kernel/digitech.h>
    105 #include <kernel/eigenval.h>
     105#include <kernel/linear_algebra/eigenval.h>
    106106#include <kernel/fast_maps.h>
    107107#include <kernel/fast_mult.h>
     
    130130#include <kernel/khstd.h>
    131131
    132 #include <kernel/linearAlgebra.h>
     132#include <kernel/linear_algebra/linearAlgebra.h>
    133133
    134134
     
    170170#include <kernel/minpoly.h>
    171171
    172 #include <kernel/Minor.h>
    173 #include <kernel/MinorInterface.h>
    174 #include <kernel/MinorProcessor.h>
     172#include <kernel/linear_algebra/Minor.h>
     173#include <kernel/linear_algebra/MinorInterface.h>
     174#include <kernel/linear_algebra/MinorProcessor.h>
    175175#include <kernel/Cache.h>
    176176#include <kernel/CacheImplementation.h>
  • libpolys/coeffs/coeffs.h

    r23a78e r4094445  
    124124                                // or NULL
    125125   // general stuff
     126   //   if the ring has a meaningful Euclidean structure, hopefully
     127   //   supported by cfQuotRem, then
     128   //     IntMod, IntDiv should give the same result
     129   //     IntDiv(a,b) = QuotRem(a,b, &IntMod(a,b))
     130   //   if the ring is not Euclidean, then IntMod should return 0
     131   //   and IntDiv the exact quotient. It is assumed that the function is
     132   //   ONLY called on Euclidean rings or in the case of an exact division.
     133   //
     134   //   cfDiv does an exact division, but has to handle illegal input
     135   //   cfExactDiv does an exact division, but no error checking
     136   //   (I'm not sure I understant and even less that this makes sense)
    126137   numberfunc cfMult, cfSub ,cfAdd ,cfDiv, cfIntDiv, cfIntMod, cfExactDiv;
    127138
     
    159170   void    (*cfWriteShort)(number &a, const coeffs r);
    160171
     172   // it is legal, but not always useful to have cfRead(s, a, r)
     173   //   just return s again.
     174   // Useful application (read constants which are not an projection
     175   // from int/bigint:
     176   // Let ring r = R,x,dp;
     177   // where R is a coeffs having "special" "named" elements (ie.
     178   // the primitive element in some algebraic extension).
     179   // If there is no interpreter variable of the same name, it is
     180   // difficult to create non-trivial elements in R.
     181   // Hence one can use the string to allow creation of R-elts using the
     182   // unbound name of the special element.
    161183   const char *  (*cfRead)(const char * s, number * a, const coeffs r);
     184
    162185   void    (*cfNormalize)(number &a, const coeffs r);
    163 
    164 
    165186
    166187   BOOLEAN (*cfGreater)(number a,number b, const coeffs r),
     
    170191           (*cfIsOne)(number a, const coeffs r),
    171192           (*cfIsMOne)(number a, const coeffs r),
     193       //GreaterZero is used for printing of polynomials:
     194       //  a "+" is only printed in front of a coefficient
     195       //  if the element is >0. It is assumed that any element
     196       //  failing this will start printing with a leading "-"
    172197           (*cfGreaterZero)(number a, const coeffs r);
    173198
     
    175200   number  (*cfGetDenom)(number &n, const coeffs r);
    176201   number  (*cfGetNumerator)(number &n, const coeffs r);
     202   //CF: a Euclidean ring is a commutative, unitary ring with an Euclidean
     203   //  function f s.th. for all a,b in R, b ne 0, we can find q, r s.th.
     204   //  a = qb+r and either r=0 or f(r) < f(b)
     205   //  Note that neither q nor r nor f(r) are unique.
    177206   number  (*cfGcd)(number a, number b, const coeffs r);
    178207   number  (*cfExtGcd)(number a, number b, number *s, number *t,const coeffs r);
     208   //given a and b in a Euclidean setting, return s,t,u,v sth.
     209   //  sa + tb = gcd
     210   //  ua + vb = 0
     211   //  sv + tu = 1
     212   //  ie. the 2x2 matrix (s t | u v) is unimodular and maps (a,b) to (g, 0)
     213   //CF: note, in general, this cannot be derived from ExtGcd due to
     214   //    zero divisors
     215   number  (*cfXExtGcd)(number a, number b, number *s, number *t, number *u, number *v, const coeffs r);
     216   //in a Euclidean ring, return the Euclidean norm as a bigint (of type number)
     217   number  (*cfEucNorm)(number a, const coeffs r);
     218   //in a principal ideal ring (with zero divisors): the annihilator
     219   number  (*cfAnn)(number a, const coeffs r);
     220   //find a "canonical representative of a modulo the units of r
     221   //return NULL if a is already normalized
     222   //otherwise, the factor.
     223   //(for Z: make positive, for z/nZ make the gcd with n
     224   //aparently it is GetUnit!
     225   //in a Euclidean ring, return the quotient and compute the remainder
     226   //rem can be NULL
     227   number  (*cfQuotRem)(number a, number b, number *rem, const coeffs r);
    179228   number  (*cfLcm)(number a, number b, const coeffs r);
    180229   void    (*cfDelete)(number * a, const coeffs r);
     230
     231   //CF: tries to find a canonical map from src -> dst
    181232   nMapFunc (*cfSetMap)(const coeffs src, const coeffs dst);
    182233
     
    199250   number  (*cfInit_bigint)(number i, const coeffs dummy, const coeffs dst);
    200251
    201    /// rational reconstruction: best rational with mod p=n
     252   /// rational reconstruction: "best" rational a/b with a/b = p mod n
     253   //  or a = bp mod n
     254   //  CF: no idea what this would be in general
     255   //     it seems to be extended to operate coefficient wise in extensions.
     256   //     I presume then n in coeffs_BIGINT while p in coeffs
    202257   number  (*cfFarey)(number p, number n, const coeffs);
    203258
    204259   /// chinese remainder
    205260   /// returns X with X mod q[i]=x[i], i=0..rl-1
     261   //CF: by the looks of it: q[i] in Z (coeffs_BIGINT)
     262   //    strange things happen in naChineseRemainder for example.
    206263   number  (*cfChineseRemainder)(number *x, number *q,int rl, BOOLEAN sym,const coeffs);
    207264
     
    218275   nCoeffsEnumeratorFunc cfClearDenominators;
    219276
     277   /// conversion to CanonicalForm(factory) to number
    220278   number (*convFactoryNSingN)( const CanonicalForm n, const coeffs r);
    221279   CanonicalForm (*convSingNFactoryN)( number n, BOOLEAN setChar, const coeffs r );
     
    224282   /// the 0 as constant, NULL by default
    225283   number nNULL;
    226    int     char_flag;
    227284   int     ref;
    228285   /// how many variables of factort are already used by this coeff
     
    294351   BOOLEAN (*cfIsUnit)(number a,const coeffs r);
    295352   number  (*cfGetUnit)(number a,const coeffs r);
     353   //CF: test if b divides a
    296354   BOOLEAN (*cfDivBy)(number a, number b, const coeffs r);
    297355  /* The following members are for representing the ring Z/n,
     
    319377  unsigned long mod2mMask;
    320378#endif
     379  /*CF: for blackbox rings */
     380  void * data;
    321381#ifdef LDEBUG
    322382   // must be last entry:
     
    441501/// in Z/2^kZ: largest odd divisor of n (taken in Z)
    442502/// other cases: not implemented
     503// CF: shold imply that n/GetUnit(n) is normalized in Z/kZ
     504//   it would make more sense to return the inverse...
    443505static inline number n_GetUnit(number n, const coeffs r)
    444506{ assume(r != NULL); assume(r->cfGetUnit!=NULL); return r->cfGetUnit(n,r); }
     
    490552
    491553/// write to the output buffer of the currently used reporter
     554//CF: the "&" should be removed, as one wants to write constants as well
    492555static inline void   n_WriteLong(number& n,  const coeffs r)
    493556{ assume(r != NULL); assume(r->cfWriteLong!=NULL); r->cfWriteLong(n,r); }
     
    558621/// in K(t_1, ..., t_n): return a/b
    559622/// other fields: not implemented
     623// CF: see above: should be part of euclidean structure.
     624//   Needs to be implemented as pnBin relies on it.
     625//   Probably should default to Div.
    560626static inline number n_IntDiv(number a, number b, const coeffs r)
    561627{ assume(r != NULL); assume(r->cfIntDiv!=NULL); return r->cfIntDiv(a,b,r); }
     
    584650static inline number n_ExtGcd(number a, number b, number *s, number *t, const coeffs r)
    585651{ assume(r != NULL); assume(r->cfExtGcd!=NULL); return r->cfExtGcd (a,b,s,t,r); }
     652static inline number n_XExtGcd(number a, number b, number *s, number *t, number *u, number *v, const coeffs r)
     653{ assume(r != NULL); assume(r->cfXExtGcd!=NULL); return r->cfXExtGcd (a,b,s,t,u,v,r); }
     654static inline number  n_EucNorm(number a, const coeffs r)
     655{ assume(r != NULL); assume(r->cfEucNorm!=NULL); return r->cfEucNorm (a,r); }
     656static inline number  n_Ann(number a, const coeffs r)
     657{ assume(r != NULL); assume(r->cfAnn!=NULL); return r->cfAnn (a,r); }
     658static inline number  n_QuotRem(number a, number b, number *q, const coeffs r)
     659{ assume(r != NULL); assume(r->cfQuotRem!=NULL); return r->cfQuotRem (a,b,q,r); }
     660
    586661
    587662/// in Z: return the lcm of 'a' and 'b'
  • libpolys/coeffs/longrat.h

    r23a78e r4094445  
    9999
    100100number   nlInit2 (int i, int j, const coeffs r);
    101 number   nlInit2gmp (mpz_t i, mpz_t j);
     101number   nlInit2gmp (mpz_t i, mpz_t j, const coeffs r);
    102102
    103103// number nlInitMPZ(mpz_t m, const coeffs r);
Note: See TracChangeset for help on using the changeset viewer.