Changeset 2f436b in git


Ignore:
Timestamp:
Dec 31, 2000, 4:14:47 PM (22 years ago)
Author:
Olaf Bachmann <obachman@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a657104b677b4c461d018cbf3204d72d34ad66a9')
Children:
e609098c45a74ac91c002ffa7ece5eebe7f8c002
Parents:
33ec1145a109507ad3e3cf4a69a847b703358e93
Message:
* version 1-3-13: sparsemat improivements


git-svn-id: file:///usr/local/Singular/svn/trunk@5003 2c84dea3-7e68-4137-9b89-c4e89433aadc
Location:
Singular
Files:
2 added
45 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/general.lib

    r33ec11 r2f436b  
    22//anne, added deleteSublist and watchdog 12.12.2000
    33///////////////////////////////////////////////////////////////////////////////
    4 version="$Id: general.lib,v 1.33 2000-12-30 03:00:57 greuel Exp $";
     4version="$Id: general.lib,v 1.34 2000-12-31 15:14:46 obachman Exp $";
    55category="General purpose";
    66info="
     
    271271EXAMPLE:  example factorial; shows an example
    272272"
    273 {   int str,l,p;
     273{   int l,p;
    274274//---------------------------- initialization -------------------------------
    275275   if ( size(#) == 0 )
    276    {  str = 1;
     276   { 
    277277      ring bin = 0,x,dp;
    278278      number r=1;
     
    284284      {
    285285         if ( p == char(basering) )
    286          {  number r=1;
     286         {
     287           // do it clever !
     288           if (n < 1) {return (0);}
     289           if (! defined(sv_factorials))
     290           {
     291             ideal sv_factorials;
     292             sv_factorials[1] = 1;
     293             export(sv_factorials);
     294           }
     295           if (n > size(sv_factorials))
     296           {
     297             int i = size(sv_factorials);
     298             sv_factorials[n] = 0;
     299             number fi = number(sv_factorials[i]);
     300             for (i++;i<=n;i++)
     301             {
     302               fi = fi * i;
     303               sv_factorials[i] = fi;
     304             }
     305             return (fi);
     306           }
     307           else
     308           {
     309             return (number(sv_factorials[n]));
     310           }
    287311         }
    288312         else
    289          {  str = 1;
     313         { 
    290314            ring bin = p,x,dp;
    291315            number r=1;
     
    293317      }
    294318      else
    295       {  str = 1;
     319      { 
    296320         ring bin = p,x,dp;
    297321         number r=1;
     
    303327      r=r*l;
    304328   }
    305    if ( str==1 ) { return(string(r)); }
    306    else { return(r); }
     329   return(string(r));
    307330}
    308331example
     
    313336   p;
    314337}
     338   
     339       
    315340///////////////////////////////////////////////////////////////////////////////
    316341
  • Singular/LIB/poly.lib

    r33ec11 r2f436b  
    11///////////////////////////////////////////////////////////////////////////////
    2 version="$Id: poly.lib,v 1.30 2000-12-31 01:55:11 greuel Exp $";
     2version="$Id: poly.lib,v 1.31 2000-12-31 15:14:47 obachman Exp $";
    33category="General purpose";
    44info="
     
    752752{
    753753  poly p = cleardenom(n+var(1));
    754   return (coeffs(p,var(1))[1,1]);
     754  return (number(coeffs(p,var(1))[1,1]));
    755755}
    756756example
     
    771771{
    772772  poly p = cleardenom(n+var(1));
    773   return (coeffs(p,var(1))[2,1]);
     773  return (number(coeffs(p,var(1))[2,1]));
    774774}
    775775example
  • Singular/LIB/tst.lib

    r33ec11 r2f436b  
    1 // $Id: tst.lib,v 1.30 2000-12-22 15:05:57 greuel Exp $
     1// $Id: tst.lib,v 1.31 2000-12-31 15:14:47 obachman Exp $
    22//(obachman, last modified 6/30/98)
    33/////////////////////////////////////////////////////////////////////////////
    44
    5 version="$Id: tst.lib,v 1.30 2000-12-22 15:05:57 greuel Exp $";
     5version="$Id: tst.lib,v 1.31 2000-12-31 15:14:47 obachman Exp $";
    66category="Utilities";
    77info="
     
    1414 tst_init()             writes some identification data to GetTstStatusFile()
    1515 tst_status([any])      writes status info to to GetTstStatusFile()
     16 tst_InitTimer()        initialize tst-Timer
     17 tst_StopTimer()        stop Tst-Timer
     18 tst_GetTimer           get value of Tst-Timer
     19 tst_ReportTimer        report value of Tst-Timer
    1620 tst_groebnerTest(ideal i)
    1721                        tests groebner command
     
    186190
    187191proc tst_status (list #)
    188 "USAGE:   tst_status([any])
    189 RETURN:   none; writes to stdout the current memory usage and used time
    190           since last call to tst_status(), if no argument is given, or,
    191           since start-up of Singular, if an argument is given.
     192"USAGE:   tst_status([prefix [, start_up]])
     193           prefix -- string
     194           start_up -- int
     195RETURN:   none
     196PURPOSE: writes to tst-output the current memory usage and used CPU time.
     197         If no integer argument is given, the elapsed CPU time since
     198         the last call to tst_status() is reported.
     199         If an integer argument is given, the elapsed CPU time since the
     200         start-up of Singular is reported.
     201         If prefix is given, output reported start with prefix.
    192202NOTE:     Should be used regularly within tst files to enable automatic
    193203          tracking of memory and time performance.
    194204EXAMPLE: example tst_status; shows example
     205SEE ALSO: tst_init
    195206"
    196207{
     208  int start_up;
     209 
     210  if (size(#) > 0)
     211  {
     212    if (typeof(#[1]) == "string")
     213    {
     214      string prefix = #[1];
     215      if (size(#) > 1)
     216      {
     217        start_up = 1;
     218      }
     219    }
     220    else
     221    {
     222      start_up = 1;
     223    }
     224  }
    197225  if (! defined(tst_no_status))
    198226  {
     
    207235    }
    208236
    209     tst_status_out(tst_status_counter, "tst_memory_0", memory(0));
    210     tst_status_out(tst_status_counter, "tst_memory_1", memory(1));
    211     tst_status_out(tst_status_counter, "tst_memory_2", memory(2));
    212     if (size(#) > 0)
    213     {
    214       tst_status_out(tst_status_counter, "tst_timer_1", timer);
     237    if (!defined(prefix))
     238    {
     239      def prefix = tst_status_counter;
     240    }
     241    tst_status_out(prefix, "tst_memory_0", memory(0));
     242    tst_status_out(prefix, "tst_memory_1", memory(1));
     243    tst_status_out(prefix, "tst_memory_2", memory(2));
     244    if (start_up > 0)
     245    {
     246      tst_status_out(prefix, "tst_timer_1", timer);
    215247    }
    216248    else
    217249    {
    218       tst_status_out(tst_status_counter, "tst_timer", timer - Get_tst_timer());
     250      tst_status_out(prefix, "tst_timer", timer - Get_tst_timer());
    219251      Set_tst_timer(timer);
    220252    }
     
    232264
    233265
    234 proc tst_init()
    235 "USAGE:   tst_init()
    236 RETURN:  none; writes some identification data to stdout;
    237          should be called as first routine in a tst file
     266proc tst_init(list #)
     267"USAGE:   tst_init([file])
     268            file -- string
     269RETURN:  none
     270PURPOSE: initializes further calls to tst routines:
     271         If no arguments are given, and if tst_status_file is not defined,
     272         then tst-output is written to stdout, else tst-output is written
     273         to file.
    238274EXAMPLE: example tst_init; shows example
    239275"
     
    241277  if (! defined(tst_no_status))
    242278  {
    243     write(":w " + GetTstStatusFile(), "Status Output of " + GetTstStatusFile());
     279    string outfile = "";
     280   
     281    if (size(#) > 0)
     282    {
     283      if (typeof(#[1]) == string)
     284      {
     285        outfile  = #[1];
     286      }
     287    }
     288    if (!defined(tst_status_file))
     289    {
     290      string tst_status_file = outfile;
     291      export tst_status_file;
     292    }
     293    if (GetTstStatusFile() != "")
     294    {
     295      write(":w " + GetTstStatusFile(), "Status Output of " + GetTstStatusFile());
     296    }
    244297    tst_status_out("init", "USER    :" + system("getenv", "USER"));
    245298    tst_status_out("init", "HOSTNAME:" + tst_system("hostname", 1));
     
    255308  "EXAMPLE";  echo = 2;
    256309  tst_init();
     310}
     311
     312proc tst_InitTimer(list #)
     313"USAGE: tst_InitTime([ticks_per_second])
     314          ticks_per_second -- int
     315RETURN: none
     316PURPOSE: initializes tst timer for subsequent calls to tst_StopTimer or
     317         tst_ReportTimer.
     318         If the ticks_per_second argument is given, then the timer resolution
     319         is set to this value. Otherwise, the default timer resolution is used.
     320SEE ALSO: tst_StopTimer, tst_GetTimer, tst_ReportTimer
     321"
     322{
     323  if (!defined(tst_Timer))
     324  {
     325    int tst_Timer;
     326    export tst_Timer;
     327  }
     328  if (size(#) > 0)
     329  {
     330    if (typeof(#[1]) == "int")
     331    {
     332      if (#[1] > 0)
     333      {
     334        system("--ticks-per-sec", #[1]);
     335      }
     336      else
     337      {
     338        ERROR("need integer argument > 0");
     339      }
     340    }
     341    else
     342    {
     343      ERROR("need integer argument");
     344    }
     345  }
     346  tst_Timer = timer;
     347}
     348
     349proc tst_StopTimer()
     350"USAGE: tst_StopTimer()
     351RETURN: int, timer ticks of elapsed CPU time since last call to tst_InitTimer
     352PUPOSE: stops the timer initialized by previous call to tst_InitTimer
     353SEE ALSO: tst_InitTimer, tst_GetTimer, tst_ReportTimer
     354"
     355{
     356  tst_Timer = timer - tst_Timer;
     357  return (tst_Timer);
     358}
     359
     360proc tst_GetTimer()
     361"USAGE: tst_GetTimer()
     362RETURN: int, timer ticks of elapsed CPU time since last call to tst_Init
     363NOTE:  does NOT stop the time initialized by previous call to tst_InitTimer
     364SEE ALSO: tst_InitTimer, tst_GetTimer, tst_ReportTimer
     365"
     366{
     367  int tt = timer - tst_Timer;
     368  return (tt);
     369}
     370
     371proc tst_ReportTimer(list #)
     372"USAGE: tst_ReportTimer([prefix])
     373RETURN: none
     374PUPOSE: stops the timer initialized by previous call to tst_InitTimer;
     375        reports time to tst-output;
     376        if prefix is given, timer output is prefixed by it.
     377SEE ALSO: tst_InitTimer, tst_GetTimer, tst_StopTimer, tst_OutTimer, tst_init
     378"
     379{
     380  tst_Timer = timer - tst_Timer;
     381  tst_OutTimer(tst_Timer, #);
     382}
     383
     384proc tst_OutTimer(int tt, list #)
     385"USAGE: tst_OutTimer(ticks [, prefix])
     386RETURN: none
     387PURPOSE: reports value of tt to tst-output;
     388         if prefix is given, timer output is prefixed by it.
     389SEE ALSO: tst_InitTimer, tst_GetTimer, tst_StopTimer, tst_ReportTimer, tst_init
     390"
     391{
     392  string prefix = "OutTimer";
     393 
     394  if (size(#) > 0)
     395  {
     396    prefix = string(#[1]);
     397  }
     398  tst_status_out(prefix, "tst-Timer", tt);
    257399}
    258400
  • Singular/Makefile.in

    r33ec11 r2f436b  
    105105    GMPrat.cc multicnt.cc npolygon.cc semic.cc spectrum.cc splist.cc \
    106106    libparse.cc mod_raw.cc \
    107     pcv.cc kbuckets.cc\
     107    pcv.cc kbuckets.cc sbuckets.cc\
    108108    mpr_inout.cc mpr_base.cc mpr_numeric.cc \
    109109    prCopy.cc p_Mult_q.cc \
     
    114114MPSR_SOURCES = mpsr_Put.cc mpsr_PutPoly.cc mpsr_GetPoly.cc mpsr_sl.cc\
    115115        mpsr_Get.cc mpsr_GetMisc.cc mpsr_Error.cc \
     116
    116117
    117118# stuff for dbm
     
    146147        p_Minus_mm_Mult_qq__Template.cc p_Add_q__Template.cc \
    147148        p_Neg__Template.cc pp_Mult_Coeff_mm_DivSelect__Template.cc \
     149        pp_Mult_Coeff_mm_DivSelectMult__Template.cc \
    148150        p_Merge_q__Template.cc pp_Mult_mm_Noether__Template.cc\
    149151        p_kBucketSetLm__Template.cc \
     
    165167        ndbm.h dbm_sl.h polys-impl.h libparse.h \
    166168        GMPrat.h multicnt.h npolygon.h semic.h spectrum.h splist.h multicnt.h \
    167         pcv.h mod_raw.h kbuckets.h \
     169        pcv.h mod_raw.h kbuckets.h sbuckets.h\
    168170        mpr_global.h mpr_inout.h mpr_base.h mpr_numeric.h \
    169171        feOpt.h fegetopt.h distrib.h walk.h \
     
    173175        omSingularConfig.h pShallowCopyDelete.h \
    174176        p_Procs_Dynamic.h p_Procs_Impl.h p_Procs_Set.h \
    175         p_Procs.h p_Procs_Static.h
    176 
    177 DISTFILES=${SOURCES} ${HEADERS} Makefile.in configure.in configure \
     177        p_Procs.h p_Procs_Static.h p_Mult_q.h
     178
     179DISTFILES=${SOURCES} ${HEADERS} ${ESOURCES} \
     180        Makefile.in configure.in configure \
    178181        mod2.h.in grammar.h testgh install-sh mkinstalldirs \
    179182        check_aso.pl prCopy.pl
     
    495498        mcopy -o Singular-${SINGULAR_VERSION}-src.tar.gz a:
    496499
    497 TAGS:   ${SOURCES} ${HEADERS}
    498         etags ${SOURCES} ${HEADERS}
     500TAGS:   ${SOURCES} ${ESOURCES} ${HEADERS}
     501        etags ${SOURCES} ${ESOURCES} ${HEADERS}
    499502
    500503tags:   
     
    601604
    602605p_Procs_Lib_%.dl_og : p_Procs_Lib.cc  p_Procs_Dynamic.og
    603         ${CXXG} ${CXXFLAGSG} ${CXXTEMPLFLAGS} ${CPPFLAGS} ${DEFS} ${SFLAGS} -Dp_Procs_$* -c $< -o $@
     606        ${CXXG} ${CXXFLAGSG} ${CXXTEMPLFLAGS} ${CPPFLAGS} ${DEFSG} ${SFLAGS} -Dp_Procs_$* -c $< -o $@
    604607
    605608%.dl_og: %.cc
     
    843846
    844847%_d.c : %.c
    845         $(CCG) $(CFLAGSG) ${CPPFLAGS} -E -P $< | $(PERL) -p -e 's/;/;\n/g' | $(PERL) -p -e 's/\{/\n\{/g' | $(PERL) -p -e 's/\}/\n\}/g' > $@
     848        $(CCG) $(CFLAGSG) ${CPPFLAGS} ${DEFS}-E -P $< | $(PERL) -p -e 's/;/;\n/g' | $(PERL) -p -e 's/\{/\n\{/g' | $(PERL) -p -e 's/\}/\n\}/g' > $@
    846849
    847850%_d.cc : %.cc
    848         $(CCG) $(CXXFLAGS) ${CPPFLAGS} -E -P $< | $(PERL) -p -e 's/;/;\n/g' | $(PERL) -p -e 's/\{/\n\{/g' | $(PERL) -p -e 's/\}/\n\}/g' > $@
     851        $(CCG) $(CXXFLAGS) ${CPPFLAGS} ${DEFS} -E -P $< | $(PERL) -p -e 's/;/;\n/g' | $(PERL) -p -e 's/\{/\n\{/g' | $(PERL) -p -e 's/\}/\n\}/g' > $@
    849852
    850853.PRECIOUS: %_d.cc %_d.c
  • Singular/configure

    r33ec11 r2f436b  
    600600SINGULAR_MAJOR_VERSION=${SINGULAR_MAJOR_VERSION:-1}
    601601SINGULAR_MINOR_VERSION=${SINGULAR_MINOR_VERSION:-3}
    602 SINGULAR_SUB_VERSION=${SINGULAR_SUB_VERSION:-12}
     602SINGULAR_SUB_VERSION=${SINGULAR_SUB_VERSION:-13}
    603603SINGULAR_VERSION="${SINGULAR_VERSION:-$SINGULAR_MAJOR_VERSION${VERSION_SEP}$SINGULAR_MINOR_VERSION${VERSION_SEP}$SINGULAR_SUB_VERSION}"
    604 VERSION_DATE=${VERSION_DATE:-"December 2000"}
     604VERSION_DATE=${VERSION_DATE:-"January 2001"}
    605605
    606606
     
    17961796          fi
    17971797        ;;
     1798        IRIX-6)
     1799          LD_DYN_FLAGS="-lc"
     1800          ac_lib_dl=yes
     1801        ;;
    17981802esac
    17991803
     
    18051809# heder file checks
    18061810echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
    1807 echo "configure:1808: checking for ANSI C header files" >&5
     1811echo "configure:1812: checking for ANSI C header files" >&5
    18081812if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
    18091813  echo $ac_n "(cached) $ac_c" 1>&6
    18101814else
    18111815  cat > conftest.$ac_ext <<EOF
    1812 #line 1813 "configure"
     1816#line 1817 "configure"
    18131817#include "confdefs.h"
    18141818#include <stdlib.h>
     
    18181822EOF
    18191823ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
    1820 { (eval echo configure:1821: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
     1824{ (eval echo configure:1825: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
    18211825ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
    18221826if test -z "$ac_err"; then
     
    18351839  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
    18361840cat > conftest.$ac_ext <<EOF
    1837 #line 1838 "configure"
     1841#line 1842 "configure"
    18381842#include "confdefs.h"
    18391843#include <string.h>
     
    18531857  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
    18541858cat > conftest.$ac_ext <<EOF
    1855 #line 1856 "configure"
     1859#line 1860 "configure"
    18561860#include "confdefs.h"
    18571861#include <stdlib.h>
     
    18741878else
    18751879  cat > conftest.$ac_ext <<EOF
    1876 #line 1877 "configure"
     1880#line 1881 "configure"
    18771881#include "confdefs.h"
    18781882#include <ctype.h>
     
    18851889
    18861890EOF
    1887 if { (eval echo configure:1888: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
     1891if { (eval echo configure:1892: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
    18881892then
    18891893  :
     
    19121916ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
    19131917echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
    1914 echo "configure:1915: checking for $ac_hdr" >&5
     1918echo "configure:1919: checking for $ac_hdr" >&5
    19151919if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
    19161920  echo $ac_n "(cached) $ac_c" 1>&6
    19171921else
    19181922  cat > conftest.$ac_ext <<EOF
    1919 #line 1920 "configure"
     1923#line 1924 "configure"
    19201924#include "confdefs.h"
    19211925#include <$ac_hdr>
    19221926EOF
    19231927ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
    1924 { (eval echo configure:1925: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
     1928{ (eval echo configure:1929: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
    19251929ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
    19261930if test -z "$ac_err"; then
     
    19541958ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
    19551959echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
    1956 echo "configure:1957: checking for $ac_hdr" >&5
     1960echo "configure:1961: checking for $ac_hdr" >&5
    19571961if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
    19581962  echo $ac_n "(cached) $ac_c" 1>&6
    19591963else
    19601964  cat > conftest.$ac_ext <<EOF
    1961 #line 1962 "configure"
     1965#line 1966 "configure"
    19621966#include "confdefs.h"
    19631967#include <$ac_hdr>
    19641968EOF
    19651969ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
    1966 { (eval echo configure:1967: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
     1970{ (eval echo configure:1971: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
    19671971ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
    19681972if test -z "$ac_err"; then
     
    19931997# typedefs, structures
    19941998echo $ac_n "checking for working const""... $ac_c" 1>&6
    1995 echo "configure:1996: checking for working const" >&5
     1999echo "configure:2000: checking for working const" >&5
    19962000if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
    19972001  echo $ac_n "(cached) $ac_c" 1>&6
    19982002else
    19992003  cat > conftest.$ac_ext <<EOF
    2000 #line 2001 "configure"
     2004#line 2005 "configure"
    20012005#include "confdefs.h"
    20022006
     
    20472051; return 0; }
    20482052EOF
    2049 if { (eval echo configure:2050: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
     2053if { (eval echo configure:2054: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    20502054  rm -rf conftest*
    20512055  ac_cv_c_const=yes
     
    20682072
    20692073echo $ac_n "checking for inline""... $ac_c" 1>&6
    2070 echo "configure:2071: checking for inline" >&5
     2074echo "configure:2075: checking for inline" >&5
    20712075if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
    20722076  echo $ac_n "(cached) $ac_c" 1>&6
     
    20752079for ac_kw in inline __inline__ __inline; do
    20762080  cat > conftest.$ac_ext <<EOF
    2077 #line 2078 "configure"
     2081#line 2082 "configure"
    20782082#include "confdefs.h"
    20792083
     
    20822086; return 0; }
    20832087EOF
    2084 if { (eval echo configure:2085: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
     2088if { (eval echo configure:2089: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    20852089  rm -rf conftest*
    20862090  ac_cv_c_inline=$ac_kw; break
     
    21082112
    21092113echo $ac_n "checking for size_t""... $ac_c" 1>&6
    2110 echo "configure:2111: checking for size_t" >&5
     2114echo "configure:2115: checking for size_t" >&5
    21112115if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
    21122116  echo $ac_n "(cached) $ac_c" 1>&6
    21132117else
    21142118  cat > conftest.$ac_ext <<EOF
    2115 #line 2116 "configure"
     2119#line 2120 "configure"
    21162120#include "confdefs.h"
    21172121#include <sys/types.h>
     
    21412145
    21422146echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
    2143 echo "configure:2144: checking whether time.h and sys/time.h may both be included" >&5
     2147echo "configure:2148: checking whether time.h and sys/time.h may both be included" >&5
    21442148if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
    21452149  echo $ac_n "(cached) $ac_c" 1>&6
    21462150else
    21472151  cat > conftest.$ac_ext <<EOF
    2148 #line 2149 "configure"
     2152#line 2153 "configure"
    21492153#include "confdefs.h"
    21502154#include <sys/types.h>
     
    21552159; return 0; }
    21562160EOF
    2157 if { (eval echo configure:2158: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
     2161if { (eval echo configure:2162: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    21582162  rm -rf conftest*
    21592163  ac_cv_header_time=yes
     
    21762180
    21772181echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6
    2178 echo "configure:2179: checking whether struct tm is in sys/time.h or time.h" >&5
     2182echo "configure:2183: checking whether struct tm is in sys/time.h or time.h" >&5
    21792183if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then
    21802184  echo $ac_n "(cached) $ac_c" 1>&6
    21812185else
    21822186  cat > conftest.$ac_ext <<EOF
    2183 #line 2184 "configure"
     2187#line 2188 "configure"
    21842188#include "confdefs.h"
    21852189#include <sys/types.h>
     
    21892193; return 0; }
    21902194EOF
    2191 if { (eval echo configure:2192: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
     2195if { (eval echo configure:2196: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    21922196  rm -rf conftest*
    21932197  ac_cv_struct_tm=time.h
     
    22142218# for constant arguments.  Useless!
    22152219echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
    2216 echo "configure:2217: checking for working alloca.h" >&5
     2220echo "configure:2221: checking for working alloca.h" >&5
    22172221if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
    22182222  echo $ac_n "(cached) $ac_c" 1>&6
    22192223else
    22202224  cat > conftest.$ac_ext <<EOF
    2221 #line 2222 "configure"
     2225#line 2226 "configure"
    22222226#include "confdefs.h"
    22232227#include <alloca.h>
     
    22262230; return 0; }
    22272231EOF
    2228 if { (eval echo configure:2229: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
     2232if { (eval echo configure:2233: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    22292233  rm -rf conftest*
    22302234  ac_cv_header_alloca_h=yes
     
    22472251
    22482252echo $ac_n "checking for alloca""... $ac_c" 1>&6
    2249 echo "configure:2250: checking for alloca" >&5
     2253echo "configure:2254: checking for alloca" >&5
    22502254if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
    22512255  echo $ac_n "(cached) $ac_c" 1>&6
    22522256else
    22532257  cat > conftest.$ac_ext <<EOF
    2254 #line 2255 "configure"
     2258#line 2259 "configure"
    22552259#include "confdefs.h"
    22562260
     
    22802284; return 0; }
    22812285EOF
    2282 if { (eval echo configure:2283: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
     2286if { (eval echo configure:2287: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    22832287  rm -rf conftest*
    22842288  ac_cv_func_alloca_works=yes
     
    23122316
    23132317echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
    2314 echo "configure:2315: checking whether alloca needs Cray hooks" >&5
     2318echo "configure:2319: checking whether alloca needs Cray hooks" >&5
    23152319if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
    23162320  echo $ac_n "(cached) $ac_c" 1>&6
    23172321else
    23182322  cat > conftest.$ac_ext <<EOF
    2319 #line 2320 "configure"
     2323#line 2324 "configure"
    23202324#include "confdefs.h"
    23212325#if defined(CRAY) && ! defined(CRAY2)
     
    23422346for ac_func in _getb67 GETB67 getb67; do
    23432347  echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
    2344 echo "configure:2345: checking for $ac_func" >&5
     2348echo "configure:2349: checking for $ac_func" >&5
    23452349if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
    23462350  echo $ac_n "(cached) $ac_c" 1>&6
    23472351else
    23482352  cat > conftest.$ac_ext <<EOF
    2349 #line 2350 "configure"
     2353#line 2354 "configure"
    23502354#include "confdefs.h"
    23512355/* System header to define __stub macros and hopefully few prototypes,
     
    23702374; return 0; }
    23712375EOF
    2372 if { (eval echo configure:2373: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
     2376if { (eval echo configure:2377: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    23732377  rm -rf conftest*
    23742378  eval "ac_cv_func_$ac_func=yes"
     
    23972401
    23982402echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
    2399 echo "configure:2400: checking stack direction for C alloca" >&5
     2403echo "configure:2404: checking stack direction for C alloca" >&5
    24002404if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
    24012405  echo $ac_n "(cached) $ac_c" 1>&6
     
    24052409else
    24062410  cat > conftest.$ac_ext <<EOF
    2407 #line 2408 "configure"
     2411#line 2412 "configure"
    24082412#include "confdefs.h"
    24092413find_stack_direction ()
     
    24242428}
    24252429EOF
    2426 if { (eval echo configure:2427: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
     2430if { (eval echo configure:2431: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
    24272431then
    24282432  ac_cv_c_stack_direction=1
     
    24472451if test $ac_cv_prog_gcc = yes; then
    24482452    echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
    2449 echo "configure:2450: checking whether ${CC-cc} needs -traditional" >&5
     2453echo "configure:2454: checking whether ${CC-cc} needs -traditional" >&5
    24502454if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
    24512455  echo $ac_n "(cached) $ac_c" 1>&6
     
    24532457    ac_pattern="Autoconf.*'x'"
    24542458  cat > conftest.$ac_ext <<EOF
    2455 #line 2456 "configure"
     2459#line 2460 "configure"
    24562460#include "confdefs.h"
    24572461#include <sgtty.h>
     
    24712475  if test $ac_cv_prog_gcc_traditional = no; then
    24722476    cat > conftest.$ac_ext <<EOF
    2473 #line 2474 "configure"
     2477#line 2478 "configure"
    24742478#include "confdefs.h"
    24752479#include <termio.h>
     
    24962500ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
    24972501echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
    2498 echo "configure:2499: checking for $ac_hdr" >&5
     2502echo "configure:2503: checking for $ac_hdr" >&5
    24992503if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
    25002504  echo $ac_n "(cached) $ac_c" 1>&6
    25012505else
    25022506  cat > conftest.$ac_ext <<EOF
    2503 #line 2504 "configure"
     2507#line 2508 "configure"
    25042508#include "confdefs.h"
    25052509#include <$ac_hdr>
    25062510EOF
    25072511ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
    2508 { (eval echo configure:2509: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
     2512{ (eval echo configure:2513: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
    25092513ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
    25102514if test -z "$ac_err"; then
     
    25352539do
    25362540echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
    2537 echo "configure:2538: checking for $ac_func" >&5
     2541echo "configure:2542: checking for $ac_func" >&5
    25382542if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
    25392543  echo $ac_n "(cached) $ac_c" 1>&6
    25402544else
    25412545  cat > conftest.$ac_ext <<EOF
    2542 #line 2543 "configure"
     2546#line 2547 "configure"
    25432547#include "confdefs.h"
    25442548/* System header to define __stub macros and hopefully few prototypes,
     
    25632567; return 0; }
    25642568EOF
    2565 if { (eval echo configure:2566: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
     2569if { (eval echo configure:2570: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    25662570  rm -rf conftest*
    25672571  eval "ac_cv_func_$ac_func=yes"
     
    25882592
    25892593echo $ac_n "checking for working mmap""... $ac_c" 1>&6
    2590 echo "configure:2591: checking for working mmap" >&5
     2594echo "configure:2595: checking for working mmap" >&5
    25912595if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then
    25922596  echo $ac_n "(cached) $ac_c" 1>&6
     
    25962600else
    25972601  cat > conftest.$ac_ext <<EOF
    2598 #line 2599 "configure"
     2602#line 2603 "configure"
    25992603#include "confdefs.h"
    26002604
     
    27362740
    27372741EOF
    2738 if { (eval echo configure:2739: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
     2742if { (eval echo configure:2743: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
    27392743then
    27402744  ac_cv_func_mmap_fixed_mapped=yes
     
    27592763
    27602764echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
    2761 echo "configure:2762: checking return type of signal handlers" >&5
     2765echo "configure:2766: checking return type of signal handlers" >&5
    27622766if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
    27632767  echo $ac_n "(cached) $ac_c" 1>&6
    27642768else
    27652769  cat > conftest.$ac_ext <<EOF
    2766 #line 2767 "configure"
     2770#line 2771 "configure"
    27672771#include "confdefs.h"
    27682772#include <sys/types.h>
     
    27812785; return 0; }
    27822786EOF
    2783 if { (eval echo configure:2784: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
     2787if { (eval echo configure:2788: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    27842788  rm -rf conftest*
    27852789  ac_cv_type_signal=void
     
    28002804
    28012805echo $ac_n "checking for vprintf""... $ac_c" 1>&6
    2802 echo "configure:2803: checking for vprintf" >&5
     2806echo "configure:2807: checking for vprintf" >&5
    28032807if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then
    28042808  echo $ac_n "(cached) $ac_c" 1>&6
    28052809else
    28062810  cat > conftest.$ac_ext <<EOF
    2807 #line 2808 "configure"
     2811#line 2812 "configure"
    28082812#include "confdefs.h"
    28092813/* System header to define __stub macros and hopefully few prototypes,
     
    28282832; return 0; }
    28292833EOF
    2830 if { (eval echo configure:2831: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
     2834if { (eval echo configure:2835: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    28312835  rm -rf conftest*
    28322836  eval "ac_cv_func_vprintf=yes"
     
    28522856if test "$ac_cv_func_vprintf" != yes; then
    28532857echo $ac_n "checking for _doprnt""... $ac_c" 1>&6
    2854 echo "configure:2855: checking for _doprnt" >&5
     2858echo "configure:2859: checking for _doprnt" >&5
    28552859if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then
    28562860  echo $ac_n "(cached) $ac_c" 1>&6
    28572861else
    28582862  cat > conftest.$ac_ext <<EOF
    2859 #line 2860 "configure"
     2863#line 2864 "configure"
    28602864#include "confdefs.h"
    28612865/* System header to define __stub macros and hopefully few prototypes,
     
    28802884; return 0; }
    28812885EOF
    2882 if { (eval echo configure:2883: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
     2886if { (eval echo configure:2887: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    28832887  rm -rf conftest*
    28842888  eval "ac_cv_func__doprnt=yes"
     
    29062910
    29072911echo $ac_n "checking for library containing setenv""... $ac_c" 1>&6
    2908 echo "configure:2909: checking for library containing setenv" >&5
     2912echo "configure:2913: checking for library containing setenv" >&5
    29092913if eval "test \"`echo '$''{'ac_cv_search_setenv'+set}'`\" = set"; then
    29102914  echo $ac_n "(cached) $ac_c" 1>&6
     
    29132917ac_cv_search_setenv="no"
    29142918cat > conftest.$ac_ext <<EOF
    2915 #line 2916 "configure"
     2919#line 2920 "configure"
    29162920#include "confdefs.h"
    29172921/* Override any gcc2 internal prototype to avoid an error.  */
     
    29242928; return 0; }
    29252929EOF
    2926 if { (eval echo configure:2927: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
     2930if { (eval echo configure:2931: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    29272931  rm -rf conftest*
    29282932  ac_cv_search_setenv="none required"
     
    29352939LIBS="-l$i  $ac_func_search_save_LIBS"
    29362940cat > conftest.$ac_ext <<EOF
    2937 #line 2938 "configure"
     2941#line 2942 "configure"
    29382942#include "confdefs.h"
    29392943/* Override any gcc2 internal prototype to avoid an error.  */
     
    29462950; return 0; }
    29472951EOF
    2948 if { (eval echo configure:2949: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
     2952if { (eval echo configure:2953: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    29492953  rm -rf conftest*
    29502954  ac_cv_search_setenv="-l$i"
     
    29692973do
    29702974echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
    2971 echo "configure:2972: checking for $ac_func" >&5
     2975echo "configure:2976: checking for $ac_func" >&5
    29722976if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
    29732977  echo $ac_n "(cached) $ac_c" 1>&6
    29742978else
    29752979  cat > conftest.$ac_ext <<EOF
    2976 #line 2977 "configure"
     2980#line 2981 "configure"
    29772981#include "confdefs.h"
    29782982/* System header to define __stub macros and hopefully few prototypes,
     
    29973001; return 0; }
    29983002EOF
    2999 if { (eval echo configure:3000: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
     3003if { (eval echo configure:3004: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    30003004  rm -rf conftest*
    30013005  eval "ac_cv_func_$ac_func=yes"
     
    30263030# arithmetic shifts
    30273031echo $ac_n "checking whether your machine has correct arithmetic shifts""... $ac_c" 1>&6
    3028 echo "configure:3029: checking whether your machine has correct arithmetic shifts" >&5
     3032echo "configure:3033: checking whether your machine has correct arithmetic shifts" >&5
    30293033if eval "test \"`echo '$''{'ac_cv_shift'+set}'`\" = set"; then
    30303034  echo $ac_n "(cached) $ac_c" 1>&6
     
    30393043else
    30403044  cat > conftest.$ac_ext <<EOF
    3041 #line 3042 "configure"
     3045#line 3046 "configure"
    30423046#include "confdefs.h"
    30433047 int main() { if (-2 >> 1 == -1) exit(0); else exit(1); }
    30443048EOF
    3045 if { (eval echo configure:3046: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
     3049if { (eval echo configure:3050: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
    30463050then
    30473051  ac_cv_shift=yes
     
    30683072# check for a peculiar constructor initialization
    30693073echo $ac_n "checking whether explicit C++ constructor calls are allowed""... $ac_c" 1>&6
    3070 echo "configure:3071: checking whether explicit C++ constructor calls are allowed" >&5
     3074echo "configure:3075: checking whether explicit C++ constructor calls are allowed" >&5
    30713075
    30723076ac_ext=C
     
    30813085else
    30823086  cat > conftest.$ac_ext <<EOF
    3083 #line 3084 "configure"
     3087#line 3088 "configure"
    30843088#include "confdefs.h"
    30853089
     
    30993103; return 0; }
    31003104EOF
    3101 if { (eval echo configure:3102: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
     3105if { (eval echo configure:3106: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    31023106  rm -rf conftest*
    31033107  ac_cv_explicit_const=yes
     
    31283132# sprintf returns number of printed chars
    31293133echo $ac_n "checking whether vsprintf returns number of printed chars""... $ac_c" 1>&6
    3130 echo "configure:3131: checking whether vsprintf returns number of printed chars" >&5
     3134echo "configure:3135: checking whether vsprintf returns number of printed chars" >&5
    31313135if eval "test \"`echo '$''{'ac_cv_returns_n_of_chars'+set}'`\" = set"; then
    31323136  echo $ac_n "(cached) $ac_c" 1>&6
     
    31363140else
    31373141  cat > conftest.$ac_ext <<EOF
    3138 #line 3139 "configure"
     3142#line 3143 "configure"
    31393143#include "confdefs.h"
    31403144#include <stdio.h>
    31413145 main() { char *str=(char*)malloc(20); if (((int) sprintf(str,"123456789")) == 9) exit(0); else exit(1); }
    31423146EOF
    3143 if { (eval echo configure:3144: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
     3147if { (eval echo configure:3148: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
    31443148then
    31453149  ac_cv_returns_n_of_chars=yes
     
    31673171# determine ALIGN_8
    31683172echo $ac_n "checking size of char""... $ac_c" 1>&6
    3169 echo "configure:3170: checking size of char" >&5
     3173echo "configure:3174: checking size of char" >&5
    31703174if eval "test \"`echo '$''{'ac_cv_sizeof_char'+set}'`\" = set"; then
    31713175  echo $ac_n "(cached) $ac_c" 1>&6
     
    31753179else
    31763180  cat > conftest.$ac_ext <<EOF
    3177 #line 3178 "configure"
     3181#line 3182 "configure"
    31783182#include "confdefs.h"
    31793183#include <stdio.h>
     
    31863190}
    31873191EOF
    3188 if { (eval echo configure:3189: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
     3192if { (eval echo configure:3193: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
    31893193then
    31903194  ac_cv_sizeof_char=`cat conftestval`
     
    32063210
    32073211echo $ac_n "checking size of short""... $ac_c" 1>&6
    3208 echo "configure:3209: checking size of short" >&5
     3212echo "configure:3213: checking size of short" >&5
    32093213if eval "test \"`echo '$''{'ac_cv_sizeof_short'+set}'`\" = set"; then
    32103214  echo $ac_n "(cached) $ac_c" 1>&6
     
    32143218else
    32153219  cat > conftest.$ac_ext <<EOF
    3216 #line 3217 "configure"
     3220#line 3221 "configure"
    32173221#include "confdefs.h"
    32183222#include <stdio.h>
     
    32253229}
    32263230EOF
    3227 if { (eval echo configure:3228: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
     3231if { (eval echo configure:3232: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
    32283232then
    32293233  ac_cv_sizeof_short=`cat conftestval`
     
    32453249
    32463250echo $ac_n "checking size of int""... $ac_c" 1>&6
    3247 echo "configure:3248: checking size of int" >&5
     3251echo "configure:3252: checking size of int" >&5
    32483252if eval "test \"`echo '$''{'ac_cv_sizeof_int'+set}'`\" = set"; then
    32493253  echo $ac_n "(cached) $ac_c" 1>&6
     
    32533257else
    32543258  cat > conftest.$ac_ext <<EOF
    3255 #line 3256 "configure"
     3259#line 3260 "configure"
    32563260#include "confdefs.h"
    32573261#include <stdio.h>
     
    32643268}
    32653269EOF
    3266 if { (eval echo configure:3267: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
     3270if { (eval echo configure:3271: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
    32673271then
    32683272  ac_cv_sizeof_int=`cat conftestval`
     
    32843288
    32853289echo $ac_n "checking size of long""... $ac_c" 1>&6
    3286 echo "configure:3287: checking size of long" >&5
     3290echo "configure:3291: checking size of long" >&5
    32873291if eval "test \"`echo '$''{'ac_cv_sizeof_long'+set}'`\" = set"; then
    32883292  echo $ac_n "(cached) $ac_c" 1>&6
     
    32923296else
    32933297  cat > conftest.$ac_ext <<EOF
    3294 #line 3295 "configure"
     3298#line 3299 "configure"
    32953299#include "confdefs.h"
    32963300#include <stdio.h>
     
    33033307}
    33043308EOF
    3305 if { (eval echo configure:3306: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
     3309if { (eval echo configure:3310: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
    33063310then
    33073311  ac_cv_sizeof_long=`cat conftestval`
     
    33233327
    33243328echo $ac_n "checking size of void*""... $ac_c" 1>&6
    3325 echo "configure:3326: checking size of void*" >&5
     3329echo "configure:3330: checking size of void*" >&5
    33263330if eval "test \"`echo '$''{'ac_cv_sizeof_voidp'+set}'`\" = set"; then
    33273331  echo $ac_n "(cached) $ac_c" 1>&6
     
    33313335else
    33323336  cat > conftest.$ac_ext <<EOF
    3333 #line 3334 "configure"
     3337#line 3338 "configure"
    33343338#include "confdefs.h"
    33353339#include <stdio.h>
     
    33423346}
    33433347EOF
    3344 if { (eval echo configure:3345: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
     3348if { (eval echo configure:3349: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
    33453349then
    33463350  ac_cv_sizeof_voidp=`cat conftestval`
     
    33623366
    33633367echo $ac_n "checking size of double""... $ac_c" 1>&6
    3364 echo "configure:3365: checking size of double" >&5
     3368echo "configure:3369: checking size of double" >&5
    33653369if eval "test \"`echo '$''{'ac_cv_sizeof_double'+set}'`\" = set"; then
    33663370  echo $ac_n "(cached) $ac_c" 1>&6
     
    33703374else
    33713375  cat > conftest.$ac_ext <<EOF
    3372 #line 3373 "configure"
     3376#line 3377 "configure"
    33733377#include "confdefs.h"
    33743378#include <stdio.h>
     
    33813385}
    33823386EOF
    3383 if { (eval echo configure:3384: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
     3387if { (eval echo configure:3388: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
    33843388then
    33853389  ac_cv_sizeof_double=`cat conftestval`
     
    34013405
    34023406echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
    3403 echo "configure:3404: checking whether byte ordering is bigendian" >&5
     3407echo "configure:3408: checking whether byte ordering is bigendian" >&5
    34043408if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
    34053409  echo $ac_n "(cached) $ac_c" 1>&6
     
    34083412# See if sys/param.h defines the BYTE_ORDER macro.
    34093413cat > conftest.$ac_ext <<EOF
    3410 #line 3411 "configure"
     3414#line 3415 "configure"
    34113415#include "confdefs.h"
    34123416#include <sys/types.h>
     
    34193423; return 0; }
    34203424EOF
    3421 if { (eval echo configure:3422: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
     3425if { (eval echo configure:3426: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    34223426  rm -rf conftest*
    34233427  # It does; now see whether it defined to BIG_ENDIAN or not.
    34243428cat > conftest.$ac_ext <<EOF
    3425 #line 3426 "configure"
     3429#line 3430 "configure"
    34263430#include "confdefs.h"
    34273431#include <sys/types.h>
     
    34343438; return 0; }
    34353439EOF
    3436 if { (eval echo configure:3437: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
     3440if { (eval echo configure:3441: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
    34373441  rm -rf conftest*
    34383442  ac_cv_c_bigendian=yes
     
    34543458else
    34553459  cat > conftest.$ac_ext <<EOF
    3456 #line 3457 "configure"
     3460#line 3461 "configure"
    34573461#include "confdefs.h"
    34583462main () {
     
    34673471}
    34683472EOF
    3469 if { (eval echo configure:3470: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
     3473if { (eval echo configure:3474: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
    34703474then
    34713475  ac_cv_c_bigendian=no
     
    35853589
    35863590echo $ac_n "checking whether to use dynamic linking""... $ac_c" 1>&6
    3587 echo "configure:3588: checking whether to use dynamic linking" >&5
     3591echo "configure:3592: checking whether to use dynamic linking" >&5
    35883592if test "$with_dl" != no && test "$ac_lib_dl" = yes; then
    35893593  cat >> confdefs.h <<\EOF
     
    35983602
    35993603echo $ac_n "checking for tgetent in -lncurses""... $ac_c" 1>&6
    3600 echo "configure:3601: checking for tgetent in -lncurses" >&5
     3604echo "configure:3605: checking for tgetent in -lncurses" >&5
    36013605ac_lib_var=`echo ncurses'_'tgetent | sed 'y%./+-%__p_%'`
    36023606if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
     
    36063610LIBS="-lncurses  $LIBS"
    36073611cat > conftest.$ac_ext <<EOF
    3608 #line 3609 "configure"
     3612#line 3613 "configure"
    36093613#include "confdefs.h"
    36103614/* Override any gcc2 internal prototype to avoid an error.  */
     
    36173621; return 0; }
    36183622EOF
    3619 if { (eval echo configure:3620: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
     3623if { (eval echo configure:3624: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    36203624  rm -rf conftest*
    36213625  eval "ac_cv_lib_$ac_lib_var=yes"
     
    36443648\
    36453649 echo $ac_n "checking for tgetent in -lcurses""... $ac_c" 1>&6
    3646 echo "configure:3647: checking for tgetent in -lcurses" >&5
     3650echo "configure:3651: checking for tgetent in -lcurses" >&5
    36473651ac_lib_var=`echo curses'_'tgetent | sed 'y%./+-%__p_%'`
    36483652if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
     
    36523656LIBS="-lcurses  $LIBS"
    36533657cat > conftest.$ac_ext <<EOF
    3654 #line 3655 "configure"
     3658#line 3659 "configure"
    36553659#include "confdefs.h"
    36563660/* Override any gcc2 internal prototype to avoid an error.  */
     
    36633667; return 0; }
    36643668EOF
    3665 if { (eval echo configure:3666: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
     3669if { (eval echo configure:3670: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    36663670  rm -rf conftest*
    36673671  eval "ac_cv_lib_$ac_lib_var=yes"
     
    36903694\
    36913695  echo $ac_n "checking for tgetent in -ltermcap""... $ac_c" 1>&6
    3692 echo "configure:3693: checking for tgetent in -ltermcap" >&5
     3696echo "configure:3697: checking for tgetent in -ltermcap" >&5
    36933697ac_lib_var=`echo termcap'_'tgetent | sed 'y%./+-%__p_%'`
    36943698if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
     
    36983702LIBS="-ltermcap  $LIBS"
    36993703cat > conftest.$ac_ext <<EOF
    3700 #line 3701 "configure"
     3704#line 3705 "configure"
    37013705#include "confdefs.h"
    37023706/* Override any gcc2 internal prototype to avoid an error.  */
     
    37093713; return 0; }
    37103714EOF
    3711 if { (eval echo configure:3712: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
     3715if { (eval echo configure:3716: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    37123716  rm -rf conftest*
    37133717  eval "ac_cv_lib_$ac_lib_var=yes"
     
    37583762
    37593763   echo $ac_n "checking for rl_abort in -lreadline""... $ac_c" 1>&6
    3760 echo "configure:3761: checking for rl_abort in -lreadline" >&5
     3764echo "configure:3765: checking for rl_abort in -lreadline" >&5
    37613765ac_lib_var=`echo readline'_'rl_abort | sed 'y%./+-%__p_%'`
    37623766if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
     
    37663770LIBS="-lreadline  $LIBS"
    37673771cat > conftest.$ac_ext <<EOF
    3768 #line 3769 "configure"
     3772#line 3773 "configure"
    37693773#include "confdefs.h"
    37703774/* Override any gcc2 internal prototype to avoid an error.  */
     
    37803784; return 0; }
    37813785EOF
    3782 if { (eval echo configure:3783: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
     3786if { (eval echo configure:3787: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    37833787  rm -rf conftest*
    37843788  eval "ac_cv_lib_$ac_lib_var=yes"
     
    38083812
    38093813   echo $ac_n "checking how to run the C++ preprocessor""... $ac_c" 1>&6
    3810 echo "configure:3811: checking how to run the C++ preprocessor" >&5
     3814echo "configure:3815: checking how to run the C++ preprocessor" >&5
    38113815if test -z "$CXXCPP"; then
    38123816if eval "test \"`echo '$''{'ac_cv_prog_CXXCPP'+set}'`\" = set"; then
     
    38213825  CXXCPP="${CXX-g++} -E"
    38223826  cat > conftest.$ac_ext <<EOF
    3823 #line 3824 "configure"
     3827#line 3828 "configure"
    38243828#include "confdefs.h"
    38253829#include <stdlib.h>
    38263830EOF
    38273831ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
    3828 { (eval echo configure:3829: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
     3832{ (eval echo configure:3833: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
    38293833ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
    38303834if test -z "$ac_err"; then
     
    38543858ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
    38553859echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
    3856 echo "configure:3857: checking for $ac_hdr" >&5
     3860echo "configure:3861: checking for $ac_hdr" >&5
    38573861if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
    38583862  echo $ac_n "(cached) $ac_c" 1>&6
    38593863else
    38603864  cat > conftest.$ac_ext <<EOF
    3861 #line 3862 "configure"
     3865#line 3866 "configure"
    38623866#include "confdefs.h"
    38633867#include <$ac_hdr>
    38643868EOF
    38653869ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
    3866 { (eval echo configure:3867: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
     3870{ (eval echo configure:3871: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
    38673871ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
    38683872if test -z "$ac_err"; then
     
    38933897      test "$ac_cv_header_readline_readline_h" = yes; then
    38943898     echo $ac_n "checking whether readline.h is ok""... $ac_c" 1>&6
    3895 echo "configure:3896: checking whether readline.h is ok" >&5
     3899echo "configure:3900: checking whether readline.h is ok" >&5
    38963900     if eval "test \"`echo '$''{'ac_cv_header_readline_readline_h_ok'+set}'`\" = set"; then
    38973901  echo $ac_n "(cached) $ac_c" 1>&6
    38983902else
    38993903  cat > conftest.$ac_ext <<EOF
    3900 #line 3901 "configure"
     3904#line 3905 "configure"
    39013905#include "confdefs.h"
    39023906#include<unistd.h>
     
    39233927; return 0; }
    39243928EOF
    3925 if { (eval echo configure:3926: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
     3929if { (eval echo configure:3930: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    39263930  rm -rf conftest*
    39273931  ac_cv_header_readline_readline_h_ok="yes"
     
    39393943#not ok -- try once more with explicitly declaring everything
    39403944      echo $ac_n "checking whether or not we nevertheless can use readline""... $ac_c" 1>&6
    3941 echo "configure:3942: checking whether or not we nevertheless can use readline" >&5
     3945echo "configure:3946: checking whether or not we nevertheless can use readline" >&5
    39423946      if eval "test \"`echo '$''{'ac_cv_have_readline'+set}'`\" = set"; then
    39433947  echo $ac_n "(cached) $ac_c" 1>&6
    39443948else
    39453949  cat > conftest.$ac_ext <<EOF
    3946 #line 3947 "configure"
     3950#line 3951 "configure"
    39473951#include "confdefs.h"
    39483952#include <stdio.h>
     
    39783982; return 0; }
    39793983EOF
    3980 if { (eval echo configure:3981: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
     3984if { (eval echo configure:3985: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    39813985  rm -rf conftest*
    39823986  ac_cv_have_readline="yes"
     
    40174021
    40184022echo $ac_n "checking which readline to use""... $ac_c" 1>&6
    4019 echo "configure:4020: checking which readline to use" >&5
     4023echo "configure:4024: checking which readline to use" >&5
    40204024if test "$ac_cv_with_readline" = dynamic; then
    40214025  echo "$ac_t""dynamic" 1>&6
     
    40354039# gmp, smallgmp, MP, MPT, factory, libfac
    40364040echo $ac_n "checking for main in -lgmp""... $ac_c" 1>&6
    4037 echo "configure:4038: checking for main in -lgmp" >&5
     4041echo "configure:4042: checking for main in -lgmp" >&5
    40384042ac_lib_var=`echo gmp'_'main | sed 'y%./+-%__p_%'`
    40394043if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
     
    40434047LIBS="-lgmp  $LIBS"
    40444048cat > conftest.$ac_ext <<EOF
    4045 #line 4046 "configure"
     4049#line 4050 "configure"
    40464050#include "confdefs.h"
    40474051
     
    40504054; return 0; }
    40514055EOF
    4052 if { (eval echo configure:4053: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
     4056if { (eval echo configure:4057: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    40534057  rm -rf conftest*
    40544058  eval "ac_cv_lib_$ac_lib_var=yes"
     
    40814085fi
    40824086echo $ac_n "checking for main in -lsmallgmp""... $ac_c" 1>&6
    4083 echo "configure:4084: checking for main in -lsmallgmp" >&5
     4087echo "configure:4088: checking for main in -lsmallgmp" >&5
    40844088ac_lib_var=`echo smallgmp'_'main | sed 'y%./+-%__p_%'`
    40854089if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
     
    40894093LIBS="-lsmallgmp  $LIBS"
    40904094cat > conftest.$ac_ext <<EOF
    4091 #line 4092 "configure"
     4095#line 4096 "configure"
    40924096#include "confdefs.h"
    40934097
     
    40964100; return 0; }
    40974101EOF
    4098 if { (eval echo configure:4099: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
     4102if { (eval echo configure:4103: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    40994103  rm -rf conftest*
    41004104  eval "ac_cv_lib_$ac_lib_var=yes"
     
    41254129SAVE_LIBS=$LIBS
    41264130echo $ac_n "checking for IMP_PutGmpInt in -lMP""... $ac_c" 1>&6
    4127 echo "configure:4128: checking for IMP_PutGmpInt in -lMP" >&5
     4131echo "configure:4132: checking for IMP_PutGmpInt in -lMP" >&5
    41284132ac_lib_var=`echo MP'_'IMP_PutGmpInt | sed 'y%./+-%__p_%'`
    41294133if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
     
    41334137LIBS="-lMP $MP_LIBS $LIBS"
    41344138cat > conftest.$ac_ext <<EOF
    4135 #line 4136 "configure"
     4139#line 4140 "configure"
    41364140#include "confdefs.h"
    41374141/* Override any gcc2 internal prototype to avoid an error.  */
     
    41444148; return 0; }
    41454149EOF
    4146 if { (eval echo configure:4147: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
     4150if { (eval echo configure:4151: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    41474151  rm -rf conftest*
    41484152  eval "ac_cv_lib_$ac_lib_var=yes"
     
    41724176
    41734177echo $ac_n "checking for MPT_GetTree in -lMPT""... $ac_c" 1>&6
    4174 echo "configure:4175: checking for MPT_GetTree in -lMPT" >&5
     4178echo "configure:4179: checking for MPT_GetTree in -lMPT" >&5
    41754179ac_lib_var=`echo MPT'_'MPT_GetTree | sed 'y%./+-%__p_%'`
    41764180if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
     
    41804184LIBS="-lMPT $MP_LIBS $LIBS"
    41814185cat > conftest.$ac_ext <<EOF
    4182 #line 4183 "configure"
     4186#line 4187 "configure"
    41834187#include "confdefs.h"
    41844188/* Override any gcc2 internal prototype to avoid an error.  */
     
    41914195; return 0; }
    41924196EOF
    4193 if { (eval echo configure:4194: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
     4197if { (eval echo configure:4198: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    41944198  rm -rf conftest*
    41954199  eval "ac_cv_lib_$ac_lib_var=yes"
     
    42204224LIBS=$SAVE_LIBS
    42214225echo $ac_n "checking for atof in -lsingcf""... $ac_c" 1>&6
    4222 echo "configure:4223: checking for atof in -lsingcf" >&5
     4226echo "configure:4227: checking for atof in -lsingcf" >&5
    42234227ac_lib_var=`echo singcf'_'atof | sed 'y%./+-%__p_%'`
    42244228if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
     
    42284232LIBS="-lsingcf  $LIBS"
    42294233cat > conftest.$ac_ext <<EOF
    4230 #line 4231 "configure"
     4234#line 4235 "configure"
    42314235#include "confdefs.h"
    42324236/* Override any gcc2 internal prototype to avoid an error.  */
     
    42394243; return 0; }
    42404244EOF
    4241 if { (eval echo configure:4242: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
     4245if { (eval echo configure:4246: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    42424246  rm -rf conftest*
    42434247  eval "ac_cv_lib_$ac_lib_var=yes"
     
    42674271
    42684272echo $ac_n "checking for atof in -lsingfac""... $ac_c" 1>&6
    4269 echo "configure:4270: checking for atof in -lsingfac" >&5
     4273echo "configure:4274: checking for atof in -lsingfac" >&5
    42704274ac_lib_var=`echo singfac'_'atof | sed 'y%./+-%__p_%'`
    42714275if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
     
    42754279LIBS="-lsingfac  $LIBS"
    42764280cat > conftest.$ac_ext <<EOF
    4277 #line 4278 "configure"
     4281#line 4282 "configure"
    42784282#include "confdefs.h"
    42794283/* Override any gcc2 internal prototype to avoid an error.  */
     
    42864290; return 0; }
    42874291EOF
    4288 if { (eval echo configure:4289: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
     4292if { (eval echo configure:4293: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    42894293  rm -rf conftest*
    42904294  eval "ac_cv_lib_$ac_lib_var=yes"
     
    43144318
    43154319echo $ac_n "checking for omTestAddr in -lomalloc""... $ac_c" 1>&6
    4316 echo "configure:4317: checking for omTestAddr in -lomalloc" >&5
     4320echo "configure:4321: checking for omTestAddr in -lomalloc" >&5
    43174321ac_lib_var=`echo omalloc'_'omTestAddr | sed 'y%./+-%__p_%'`
    43184322if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
     
    43224326LIBS="-lomalloc  $LIBS"
    43234327cat > conftest.$ac_ext <<EOF
    4324 #line 4325 "configure"
     4328#line 4329 "configure"
    43254329#include "confdefs.h"
    43264330/* Override any gcc2 internal prototype to avoid an error.  */
     
    43334337; return 0; }
    43344338EOF
    4335 if { (eval echo configure:4336: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
     4339if { (eval echo configure:4340: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    43364340  rm -rf conftest*
    43374341  eval "ac_cv_lib_$ac_lib_var=yes"
     
    43614365
    43624366echo $ac_n "checking for main in -lomalloc_ndebug""... $ac_c" 1>&6
    4363 echo "configure:4364: checking for main in -lomalloc_ndebug" >&5
     4367echo "configure:4368: checking for main in -lomalloc_ndebug" >&5
    43644368ac_lib_var=`echo omalloc_ndebug'_'main | sed 'y%./+-%__p_%'`
    43654369if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
     
    43694373LIBS="-lomalloc_ndebug  $LIBS"
    43704374cat > conftest.$ac_ext <<EOF
    4371 #line 4372 "configure"
     4375#line 4376 "configure"
    43724376#include "confdefs.h"
    43734377
     
    43764380; return 0; }
    43774381EOF
    4378 if { (eval echo configure:4379: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
     4382if { (eval echo configure:4383: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
    43794383  rm -rf conftest*
    43804384  eval "ac_cv_lib_$ac_lib_var=yes"
     
    44084412ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
    44094413echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
    4410 echo "configure:4411: checking for $ac_hdr" >&5
     4414echo "configure:4415: checking for $ac_hdr" >&5
    44114415if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
    44124416  echo $ac_n "(cached) $ac_c" 1>&6
    44134417else
    44144418  cat > conftest.$ac_ext <<EOF
    4415 #line 4416 "configure"
     4419#line 4420 "configure"
    44164420#include "confdefs.h"
    44174421#include <$ac_hdr>
    44184422EOF
    44194423ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
    4420 { (eval echo configure:4421: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
     4424{ (eval echo configure:4425: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
    44214425ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
    44224426if test -z "$ac_err"; then
     
    44874491
    44884492echo $ac_n "checking which apint package to use""... $ac_c" 1>&6
    4489 echo "configure:4490: checking which apint package to use" >&5
     4493echo "configure:4494: checking which apint package to use" >&5
    44904494if test "${with_apint}" != gmp && test "${with_apint}" != smallgmp; then
    44914495  if test "$ac_gmp_ok" = yes || test "$enable_gmp" = yes; then
     
    45294533#
    45304534echo $ac_n "checking whether to have MP""... $ac_c" 1>&6
    4531 echo "configure:4532: checking whether to have MP" >&5
     4535echo "configure:4536: checking whether to have MP" >&5
    45324536if test "${with_MP}" != yes && test "${with_MP}" != no; then
    45334537  if (test "${will_have_gmp}" = yes) && \
     
    45644568
    45654569echo $ac_n "checking whether to have factory""... $ac_c" 1>&6
    4566 echo "configure:4567: checking whether to have factory" >&5
     4570echo "configure:4571: checking whether to have factory" >&5
    45674571if test "${with_factory}" != yes && test "${with_factory}" != no; then
    45684572  if test "$ac_factory_ok" =  yes || test "$enable_factory" = yes; then
     
    45954599
    45964600echo $ac_n "checking whether to have libfac""... $ac_c" 1>&6
    4597 echo "configure:4598: checking whether to have libfac" >&5
     4601echo "configure:4602: checking whether to have libfac" >&5
    45984602if test "${with_libfac}" != yes && test "${with_libfac}" != no; then
    45994603  if (test "${will_have_factory}" = yes) && \
     
    46294633
    46304634echo $ac_n "checking whether to have dbm links""... $ac_c" 1>&6
    4631 echo "configure:4632: checking whether to have dbm links" >&5
     4635echo "configure:4636: checking whether to have dbm links" >&5
    46324636if test "$with_dbm" != no; then
    46334637  cat >> confdefs.h <<\EOF
     
    46414645
    46424646echo $ac_n "checking whether to have namespaces""... $ac_c" 1>&6
    4643 echo "configure:4644: checking whether to have namespaces" >&5
     4647echo "configure:4648: checking whether to have namespaces" >&5
    46444648if test "$with_namespaces" != yes; then
    46454649  echo "$ac_t""no" 1>&6
     
    46534657
    46544658echo $ac_n "checking whether to have dynamic modules""... $ac_c" 1>&6
    4655 echo "configure:4656: checking whether to have dynamic modules" >&5
     4659echo "configure:4660: checking whether to have dynamic modules" >&5
    46564660if test "$with_dynamic_modules" != yes || test "$ac_have_dl" != yes; then
    46574661  echo "$ac_t""no" 1>&6
     
    46654669
    46664670echo $ac_n "checking whether to have dynamic kernel""... $ac_c" 1>&6
    4667 echo "configure:4668: checking whether to have dynamic kernel" >&5
     4671echo "configure:4672: checking whether to have dynamic kernel" >&5
    46684672if test "$with_dynamic_kernel" != no && test "$ac_lib_dl" = yes; then
    46694673  DL_KERNEL=1
     
    46734677
    46744678echo $ac_n "checking whether to have Plural""... $ac_c" 1>&6
    4675 echo "configure:4676: checking whether to have Plural" >&5
     4679echo "configure:4680: checking whether to have Plural" >&5
    46764680if test "$with_plural" != yes; then
    46774681  echo "$ac_t""no" 1>&6
  • Singular/configure.in

    r33ec11 r2f436b  
    4848SINGULAR_MAJOR_VERSION=${SINGULAR_MAJOR_VERSION:-1}
    4949SINGULAR_MINOR_VERSION=${SINGULAR_MINOR_VERSION:-3}
    50 SINGULAR_SUB_VERSION=${SINGULAR_SUB_VERSION:-12}
     50SINGULAR_SUB_VERSION=${SINGULAR_SUB_VERSION:-13}
    5151SINGULAR_VERSION="${SINGULAR_VERSION:-$SINGULAR_MAJOR_VERSION${VERSION_SEP}$SINGULAR_MINOR_VERSION${VERSION_SEP}$SINGULAR_SUB_VERSION}"
    52 VERSION_DATE=${VERSION_DATE:-"December 2000"}
     52VERSION_DATE=${VERSION_DATE:-"January 2001"}
    5353
    5454dnl pass them on into the Makefiles
  • Singular/dError.c

    r33ec11 r2f436b  
    77 *  Author:  obachman (Olaf Bachmann)
    88 *  Created: 9/00
    9  *  Version: $Id: dError.c,v 1.5 2000-11-06 15:20:37 obachman Exp $
     9 *  Version: $Id: dError.c,v 1.6 2000-12-31 15:14:29 obachman Exp $
    1010 *******************************************************************/
    1111#ifndef DERROR_C
     
    3333  fprintf(stderr, "\n// ***dErrror: ");
    3434  vfprintf(stderr, fmt, ap);
     35#if !defined(OM_NDEBUG) && defined(HAVE_CONFIG_H)
    3536  fprintf(stderr, " occured at: \n");
    36 #ifdef HAVE_CONFIG_H
    3737  omPrintCurrentBackTraceMax(stderr, 8);
    3838#endif
  • Singular/dError.h

    r33ec11 r2f436b  
    77 *  Author:  obachman (Olaf Bachmann)
    88 *  Created: 9/00
    9  *  Version: $Id: dError.h,v 1.4 2000-12-07 15:03:55 obachman Exp $
     9 *  Version: $Id: dError.h,v 1.5 2000-12-31 15:14:29 obachman Exp $
    1010 *******************************************************************/
    1111#ifndef DERROR_H
     
    1818extern int dReportError(const char* fmt, ...);
    1919#define dReportBug(s) \
    20   dReportError("Bug reported %s\n occured at %s,%l\n", s, __FILE__, __LINE__)
     20  dReportError("Bug reported: %s\n occured at %s,%d\n", s, __FILE__, __LINE__)
    2121#endif
    2222
  • Singular/ideals.cc

    r33ec11 r2f436b  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: ideals.cc,v 1.118 2000-12-14 16:38:48 obachman Exp $ */
     4/* $Id: ideals.cc,v 1.119 2000-12-31 15:14:30 obachman Exp $ */
    55/*
    66* ABSTRACT - all basic methods to manipulate ideals
     
    25922592}
    25932593
     2594// #define NEW_STUFF
     2595#ifndef NEW_STUFF
    25942596// converts mat to module, destroys mat
    25952597ideal idMatrix2Module(matrix mat)
     
    26222624  return result;
    26232625}
     2626#else
     2627
     2628#include "sbuckets.h"
     2629
     2630// converts mat to module, destroys mat
     2631ideal idMatrix2Module(matrix mat)
     2632{
     2633  ideal result = idInit(MATCOLS(mat),MATROWS(mat));
     2634  int i,j, l;
     2635  poly h;
     2636  poly p;
     2637  sBucket_pt bucket = sBucketInit(currRing);
     2638
     2639  for(j=0;j<MATCOLS(mat);j++) /* j is also index in result->m */
     2640  {
     2641    for (i=1;i<=MATROWS(mat);i++)
     2642    {
     2643      h = MATELEM(mat,i,j+1);
     2644      if (h!=NULL)
     2645      {
     2646        MATELEM(mat,i,j+1)=NULL;
     2647        p_SetCompP(h,i, currRing, &l);
     2648        sBucket_Merge_p(bucket, h, l);
     2649      }
     2650    }
     2651    sBucketClearMerge(bucket, &(result->m[j]), &l);
     2652  }
     2653 
     2654  // obachman: need to clean this up
     2655  idDelete((ideal*) &mat);
     2656  return result;
     2657}
     2658#endif
    26242659
    26252660/*2
     
    26672702    }
    26682703  }
    2669 // obachman 10/99: added the following line, otherwise memory lack!
     2704  // obachman 10/99: added the following line, otherwise memory leack!
    26702705  idDelete(&mod);
    26712706  return result;
  • Singular/iparith.cc

    r33ec11 r2f436b  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: iparith.cc,v 1.244 2000-12-19 18:31:39 obachman Exp $ */
     4/* $Id: iparith.cc,v 1.245 2000-12-31 15:14:30 obachman Exp $ */
    55
    66/*
     
    17441744  return FALSE;
    17451745}
     1746static BOOLEAN jjGCD_N(leftv res, leftv u, leftv v)
     1747{
     1748  res->rtyp=NUMBER_CMD;
     1749  res->data=(char *)nGcd((number) u->Data(), (number) v->Data());
     1750  return FALSE;
     1751}
    17461752static BOOLEAN jjHILBERT2(leftv res, leftv u, leftv v)
    17471753{
     
    23532359,{jjWRONG2,    GCD_CMD,        POLY_CMD,       POLY_CMD,   POLY_CMD PROFILER}
    23542360#endif
     2361,{jjGCD_N,     GCD_CMD,        NUMBER_CMD,     NUMBER_CMD, NUMBER_CMD PROFILER}
    23552362,{jjHILBERT2,  HILBERT_CMD,    INTVEC_CMD,     IDEAL_CMD,  INT_CMD PROFILER}
    23562363,{jjHILBERT2,  HILBERT_CMD,    INTVEC_CMD,     MODUL_CMD,  INT_CMD PROFILER}
  • Singular/kInline.cc

    r33ec11 r2f436b  
    77 *  Author:  obachman (Olaf Bachmann)
    88 *  Created: 8/00
    9  *  Version: $Id: kInline.cc,v 1.22 2000-12-21 16:37:49 obachman Exp $
     9 *  Version: $Id: kInline.cc,v 1.23 2000-12-31 15:14:32 obachman Exp $
    1010 *******************************************************************/
    1111#ifndef KINLINE_CC
     
    269269}
    270270
     271KINLINE poly sTObject::Next()
     272{
     273  assume(p != NULL || t_p != NULL);
     274  if (t_p != NULL) return pNext(t_p);
     275  return pNext(p);
     276}
    271277   
    272278// Iterations
     
    620626                              new_tailRing->PolyBin,p_shallow_copy_delete,
    621627                              FALSE);
     628  last = NULL;
    622629}
    623630
     
    691698 
    692699  if (last == NULL || pLength == 0)
    693     last = pLast((t_p != NULL ? t_p : p), pLength);
     700    last = pLast(GetLmTailRing(), pLength);
    694701#ifdef HAVE_ASSUME
    695702  long fdeg;
  • Singular/kbuckets.cc

    r33ec11 r2f436b  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kbuckets.cc,v 1.22 2000-11-28 11:50:51 obachman Exp $ */
     4/* $Id: kbuckets.cc,v 1.23 2000-12-31 15:14:32 obachman Exp $ */
    55
    66#include "mod2.h"
     
    137137}
    138138
    139 
    140139/////////////////////////////////////////////////////////////////////////////
    141140// Convertion from/to Bpolys
     
    270269    *length = 0;
    271270  }
     271}
     272
     273void kBucketSetLm(kBucket_pt bucket, poly lm)
     274{
     275  kBucketMergeLm(bucket);
     276  pNext(lm) = NULL;
     277  bucket->buckets[0] = lm;
     278  bucket->buckets_length[0] = 1;
    272279}
    273280
     
    358365}
    359366
     367
     368//////////////////////////////////////////////////////////////////////////
     369///
     370/// Add to Bucket a poly ,i.e. Bpoly == n*Bpoly
     371///
     372void kBucket_Add_q(kBucket_pt bucket, poly q, int *l)
     373{
     374  if (q == NULL) return;
     375  assume(*l <= 0 || pLength(q) == *l);
     376
     377  int i, l1;
     378  ring r = bucket->bucket_ring;
     379
     380  if (*l <= 0)
     381  {
     382    l1 = pLength(q);
     383    *l = l1;
     384  }
     385  else
     386    l1 = *l;
     387 
     388  kBucketMergeLm(bucket);
     389  kbTest(bucket);
     390  i = pLogLength(l1);
     391
     392  while (bucket->buckets[i] != NULL)
     393  {
     394    q = p_Add_q(q, bucket->buckets[i],
     395                 l1, bucket->buckets_length[i], r);
     396    bucket->buckets[i] = NULL;
     397    bucket->buckets_length[i] = 0;
     398    i = pLogLength(l1);
     399  }
     400
     401  bucket->buckets[i] = q;
     402  bucket->buckets_length[i]=l1;
     403  if (i >= bucket->buckets_used)
     404    bucket->buckets_used = i;
     405  else
     406    kBucketAdjustBucketsUsed(bucket);
     407  kbTest(bucket);
     408}
     409
     410
     411
    360412//////////////////////////////////////////////////////////////////////////
    361413///
     
    432484#endif
    433485  kbTest(bucket);
     486}
     487
     488//////////////////////////////////////////////////////////////////////////
     489///
     490/// Bpoly == Bpoly - m*p; where m is a monom
     491/// Does not destroy p and m
     492/// assume (l <= 0 || pLength(p) == l)
     493void kBucket_Plus_mm_Mult_pp(kBucket_pt bucket, poly m, poly p, int l)
     494{
     495  assume(l <= 0 || pLength(p) == l);
     496  int i, l1;
     497  poly p1 = p;
     498  poly last;
     499  ring r = bucket->bucket_ring;
     500
     501  if (l <= 0)
     502  {
     503    l1 = pLength(p1);
     504    l = l1;
     505  }
     506  else
     507    l1 = l;
     508
     509  if (m == NULL || p == NULL) return;
     510
     511  kBucketMergeLm(bucket);
     512  kbTest(bucket);
     513  i = pLogLength(l1);
     514
     515  if (i <= bucket->buckets_used && bucket->buckets[i] != NULL)
     516  {
     517    p1 = p_Plus_mm_Mult_qq(bucket->buckets[i], m, p1,
     518                           bucket->buckets_length[i], l1, r);
     519    l1 = bucket->buckets_length[i];
     520    bucket->buckets[i] = NULL;
     521    bucket->buckets_length[i] = 0;
     522    i = pLogLength(l1);
     523  }
     524  else
     525  {
     526    p1 = r->p_Procs->pp_Mult_mm(p1, m, r, last);
     527  }
     528   
     529  while (bucket->buckets[i] != NULL)
     530  {
     531    p1 = p_Add_q(p1, bucket->buckets[i],
     532                 l1, bucket->buckets_length[i], r);
     533    bucket->buckets[i] = NULL;
     534    bucket->buckets_length[i] = 0;
     535    i = pLogLength(l1);
     536  }
     537
     538  bucket->buckets[i] = p1;
     539  bucket->buckets_length[i]=l1;
     540  if (i >= bucket->buckets_used)
     541    bucket->buckets_used = i;
     542  else
     543    kBucketAdjustBucketsUsed(bucket);
     544
     545  kbTest(bucket);
     546}
     547
     548poly kBucket_ExtractLarger(kBucket_pt bucket, poly q, poly append)
     549{
     550  if (q == NULL) return append;
     551  poly lm;
     552  do
     553  {
     554    lm = kBucketGetLm(bucket);
     555    if (lm == NULL) return append;
     556    if (p_LmCmp(lm, q, bucket->bucket_ring) == 1)
     557    {
     558      lm = kBucketExtractLm(bucket);
     559      pNext(append) = lm;
     560      pIter(append);
     561    }
     562    else
     563    {
     564      return append;
     565    }
     566  }
     567  while (1);
    434568}
    435569
  • Singular/kbuckets.h

    r33ec11 r2f436b  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: kbuckets.h,v 1.13 2000-11-28 11:50:52 obachman Exp $ */
     6/* $Id: kbuckets.h,v 1.14 2000-12-31 15:14:32 obachman Exp $ */
    77#include "structs.h"
    88#include "p_Procs.h"
     
    3737// i.e., afterwards Bpoly == 0
    3838void kBucketClear(kBucket_pt bucket, poly *p, int *length);
     39inline poly kBucketClear(kBucket_pt bucket)
     40{
     41  int dummy;
     42  poly p;
     43  kBucketClear(bucket, &p, &dummy);
     44  return p;
     45}
    3946
    4047// Canonicalizes Bpoly, i.e. converts polys of buckets into one poly in
     
    5360//
    5461inline poly kBucketExtractLm(kBucket_pt bucket);
     62
     63/////////////////////////////////////////////////////////////////////////////
     64// Sets Lm of Bpoly, i.e. Bpoly is changed s.t.
     65// Bpoly = Bpoly + m
     66// assumes that m is larger than all monomials of Bpoly
     67void kBucketSetLm(kBucket_pt bucket, poly lm);
     68
    5569
    5670/////////////////////////////////////////////////////////////////////////////
     
    92106void kBucket_Mult_n(kBucket_pt bucket, number n);
    93107
     108//////////////////////////////////////////////////////////////////////////
     109///
     110/// Extract all monomials of bucket which are larger than q
     111/// Append those to append, and return last monomial of append
     112poly kBucket_ExtractLarger(kBucket_pt bucket, poly q, poly append);
     113
     114
     115//////////////////////////////////////////////////////////////////////////
     116///
     117/// Add to Bucket a poly ,i.e. Bpoly == Bpoly + q
     118///
     119void kBucket_Add_q(kBucket_pt bucket, poly q, int* lq);
     120
     121// first, do ExtractLarger
     122// then add q
     123inline poly
     124kBucket_ExtractLarger_Add_q(kBucket_pt bucket, poly append, poly q, int *lq)
     125{
     126  append = kBucket_ExtractLarger(bucket, q, append);
     127  kBucket_Add_q(bucket, q, lq);
     128  return append;
     129}
    94130
    95131//////////////////////////////////////////////////////////////////////////
     
    101137                            poly spNother = NULL);
    102138
     139//////////////////////////////////////////////////////////////////////////
     140///
     141/// Bpoly == Bpoly + m*p; where m is a monom
     142/// Does not destroy p and m
     143/// assume (l <= 0 || pLength(p) == l)
     144void kBucket_Plus_mm_Mult_pp(kBucket_pt bucket, poly m, poly p, int l);
    103145
    104146//////////////////////////////////////////////////////////////////////////
  • Singular/kstd1.cc

    r33ec11 r2f436b  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kstd1.cc,v 1.76 2000-12-21 16:37:49 obachman Exp $ */
     4/* $Id: kstd1.cc,v 1.77 2000-12-31 15:14:33 obachman Exp $ */
    55/*
    66* ABSTRACT:
     
    1111
    1212// define if tailrings should be used
    13 // #define HAVE_TAIL_RING
     13#define HAVE_TAIL_RING
    1414
    1515#include "mod2.h"
     
    738738      {
    739739        pLmFree(strat->L[j].p);    /*deletes the short spoly and computes*/
     740        strat->L[j].p = NULL;
    740741        poly m1 = NULL, m2 = NULL;
    741742        // check that spoly creation is ok
     
    752753                      strat->tailRing, m1, m2, strat->R);
    753754
     755        strat->L[j].SetLmCurrRing();
    754756        if (!strat->honey)
    755757          strat->initEcart(&strat->L[j]);
     
    795797      {
    796798        pLmFree(strat->L[i].p);
     799        strat->L[i].p = NULL;
    797800        poly m1 = NULL, m2 = NULL;
    798801        // check that spoly creation is ok
     
    810813        if (! strat->L[i].IsNull())
    811814        {
     815          strat->L[i].SetLmCurrRing();
    812816          strat->L[i].SetpFDeg();
    813817          strat->L[i].ecart
  • Singular/kutil.cc

    r33ec11 r2f436b  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: kutil.cc,v 1.91 2000-12-21 16:37:50 obachman Exp $ */
     4/* $Id: kutil.cc,v 1.92 2000-12-31 15:14:33 obachman Exp $ */
    55/*
    66* ABSTRACT: kernel: utils for kStd
     
    696696    {
    697697      kFalseReturn(kTest_L(&(strat->L[i]), strat->tailRing,
    698                            (pNext(strat->L[i].p) != strat->tail), i,
     698                           strat->L[i].Next() != strat->tail, i,
    699699                           strat->T, strat->tl));
    700       if (strat->use_buckets && pNext(strat->L[i].p) != strat->tail &&
    701           strat->L[i].p1 != NULL)
     700      if (strat->use_buckets && strat->L[i].Next() != strat->tail &&
     701          strat->L[i].Next() != NULL && strat->L[i].p1 != NULL)
    702702      {
    703703        assume(strat->L[i].bucket != NULL);
  • Singular/kutil.h

    r33ec11 r2f436b  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: kutil.h,v 1.53 2000-12-21 16:37:51 obachman Exp $ */
     6/* $Id: kutil.h,v 1.54 2000-12-31 15:14:34 obachman Exp $ */
    77/*
    88* ABSTRACT: kernel: utils for kStd
     
    9696
    9797  // Iterations
     98  // simply get the next monomial
     99  KINLINE poly Next();
    98100  KINLINE void LmDeleteAndIter();
    99101
  • Singular/longalg.cc

    r33ec11 r2f436b  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: longalg.cc,v 1.52 2000-12-15 18:49:31 Singular Exp $ */
     4/* $Id: longalg.cc,v 1.53 2000-12-31 15:14:35 obachman Exp $ */
    55/*
    66* ABSTRACT:   algebraic numbers
     
    25702570BOOLEAN naDBTest(number a, char *f,int l)
    25712571{
     2572#if 0
    25722573  lnumber x=(lnumber)a;
    25732574  if (x == NULL)
     
    26122613    p = p->ne;
    26132614  }
     2615#endif
    26142616  return TRUE;
    26152617}
  • Singular/matpol.cc

    r33ec11 r2f436b  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: matpol.cc,v 1.36 2000-12-20 17:20:01 obachman Exp $ */
     4/* $Id: matpol.cc,v 1.37 2000-12-31 15:14:35 obachman Exp $ */
    55
    66/*
     
    3333/*0 implementation*/
    3434
    35 static void ppp(matrix);
    36 static void qqq() {int i=0;}
    3735
    3836typedef int perm[100];
  • Singular/mpr_numeric.cc

    r33ec11 r2f436b  
    33****************************************/
    44
    5 /* $Id: mpr_numeric.cc,v 1.12 2000-12-18 15:44:42 obachman Exp $ */
     5/* $Id: mpr_numeric.cc,v 1.13 2000-12-31 15:14:36 obachman Exp $ */
    66
    77/*
     
    150150  omFreeSize( (ADDRESS) exp, (n+1) * sizeof(Exponent_t) );
    151151
    152   pOrdPolyMerge(pit);
     152  pSortAdd(pit);
    153153  return pit;
    154154}
  • Singular/mpsr_Get.cc

    r33ec11 r2f436b  
    33****************************************/
    44
    5 /* $Id: mpsr_Get.cc,v 1.34 2000-12-12 11:03:00 obachman Exp $ */
     5/* $Id: mpsr_Get.cc,v 1.35 2000-12-31 15:14:36 obachman Exp $ */
    66/***************************************************************
    77 *
     
    566566
    567567  failr(mpsr_GetPoly(link, p, node->numchild, mlv->r));
    568   if (IsUnOrdered) p = pOrdPolyMerge(p);
     568  if (IsUnOrdered) p = pSort(p);
    569569  pTest(p);
    570570  mlv->lv = mpsr_InitLeftv(POLY_CMD, (void *) p);
     
    580580
    581581  failr(mpsr_GetPolyVector(link, p, node->numchild, mlv->r));
    582   if (IsUnOrdered) p = pOrdPolyMerge(p);
     582  if (IsUnOrdered) p = pSort(p);
    583583  pTest(p);
    584584  mlv->lv = mpsr_InitLeftv(VECTOR_CMD, (void *) p);
     
    599599    mp_failr(IMP_GetUint32(link, &nmon));
    600600    failr(mpsr_GetPoly(link, id->m[i], nmon, r));
    601     if (IsUnOrdered) id->m[i] = pOrdPolyMerge(id->m[i]);
     601    if (IsUnOrdered) id->m[i] = pSort(id->m[i]);
    602602  }
    603603  idTest(id);
     
    626626    mp_failr(IMP_GetUint32(link, &nmon));
    627627    failr(mpsr_GetPolyVector(link, id->m[i], nmon, r));
    628     if (IsUnOrdered) id->m[i] = pOrdPolyMerge(id->m[i]);
     628    if (IsUnOrdered) id->m[i] = pSort(id->m[i]);
    629629  }
    630630  if (rank == 1)
     
    664664    mp_failr(IMP_GetUint32(link, &nmon));
    665665    failr(mpsr_GetPoly(link, mp->m[i], nmon, mlv->r));
    666     if (IsUnOrdered) mp->m[i] = pOrdPolyMerge(mp->m[i]);
     666    if (IsUnOrdered) mp->m[i] = pSort(mp->m[i]);
    667667  }
    668668
  • Singular/pInline0.h

    r33ec11 r2f436b  
    77 *  Author:  obachman (Olaf Bachmann)
    88 *  Created: 8/00
    9  *  Version: $Id: pInline0.h,v 1.5 2000-11-23 17:34:11 obachman Exp $
     9 *  Version: $Id: pInline0.h,v 1.6 2000-12-31 15:14:37 obachman Exp $
    1010 *******************************************************************/
    1111#ifndef PINLINE0_H
     
    2020#include "mod2.h"
    2121#include "p_polys.h"
     22#include "ring.h"
    2223 
    23 PINLINE0 void p_SetCompP(poly p, int i, ring r)
     24PINLINE0 int p_SetCompP(poly p, int i, ring r)
    2425{
    25   while (p != NULL)
     26  if (p == NULL) return 0;
     27 
     28#ifdef PDEBUG
     29  poly q = p;
     30#endif
     31 
     32  int l = 0;
     33 
     34  if (rOrd_SetCompRequiresSetm(r))
    2635  {
    27     p_SetComp(p, i, r);
    28     p_SetmComp(p, r);
    29     pIter(p);
     36    do
     37    {
     38      p_SetComp(p, i, r);
     39      p_SetmComp(p, r);
     40      l++;
     41      pIter(p);
     42    }
     43    while (p != NULL);
    3044  }
     45  else
     46  {
     47    do
     48    {
     49      p_SetComp(p, i, r);
     50      l++;
     51      pIter(p);
     52    }
     53    while(p != NULL);
     54  }
     55#ifdef PDEBUG
     56  p_Test(q, r);
     57  assume(l == pLength(q));
     58#endif
     59  return l;
    3160}
    3261
    33 PINLINE0 void p_SetCompP(poly p, int i, ring lmRing, ring tailRing)
     62PINLINE0 int p_SetCompP(poly p, int i, ring lmRing, ring tailRing)
    3463{
    3564  if (p != NULL)
     
    3766    p_SetComp(p, i, lmRing);
    3867    p_SetmComp(p, lmRing);
    39     p_SetCompP(pNext(p), i, tailRing);
     68    return p_SetCompP(pNext(p), i, tailRing) + 1;
    4069  }
     70  else
     71    return 0;
    4172}
    4273
     
    77108  }
    78109  return result;
     110}
     111
     112BOOLEAN   p_IsConstantPoly(poly p, ring r)
     113{
     114  while(p!=NULL)
     115  {
     116    if (! p_LmIsConstantComp(p, r))
     117      return FALSE;
     118    pIter(p);
     119  }
     120  return TRUE;
    79121}
    80122
  • Singular/pInline1.h

    r33ec11 r2f436b  
    77 *  Author:  obachman (Olaf Bachmann)
    88 *  Created: 8/00
    9  *  Version: $Id: pInline1.h,v 1.14 2000-12-05 13:01:11 obachman Exp $
     9 *  Version: $Id: pInline1.h,v 1.15 2000-12-31 15:14:37 obachman Exp $
    1010 *******************************************************************/
    1111#ifndef PINLINE1_H
     
    492492  return TRUE;
    493493}
     494// test if monomial is a constant, i.e. if all exponents and the component
     495// is zero
     496PINLINE1 BOOLEAN p_LmIsConstant(const poly p, const ring r)
     497{
     498  if (p_LmIsConstantComp(p, r))
     499    return (p_GetComp(p, r) == 0);
     500  return FALSE;
     501}
     502
     503// like the respective p_LmIs* routines, except that p might be empty
     504PINLINE1 BOOLEAN p_IsConstantComp(const poly p, const ring r)
     505{
     506  if (p == NULL) return TRUE;
     507  return p_LmIsConstantComp(p, r);
     508}
     509
     510PINLINE1 BOOLEAN p_IsConstant(const poly p, const ring r)
     511{
     512  if (p == NULL) return TRUE;
     513  return p_LmIsConstant(p, r);
     514}
    494515
    495516PINLINE1 BOOLEAN p_LmExpVectorAddIsOk(const poly p1, const poly p2,
  • Singular/pInline2.h

    r33ec11 r2f436b  
    77 *  Author:  obachman (Olaf Bachmann)
    88 *  Created: 8/00
    9  *  Version: $Id: pInline2.h,v 1.22 2000-12-05 13:01:11 obachman Exp $
     9 *  Version: $Id: pInline2.h,v 1.23 2000-12-31 15:14:37 obachman Exp $
    1010 *******************************************************************/
    1111#ifndef PINLINE2_H
     
    2323#include "numbers.h"
    2424#include "p_Procs.h"
     25#include "sbuckets.h"
    2526
    2627PINLINE2 number p_SetCoeff(poly p, number n, ring r)
     
    437438PINLINE2 poly p_Mult_nn(poly p, number n, const ring r)
    438439{
    439   return r->p_Procs->p_Mult_nn(p, n, r);
     440  if (n_IsOne(n, r))
     441    return p;
     442  else
     443    return r->p_Procs->p_Mult_nn(p, n, r);
    440444}
    441445
     
    459463PINLINE2 poly pp_Mult_nn(poly p, number n, const ring r)
    460464{
    461   return r->p_Procs->pp_Mult_nn(p, n, r);
     465  if (n_IsOne(n, r))
     466    return p_Copy(p, r);
     467  else
     468    return r->p_Procs->pp_Mult_nn(p, n, r);
    462469}
    463470
     
    465472PINLINE2 poly pp_Mult_mm(poly p, poly m, const ring r)
    466473{
    467   poly last;
    468   return r->p_Procs->pp_Mult_mm(p, m, r, last);
     474  if (p_LmIsConstant(m, r))
     475    return pp_Mult_nn(p, pGetCoeff(m), r);
     476  else
     477  {
     478    poly last;
     479    return r->p_Procs->pp_Mult_mm(p, m, r, last);
     480  }
    469481}
    470482
     
    472484PINLINE2 poly p_Mult_mm(poly p, poly m, const ring r)
    473485{
    474   return r->p_Procs->p_Mult_mm(p, m, r);
     486  if (p_LmIsConstant(m, r))
     487    return p_Mult_nn(p, pGetCoeff(m), r);
     488  else
     489    return r->p_Procs->p_Mult_mm(p, m, r);
    475490}
    476491
     
    494509PINLINE2 poly pp_Mult_Coeff_mm_DivSelect(poly p, const poly m, const ring r)
    495510{
    496   return r->p_Procs->pp_Mult_Coeff_mm_DivSelect(p, m, r);
     511  int shorter;
     512  return r->p_Procs->pp_Mult_Coeff_mm_DivSelect(p, m, shorter, r);
     513}
     514
     515PINLINE2 poly pp_Mult_Coeff_mm_DivSelect(poly p, int &lp, const poly m, const ring r)
     516{
     517  int shorter;
     518  poly pp = r->p_Procs->pp_Mult_Coeff_mm_DivSelect(p, m, shorter, r);
     519  lp -= shorter;
     520  return pp;
    497521}
    498522
     
    565589// returns p + m*q destroys p, const: q, m
    566590// this should be implemented more efficiently
    567 PINLINE2 poly p_Plus_mm_Mult_qq(poly p, poly m, poly q, const ring r)
     591PINLINE2 poly p_Plus_mm_Mult_qq(poly p, poly m, poly q, int &lp, int lq,
     592                                const ring r)
    568593{
    569594  poly res, last;
     
    575600
    576601  res = r->p_Procs->p_Minus_mm_Mult_qq(p, m, q, shorter, NULL, r, last);
     602  lp = (lp + lq) - shorter;
    577603  pSetCoeff0(m, n_old);
    578604  n_Delete(&n_neg, r);
     
    580606}
    581607
     608PINLINE2 poly p_Plus_mm_Mult_qq(poly p, poly m, poly q, const ring r)
     609{
     610  int lp = 0, lq = 0;
     611  return p_Plus_mm_Mult_qq(p, m, q, lp, lq, r);
     612}
     613
    582614PINLINE2 poly p_Merge_q(poly p, poly q, const ring r)
    583615{
    584616  return r->p_Procs->p_Merge_q(p, q, r);
     617}
     618
     619PINLINE2 poly p_SortAdd(poly p, const ring r, BOOLEAN revert)
     620{
     621  if (revert) p = pReverse(p);
     622  return sBucketSortAdd(p, r);
     623}
     624
     625PINLINE2 poly p_SortMerge(poly p, const ring r, BOOLEAN revert)
     626{
     627  if (revert) p = pReverse(p);
     628  return sBucketSortMerge(p, r);
    585629}
    586630
  • Singular/p_MemCmp.h

    r33ec11 r2f436b  
    77 *  Author:  obachman (Olaf Bachmann)
    88 *  Created: 8/00
    9  *  Version: $Id: p_MemCmp.h,v 1.1 2000-09-04 14:08:17 obachman Exp $
     9 *  Version: $Id: p_MemCmp.h,v 1.2 2000-12-31 15:14:37 obachman Exp $
    1010 *******************************************************************/
    1111#ifndef P_MEM_CMP_H
     
    765765while (0)
    766766
     767/***************************************************************
     768 * 
     769 *  Bitmask
     770 * 
     771 *******************************************************************/
     772#define _p_MemCmp_Bitmask_Declare(s1, s2, bitmask)  \
     773  const unsigned long* _s1 = ((unsigned long*) s1); \
     774  const unsigned long* _s2 = ((unsigned long*) s2); \
     775  register const unsigned long _bitmask = bitmask;  \
     776  register unsigned long _v1;                       \
     777  register unsigned long _v2;                       \
     778  register unsigned long _i                         \
     779
     780
     781#define p_MemCmp_Bitmask_LengthGeneral(s1, s2, bitmask, length, actionG, actionS)   \
     782do                                                                                  \
     783{                                                                                   \
     784  _p_MemCmp_Bitmask_Declare(s1, s2, bitmask);                                             \
     785  const unsigned long _l = (unsigned long) length;                                  \
     786                                                                                    \
     787  _i=0;                                                                             \
     788                                                                                    \
     789  while (_i < _l)                                                                   \
     790  {                                                                                 \
     791    _v1 = _s1[_i];                                                                  \
     792    _v2 = _s2[_i];                                                                  \
     793                                                                                    \
     794    if ((_v1 > _v2) ||                                                              \
     795        (((_v1 & _bitmask) ^ (_v2 & _bitmask)) != ((_v2 - _v1) & _bitmask)))           \
     796      actionS;                                                                      \
     797    _i++;                                                                           \
     798  }                                                                                 \
     799  actionG;                                                                          \
     800}                                                                                   \
     801while (0)
     802
     803
     804#define _p_MemCmp_Bitmask(i, actionS)                                       \
     805do                                                                          \
     806{                                                                           \
     807  _i = i;                                                                   \
     808  _v1 = _s1[i];                                                             \
     809  _v2 = _s2[i];                                                             \
     810  if ((_v1 > _v2) ||                                                        \
     811      (((_v1 & _bitmask) ^ (_v2 & _bitmask)) != ((_v2 - _v1) & _bitmask)))     \
     812    actionS;                                                               \
     813}                                                                           \
     814while (0)
     815 
     816#define _p_MemCmp_Bitmask_LengthTwo(actionS)    \
     817  do                                            \
     818{                                               \
     819  _p_MemCmp_Bitmask(0, actionS);                \
     820  _p_MemCmp_Bitmask(1, actionS);                \
     821}                                               \
     822while (0)
     823
     824#define _p_MemCmp_Bitmask_LengthThree(actionS)  \
     825  do                                            \
     826{                                               \
     827  _p_MemCmp_Bitmask_LengthTwo(actionS);         \
     828  _p_MemCmp_Bitmask(2, actionS);                \
     829}                                               \
     830while (0)
     831
     832#define _p_MemCmp_Bitmask_LengthFour(actionS)   \
     833  do                                            \
     834{                                               \
     835  _p_MemCmp_Bitmask_LengthThree(actionS);    \
     836  _p_MemCmp_Bitmask(3, actionS);                \
     837}                                               \
     838while (0)
     839
     840
     841#define _p_MemCmp_Bitmask_LengthFive(actionS)   \
     842  do                                            \
     843{                                               \
     844  _p_MemCmp_Bitmask_LengthFour(actionS);     \
     845  _p_MemCmp_Bitmask(4, actionS);                \
     846}                                               \
     847while (0)
     848
     849
     850#define _p_MemCmp_Bitmask_LengthSix(actionS)    \
     851  do                                            \
     852{                                               \
     853  _p_MemCmp_Bitmask_LengthFive(actionS);     \
     854  _p_MemCmp_Bitmask(5, actionS);                \
     855}                                               \
     856while (0)
     857
     858#define _p_MemCmp_Bitmask_LengthSeven(actionS)  \
     859  do                                            \
     860{                                               \
     861  _p_MemCmp_Bitmask_LengthSix(actionS);      \
     862  _p_MemCmp_Bitmask(6, actionS);                \
     863}                                               \
     864while (0)
     865
     866#define _p_MemCmp_Bitmask_LengthEight(actionS)  \
     867do                                              \
     868{                                               \
     869  _p_MemCmp_Bitmask_LengthSeven(actionS);    \
     870  _p_MemCmp_Bitmask(7, actionS);                \
     871}                                               \
     872while (0)
     873
     874#define p_MemCmp_Bitmask_LengthZero(s1, s2, bitmask, length, actionG, actionS) actionG
     875
     876#define p_MemCmp_Bitmask_LengthOne(s1, s2, bitmask, length, actionG, actionS)   \
     877do                                                                              \
     878{                                                                               \
     879  _p_MemCmp_Bitmask_Declare(s1, s2, bitmask);                                         \
     880  _p_MemCmp_Bitmask(0, actionS);                                                \
     881  actionG;                                                                      \
     882}                                                                               \
     883while (0)
     884
     885#define p_MemCmp_Bitmask_LengthTwo(s1, s2, bitmask, length, actionG, actionS)   \
     886do                                                                              \
     887{                                                                               \
     888  _p_MemCmp_Bitmask_Declare(s1, s2, bitmask);                                         \
     889  _p_MemCmp_Bitmask_LengthTwo(actionS);                                         \
     890  actionG;                                                                      \
     891}                                                                               \
     892while (0)
     893
     894#define p_MemCmp_Bitmask_LengthThree(s1, s2, bitmask, length, actionG, actionS)   \
     895do                                                                              \
     896{                                                                               \
     897  _p_MemCmp_Bitmask_Declare(s1, s2, bitmask);                                         \
     898  _p_MemCmp_Bitmask_LengthThree(actionS);                                         \
     899  actionG;                                                                      \
     900}                                                                               \
     901while (0)
     902
     903#define p_MemCmp_Bitmask_LengthFour(s1, s2, bitmask, length, actionG, actionS)   \
     904do                                                                              \
     905{                                                                               \
     906  _p_MemCmp_Bitmask_Declare(s1, s2, bitmask);                                         \
     907  _p_MemCmp_Bitmask_LengthFour(actionS);                                         \
     908  actionG;                                                                      \
     909}                                                                               \
     910while (0)
     911
     912#define p_MemCmp_Bitmask_LengthFive(s1, s2, bitmask, length, actionG, actionS)   \
     913do                                                                              \
     914{                                                                               \
     915  _p_MemCmp_Bitmask_Declare(s1, s2, bitmask);                                         \
     916  _p_MemCmp_Bitmask_LengthFive(actionS);                                         \
     917  actionG;                                                                      \
     918}                                                                               \
     919while (0)
     920
     921#define p_MemCmp_Bitmask_LengthSix(s1, s2, bitmask, length, actionG, actionS)   \
     922do                                                                              \
     923{                                                                               \
     924  _p_MemCmp_Bitmask_Declare(s1, s2, bitmask);                                         \
     925  _p_MemCmp_Bitmask_LengthSix(actionS);                                         \
     926  actionG;                                                                      \
     927}                                                                               \
     928while (0)
     929
     930#define p_MemCmp_Bitmask_LengthSeven(s1, s2, bitmask, length, actionG, actionS) \
     931do                                                                              \
     932{                                                                               \
     933  _p_MemCmp_Bitmask_Declare(s1, s2, bitmask);                                         \
     934  _p_MemCmp_Bitmask_LengthSeven(actionS);                                       \
     935  actionG;                                                                      \
     936}                                                                               \
     937while (0)
     938
     939#define p_MemCmp_Bitmask_LengthEigth(s1, s2, bitmask, length, actionG, actionS) \
     940do                                                                              \
     941{                                                                               \
     942  _p_MemCmp_Bitmask_Declare(s1, s2, bitmask);                                         \
     943  _p_MemCmp_Bitmask_LengthEigth(actionS);                                       \
     944  actionG;                                                                      \
     945}                                                                               \
     946while (0)
     947
     948
    767949#endif // P_MEM_CMP
  • Singular/p_Merge_q__Template.cc

    r33ec11 r2f436b  
    77 *  Author:  obachman (Olaf Bachmann)
    88 *  Created: 8/00
    9  *  Version: $Id: p_Merge_q__Template.cc,v 1.3 2000-12-07 15:03:58 obachman Exp $
     9 *  Version: $Id: p_Merge_q__Template.cc,v 1.4 2000-12-31 15:14:38 obachman Exp $
    1010 *******************************************************************/
    1111
     
    3636  // should never get here
    3737  dReportError("Equal monomials in p_Merge_q");
    38   goto Finish;
    39      
     38  return NULL;
     39 
    4040  Greater:
    4141  a = pNext(a) = p;
  • Singular/p_Mult_q.cc

    r33ec11 r2f436b  
    77 *  Author:  obachman (Olaf Bachmann)
    88 *  Created: 8/00
    9  *  Version: $Id: p_Mult_q.cc,v 1.6 2000-11-23 17:34:11 obachman Exp $
     9 *  Version: $Id: p_Mult_q.cc,v 1.7 2000-12-31 15:14:38 obachman Exp $
    1010 *******************************************************************/
    1111#include "mod2.h"
     
    2020#include "p_Procs.h"
    2121#include "p_Numbers.h"
    22 
    23 
    24 poly _p_Mult_q(poly p, poly q, const int copy, const ring r)
     22#include "kbuckets.h"
     23
     24#include "p_Mult_q.h"
     25
     26BOOLEAN pqLength(poly p, poly q, int &lp, int &lq, const int min)
     27{
     28  int l = 0;
     29 
     30  do
     31  {
     32    if (p == NULL)
     33    {
     34      lp = l;
     35      if (l < min)
     36      {
     37        if (q != NULL)
     38          lq = l+1;
     39        else
     40          lq = l;
     41        return FALSE;
     42      }
     43      lq = l + pLength(q);
     44      return TRUE;
     45    }
     46    pIter(p);
     47    if (q == NULL)
     48    {
     49      lq = l;
     50      if (l < min)
     51      {
     52        lp = l+1;
     53        return FALSE;
     54      }
     55      lp = l + 1 + pLength(p);
     56      return TRUE;
     57    }
     58    pIter(q);
     59    l++;
     60  }
     61  while (1);
     62}
     63
     64     
     65static poly _p_Mult_q_Bucket(poly p, const int lp,
     66                             poly q, const int lq,
     67                             const int copy, const ring r)
     68{
     69  assume(p != NULL && pNext(p) != NULL && q != NULL && pNext(q) != NULL);
     70  pAssume1(! pHaveCommonMonoms(p, q));
     71  assume(lp >= 1 && lq >= 1);
     72  p_Test(p, r);
     73  p_Test(q, r);
     74
     75  poly res = pp_Mult_mm(p,q,r);     // holds initially q1*p
     76  poly qq = pNext(q);               // we iter of this
     77  poly qn = pp_Mult_mm(qq, p,r);    // holds p1*qi
     78  poly pp = pNext(p);               // used for Lm(qq)*pp
     79  poly rr = res;                    // last monom which is surely not NULL
     80  poly rn = pNext(res);             // pNext(rr)
     81  number n, n1;
     82 
     83  kBucket_pt bucket = kBucketCreate(r);
     84 
     85  // initialize bucket
     86  kBucketInit(bucket, pNext(rn), lp - 2);
     87  pNext(rn) = NULL;
     88
     89  // now the main loop
     90  Top:
     91  if (rn == NULL) goto Smaller;
     92  p_LmCmpAction(rn, qn, r, goto Equal, goto Greater, goto Smaller);
     93 
     94  Greater:
     95  // rn > qn, so iter
     96  rr = rn;
     97  pNext(rn) = kBucketExtractLm(bucket);
     98  pIter(rn);
     99  goto Top;
     100 
     101  // rn < qn, append qn to rr, and compute next Lm(qq)*pp
     102  Smaller:
     103  pNext(rr) = qn;
     104  rr = qn;
     105  pIter(qn);
     106  Work: // compute res + Lm(qq)*pp
     107  if (rn == NULL)
     108  {
     109    pNext(rr) = pp_Mult_mm(pp, qq, r);
     110    kBucketInit(bucket, pNext(pNext(rr)), lp - 2);
     111    pNext(pNext(rr)) = NULL;
     112  }
     113  else
     114  {
     115    kBucketSetLm(bucket, rn);
     116    kBucket_Plus_mm_Mult_pp(bucket, qq, pp, lp - 1);
     117    pNext(rr) = kBucketExtractLm(bucket);
     118  }
     119 
     120  pIter(qq);
     121  if (qq == NULL) goto Finish;
     122  rn = pNext(rr);
     123  goto Top;
     124 
     125  Equal:
     126  n1 = pGetCoeff(rn);
     127  n = n_Add(n1, pGetCoeff(qn), r);
     128  n_Delete(&n1, r);
     129  if (n_IsZero(n, r))
     130  {
     131    n_Delete(&n, r);
     132    p_LmFree(rn, r);
     133  }
     134  else
     135  {
     136    pSetCoeff0(rn, n);
     137    rr = rn;
     138  }
     139  rn = kBucketExtractLm(bucket);
     140  n_Delete(&pGetCoeff(qn),r);
     141  qn = p_LmFreeAndNext(qn, r);
     142  goto Work;
     143 
     144  Finish:
     145  assume(rr != NULL && pNext(rr) != NULL);
     146  pNext(pNext(rr)) = kBucketClear(bucket);
     147  kBucketDestroy(&bucket);
     148 
     149  if (!copy)
     150  {
     151    p_Delete(&p, r);
     152    p_Delete(&q, r);
     153  }
     154  p_Test(res, r);
     155  return res;
     156}
     157
     158
     159static poly _p_Mult_q_Normal(poly p, poly q, const int copy, const ring r)
    25160{
    26161  assume(p != NULL && pNext(p) != NULL && q != NULL && pNext(q) != NULL);
     
    95230}
    96231
     232
     233poly _p_Mult_q(poly p, poly q, const int copy, const ring r)
     234{
     235  int lp, lq, l;
     236  poly pt;
     237 
     238  pqLength(p, q, lp, lq, MIN_LENGTH_BUCKET);
     239 
     240  if (lp < lq)
     241  {
     242    pt = p;
     243    p =  q;
     244    q = pt;
     245    l = lp;
     246    lp = lq;
     247    lq = l;
     248  }
     249  if (lq < MIN_LENGTH_BUCKET || TEST_OPT_NOT_BUCKETS)
     250    return _p_Mult_q_Normal(p, q, copy, r);
     251  else
     252  {
     253    assume(lp == pLength(p));
     254    assume(lq == pLength(q));
     255    return _p_Mult_q_Bucket(p, lp, q, lq, copy, r);
     256  }
     257}
  • Singular/p_Procs.h

    r33ec11 r2f436b  
    88 *  Author:  obachman (Olaf Bachmann)
    99 *  Created: 8/00
    10  *  Version: $Id: p_Procs.h,v 1.11 2000-12-07 15:03:59 obachman Exp $
     10 *  Version: $Id: p_Procs.h,v 1.12 2000-12-31 15:14:39 obachman Exp $
    1111 *******************************************************************/
    1212#ifndef P_PROCS_H
     
    3232                                            const ring r, poly &last);
    3333typedef poly (*p_Neg_Proc_Ptr)(poly p, const ring r);
    34 typedef poly (*pp_Mult_Coeff_mm_DivSelect_Proc_Ptr)(poly p, const poly m,
    35                                                     const ring r);
     34typedef poly (*pp_Mult_Coeff_mm_DivSelect_Proc_Ptr)(poly p, const poly m,
     35                                                    int &shorter,const ring r);
     36typedef poly (*pp_Mult_Coeff_mm_DivSelectMult_Proc_Ptr)
     37  (poly p,const poly m, const poly a, const poly b, int &shorter,const ring r);
     38
    3639typedef poly (*p_Merge_q_Proc_Ptr)(poly p, poly q, const ring r);
    3740typedef void (*p_kBucketSetLm_Proc_Ptr)(kBucket_pt bucket);
     
    5154  p_Neg_Proc_Ptr                        p_Neg;
    5255  pp_Mult_Coeff_mm_DivSelect_Proc_Ptr   pp_Mult_Coeff_mm_DivSelect;
     56  pp_Mult_Coeff_mm_DivSelectMult_Proc_Ptr   pp_Mult_Coeff_mm_DivSelectMult;
    5357  p_Merge_q_Proc_Ptr                    p_Merge_q;
    5458  p_kBucketSetLm_Proc_Ptr               p_kBucketSetLm;
  • Singular/p_Procs_Dynamic.cc

    r33ec11 r2f436b  
    77 *  Author:  obachman (Olaf Bachmann)
    88 *  Created: 12/00
    9  *  Version: $Id: p_Procs_Dynamic.cc,v 1.2 2000-12-12 08:44:49 obachman Exp $
     9 *  Version: $Id: p_Procs_Dynamic.cc,v 1.3 2000-12-31 15:14:39 obachman Exp $
    1010 *******************************************************************/
    1111#include "mod2.h"
     
    105105      case pp_Mult_Coeff_mm_DivSelect_Proc:
    106106        return pp_Mult_Coeff_mm_DivSelect__FieldGeneral_LengthGeneral_OrdGeneral;
     107      case pp_Mult_Coeff_mm_DivSelectMult_Proc:
     108        return pp_Mult_Coeff_mm_DivSelectMult__FieldGeneral_LengthGeneral_OrdGeneral;
    107109      case p_Merge_q_Proc:
    108110        return p_Merge_q__FieldGeneral_LengthGeneral_OrdGeneral;
     
    147149      case pp_Mult_Coeff_mm_DivSelect_Proc:
    148150        return "pp_Mult_Coeff_mm_DivSelect__FieldGeneral_LengthGeneral_OrdGeneral";
     151      case pp_Mult_Coeff_mm_DivSelectMult_Proc:
     152        return "pp_Mult_Coeff_mm_DivSelectMult__FieldGeneral_LengthGeneral_OrdGeneral";
    149153      case p_Merge_q_Proc:
    150154        return "p_Merge_q__FieldGeneral_LengthGeneral_OrdGeneral";
  • Singular/p_Procs_Generate.cc

    r33ec11 r2f436b  
    88 *  Author:  obachman (Olaf Bachmann)
    99 *  Created: 8/00
    10  *  Version: $Id: p_Procs_Generate.cc,v 1.3 2000-12-20 17:20:02 obachman Exp $
     10 *  Version: $Id: p_Procs_Generate.cc,v 1.4 2000-12-31 15:14:39 obachman Exp $
    1111 *******************************************************************/
    1212
     
    7070
    7171const char* macros_length[] =
    72 {"p_MemCopy", "p_MemAdd", "p_MemSum", NULL};
     72{"p_MemCopy", "p_MemAdd", "p_MemSum", "p_MemDiff", NULL};
    7373
    7474const char* macros_length_ord[] = {"p_MemCmp", NULL};
     
    147147  {
    148148    printf("#define DECLARE_LENGTH(what) what\n");
    149     printf("#define p_MemAddAdjust(p, r) p_MemAdd_NegWeightAdjust(p, r)\n");
     149    if (proc != pp_Mult_Coeff_mm_DivSelectMult_Proc)
     150      printf("#define p_MemAddAdjust(p, r) p_MemAdd_NegWeightAdjust(p, r)\n");
     151    else
     152      printf("#define p_MemAddAdjust(p, r) ((void)0)\n");
    150153  }
    151154 
     
    156159  else
    157160    printf("#define DECLARE_ORDSGN(what) what\n");
     161
     162  if (proc == pp_Mult_Coeff_mm_DivSelectMult_Proc)
     163  {
     164    printf("#undef DECLARE_LENGTH_2\n");
     165    printf("#undef p_MemCmp_Bitmask_2\n");
     166    if (length != LengthGeneral)
     167    {
     168      printf("#define DECLARE_LENGTH_2(what) ((void)0)\n");
     169      if (length < LengthTwo)
     170        printf("#define p_MemCmp_Bitmask_2 p_MemCmp_Bitmask_%s\n", p_LengthEnum_2_String((p_Length) ((int) length + 2)));
     171      else
     172      printf("#define p_MemCmp_Bitmask_2 p_MemCmp_Bitmask_LengthZero\n");
     173    }
     174    else
     175    {
     176      printf("#define DECLARE_LENGTH_2(what) what \n");
     177      printf("#define p_MemCmp_Bitmask_2 p_MemCmp_Bitmask_LengthGeneral\n");
     178    }
     179   
     180     
     181    printf("#undef p_MemAddAdjust\n");
     182    printf("#define p_MemAddAdjust(p, r) ((void)0)\n");
     183  }
    158184
    159185  printf("#undef %s\n#define %s %s\n", s_what, s_what, s_full_proc_name);
  • Singular/p_Procs_Impl.h

    r33ec11 r2f436b  
    77 *  Author:  obachman (Olaf Bachmann)
    88 *  Created: 12/00
    9  *  Version: $Id: p_Procs_Impl.h,v 1.3 2000-12-20 17:18:52 obachman Exp $
     9 *  Version: $Id: p_Procs_Impl.h,v 1.4 2000-12-31 15:14:39 obachman Exp $
    1010 *******************************************************************/
    1111#ifndef P_PROCS_IMPL_H
     
    188188  p_Neg_Proc,
    189189  pp_Mult_Coeff_mm_DivSelect_Proc,
     190  pp_Mult_Coeff_mm_DivSelectMult_Proc,
    190191  p_Merge_q_Proc,
    191192  p_kBucketSetLm_Proc,
     
    277278      case p_Neg_Proc: return "p_Neg_Proc";
    278279      case pp_Mult_Coeff_mm_DivSelect_Proc: return "pp_Mult_Coeff_mm_DivSelect_Proc";
     280      case pp_Mult_Coeff_mm_DivSelectMult_Proc: return "pp_Mult_Coeff_mm_DivSelectMult_Proc";
    279281      case p_Merge_q_Proc: return "p_Merge_q_Proc";
    280282      case p_kBucketSetLm_Proc: return "p_kBucketSetLm_Proc";
     
    519521        pp_Mult_mm_Noether_Filter(field, length, ord);
    520522        break;
    521        
     523
     524        case pp_Mult_Coeff_mm_DivSelectMult_Proc:
     525          if (length == LengthOne)
     526          {
     527            field = FieldGeneral;
     528            length = LengthGeneral;
     529            ord = OrdGeneral;
     530            return;
     531          }
     532          break;
     533         
    522534      default: break;
    523535  }
     
    590602      case pp_Mult_nn_Proc:
    591603      case pp_Mult_Coeff_mm_DivSelect_Proc:
     604      case pp_Mult_Coeff_mm_DivSelectMult_Proc:
    592605        return index(field, length);
    593606
     
    627640while (0)                                                   \
    628641 
    629 #define SetProcs(field, length, ord)                                \
    630 do                                                                  \
    631 {                                                                   \
    632   SetProc(p_Delete, field, LengthGeneral, OrdGeneral);              \
    633   SetProc(p_Mult_nn, field, LengthGeneral, OrdGeneral);             \
    634   SetProc(pp_Mult_nn, field, length, OrdGeneral);                   \
    635   SetProc(p_ShallowCopyDelete, FieldGeneral, length, OrdGeneral);   \
    636   SetProc(p_Copy, field, length, OrdGeneral);                       \
    637   SetProc(pp_Mult_mm, field, length, OrdGeneral);                   \
    638   SetProc(pp_Mult_mm_Noether, field, length, ord);                  \
    639   SetProc(p_Mult_mm, field, length, OrdGeneral);                    \
    640   SetProc(p_Add_q, field, length, ord);                             \
    641   SetProc(p_Minus_mm_Mult_qq, field, length, ord);                  \
    642   SetProc(p_kBucketSetLm, field, length, ord);                      \
    643   SetProc(p_Neg, field, LengthGeneral, OrdGeneral);                 \
    644   SetProc(pp_Mult_Coeff_mm_DivSelect, field, length, OrdGeneral);   \
    645   SetProc(p_Merge_q, FieldGeneral, length, ord);                    \
    646 }                                                                   \
     642#define SetProcs(field, length, ord)                                    \
     643do                                                                      \
     644{                                                                       \
     645  SetProc(p_Delete, field, LengthGeneral, OrdGeneral);                  \
     646  SetProc(p_Mult_nn, field, LengthGeneral, OrdGeneral);                 \
     647  SetProc(pp_Mult_nn, field, length, OrdGeneral);                       \
     648  SetProc(p_ShallowCopyDelete, FieldGeneral, length, OrdGeneral);       \
     649  SetProc(p_Copy, field, length, OrdGeneral);                           \
     650  SetProc(pp_Mult_mm, field, length, OrdGeneral);                       \
     651  SetProc(pp_Mult_mm_Noether, field, length, ord);                      \
     652  SetProc(p_Mult_mm, field, length, OrdGeneral);                        \
     653  SetProc(p_Add_q, field, length, ord);                                 \
     654  SetProc(p_Minus_mm_Mult_qq, field, length, ord);                      \
     655  SetProc(p_kBucketSetLm, field, length, ord);                          \
     656  SetProc(p_Neg, field, LengthGeneral, OrdGeneral);                     \
     657  SetProc(pp_Mult_Coeff_mm_DivSelect, field, length, OrdGeneral);       \
     658  SetProc(pp_Mult_Coeff_mm_DivSelectMult, field, length, OrdGeneral);   \
     659  SetProc(p_Merge_q, FieldGeneral, length, ord);                        \
     660}                                                                       \
    647661while (0)
    648662
  • Singular/p_Procs_Set.h

    r33ec11 r2f436b  
    1212 *  Author:  obachman (Olaf Bachmann)
    1313 *  Created: 12/00
    14  *  Version: $Id: p_Procs_Set.h,v 1.2 2000-12-12 08:44:50 obachman Exp $
     14 *  Version: $Id: p_Procs_Set.h,v 1.3 2000-12-31 15:14:40 obachman Exp $
    1515 *******************************************************************/
    1616
     
    114114#endif
    115115
     116#define CheckProc(which)                                    \
     117do                                                          \
     118{                                                           \
     119  if (p_Procs->which == NULL)                               \
     120  {                                                         \
     121    dReportBug("p_Procs is NULL");                          \
     122    Warn("Singular will work properly, but much slower");   \
     123    p_Procs->which = (which##_Proc_Ptr)                     \
     124      which##__FieldGeneral_LengthGeneral_OrdGeneral;       \
     125  }                                                         \
     126}                                                           \
     127while (0)
     128
    116129// Choose a set of p_Procs
    117130void p_ProcsSet(ring r, p_Procs_s* p_Procs)
     
    130143  InitSetProcs(field, length, ord);
    131144  SetProcs(field, length, ord);
    132   assume(
    133     (p_Procs->p_Delete != NULL) &&
    134     (p_Procs->p_ShallowCopyDelete != NULL) &&
    135     (p_Procs->p_Mult_nn != NULL) &&
    136     (p_Procs->pp_Mult_nn != NULL) &&
    137     (p_Procs->p_Copy != NULL) &&
    138     (p_Procs->pp_Mult_mm != NULL) &&
    139     (p_Procs->pp_Mult_mm_Noether != NULL) &&
    140     (p_Procs->p_Mult_mm != NULL) &&
    141     (p_Procs->p_Add_q != NULL) &&
    142     (p_Procs->p_Neg != NULL) &&
    143     (p_Procs->pp_Mult_Coeff_mm_DivSelect != NULL) &&
    144     (p_Procs->p_Merge_q != NULL) &&
    145     (p_Procs->p_kBucketSetLm != NULL) &&
    146     (p_Procs->p_Minus_mm_Mult_qq != NULL));
     145  CheckProc(p_Copy);
     146  CheckProc(p_Delete);
     147  CheckProc(p_ShallowCopyDelete);
     148  CheckProc(p_Mult_nn);
     149  CheckProc(pp_Mult_nn);
     150  CheckProc(pp_Mult_mm);
     151  CheckProc(pp_Mult_mm_Noether);
     152  CheckProc(p_Mult_mm);
     153  CheckProc(p_Add_q);
     154  CheckProc(p_Minus_mm_Mult_qq);
     155  CheckProc(p_Neg);
     156  CheckProc(pp_Mult_Coeff_mm_DivSelect);
     157  CheckProc(pp_Mult_Coeff_mm_DivSelectMult);
     158  CheckProc(p_Merge_q);
     159  CheckProc(p_kBucketSetLm);
     160
    147161  assume(p_Procs->pp_Mult_mm_Noether != pp_Mult_mm_Noether__FieldGeneral_LengthGeneral_OrdGeneral ||
    148162         p_Procs->p_Minus_mm_Mult_qq == p_Minus_mm_Mult_qq__FieldGeneral_LengthGeneral_OrdGeneral ||
  • Singular/p_Procs_Static.cc

    r33ec11 r2f436b  
    77 *  Author:  obachman (Olaf Bachmann)
    88 *  Created: 12/00
    9  *  Version: $Id: p_Procs_Static.cc,v 1.2 2000-12-12 08:44:50 obachman Exp $
     9 *  Version: $Id: p_Procs_Static.cc,v 1.3 2000-12-31 15:14:40 obachman Exp $
    1010 *******************************************************************/
    1111#include "mod2.h"
     
    1919#include "p_MemCopy.h"
    2020#include "kbuckets.h"
     21#include "dError.h"
    2122
    2223BOOLEAN p_procs_dynamic = FALSE;
    2324
     25#define p_Procs_Static
    2426#include "p_Procs_Static.inc"
    2527
  • Singular/p_polys.h

    r33ec11 r2f436b  
    88 *  Author:  obachman (Olaf Bachmann)
    99 *  Created: 9/00
    10  *  Version: $Id: p_polys.h,v 1.18 2000-12-20 11:15:47 obachman Exp $
     10 *  Version: $Id: p_polys.h,v 1.19 2000-12-31 15:14:40 obachman Exp $
    1111 *******************************************************************/
    1212#ifndef P_POLYS_H
     
    185185// i.e., test if all exponents are zero
    186186PINLINE1 BOOLEAN p_LmIsConstantComp(const poly p, const ring r);
     187PINLINE1 BOOLEAN p_LmIsConstant(const poly p, const ring r);
     188
    187189// return TRUE, if p_LmExpVectorAdd stays within ExpBound of ring r,
    188190//       FALSE, otherwise
     
    211213// return the total degree of the long var l containing number_of_exp exponents
    212214PINLINE2 unsigned long p_GetTotalDegree(const unsigned long l, const ring r, const int number_of_exps);
     215
     216
     217// like the respective p_LmIs* routines, except that p might be empty
     218PINLINE1 BOOLEAN p_IsConstantComp(const poly p, const ring r);
     219PINLINE1 BOOLEAN p_IsConstant(const poly p, const ring r);
     220PINLINE0 BOOLEAN p_IsConstantPoly(const poly p, const ring r);
    213221
    214222// return TRUE if all monoms have the same component
     
    279287PINLINE2 poly p_Plus_mm_Mult_qq(poly p, poly m, poly q, const ring r);
    280288
     289// returns p + m*q destroys p, const: q, m
     290PINLINE2 poly p_Plus_mm_Mult_qq(poly p, poly m, poly q, int &lp, int lq,
     291                                const ring r);
     292
    281293// returns p*q, destroys p and q
    282294PINLINE2 poly p_Mult_q(poly p, poly q, const ring r);
     
    287299PINLINE2 poly pp_Mult_Coeff_mm_DivSelect(poly p, const poly m, const ring r);
    288300
     301// returns p*Coeff(m) for such monomials pm of p, for which m is divisble by pm
     302// if lp is length of p on input then lp is length of returned poly on output
     303PINLINE2 poly pp_Mult_Coeff_mm_DivSelect(poly p, int &lp, const poly m, const ring r);
     304
    289305// returns merged p and q, assumes p and q have no monomials which are equal
    290306PINLINE2 poly p_Merge_q(poly p, poly c, const ring r);
     307// sorts p using bucket sort: returns sorted poly
     308// assumes that monomials of p are all different
     309// reverses it first, if revert == TRUE, use this if input p is "almost" sorted
     310// correctly
     311PINLINE2 poly p_SortMerge(poly p, const ring r, BOOLEAN revert = FALSE);
     312// like SortMerge, except that p may have equal monimals
     313PINLINE2 poly p_SortAdd(poly p, const ring r, BOOLEAN revert = FALSE);
    291314
    292315/***************************************************************
     
    301324#define p_SetmComp  p_Setm
    302325
    303 // reverses the monomials of p
    304 PINLINE0   void p_SetCompP(poly a, int i, ring r);
    305 PINLINE0   void p_SetCompP(poly a, int i, ring lmRing, ring tailRing);
     326// sets component of poly a to i, returns length of a
     327PINLINE0   int p_SetCompP(poly a, int i, ring r);
     328PINLINE0   int p_SetCompP(poly a, int i, ring lmRing, ring tailRing);
    306329PINLINE0   long p_MaxComp(poly p, ring lmRing, ring tailRing);
    307330inline long p_MaxComp(poly p,ring lmRing) {return p_MaxComp(p,lmRing,lmRing);}
  • Singular/polys.cc

    r33ec11 r2f436b  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: polys.cc,v 1.74 2000-12-20 11:15:47 obachman Exp $ */
     4/* $Id: polys.cc,v 1.75 2000-12-31 15:14:41 obachman Exp $ */
    55
    66/*
     
    231231poly pHomogen (poly p, int varnum)
    232232{
    233   poly q=NULL;
    234   poly res;
     233  poly q=NULL, qn;
    235234  int  o,ii;
     235  sBucket_pt bp;
    236236
    237237  if (p!=NULL)
     
    250250    }
    251251    q = pCopy(p);
    252     res = q;
     252    bp = sBucketCreate(currRing);
    253253    while (q != NULL)
    254254    {
     
    259259        pSetm(q);
    260260      }
    261       pIter(q);
    262     }
    263     q = pOrdPolyInsertSetm(res);
     261      qn = pNext(q);
     262      pNext(q) = NULL;
     263      sBucket_Add_p(bp, q, 1);
     264      q = qn;
     265    }
     266    sBucketDestroyAdd(bp, &q, &ii);
    264267  }
    265268  return q;
  • Singular/polys.h

    r33ec11 r2f436b  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: polys.h,v 1.51 2000-12-20 11:15:48 obachman Exp $ */
     6/* $Id: polys.h,v 1.52 2000-12-31 15:14:41 obachman Exp $ */
    77/*
    88* ABSTRACT - all basic methods to manipulate polynomials of the
     
    209209// p*Coeff(m) for such monomials pm of p, for which m is divisble by pm
    210210#define ppMult_Coeff_mm_DivSelect(p, m)   pp_Mult_Coeff_mm_DivSelect(p, m, currRing)
     211/*************************************************************************
     212 *
     213 * Sort routines
     214 *
     215 *************************************************************************/
     216// sorts p, assumes all monomials in p are different
     217#define pSortMerger(p)          pSort(p)
     218#define pSort(p)                p_SortMerge(p, currRing)
     219
     220// sorts p, p may have equal monomials
     221#define pSortAdd(p)             p_SortAdd(p, currRing)
     222
     223
     224// Assume: If considerd only as poly in any component of p
     225// (say, monomials of other components of p are set to 0),
     226// then p is already sorted correctly
     227#define pSortCompCorrect(p) pSort(p)
     228
    211229/***************************************************************
    212230 *
     
    214232 *
    215233 ***************************************************************/
    216 #define pLmIsConstantComp(p)        p_LmIsConstantComp(p, currRing)
     234// return true if all p is eihter NULL, or if all exponents
     235// of p are 0 and Comp of p is zero
     236#define   pIsConstantComp(p)        p_IsConstantComp(p, currRing)
     237// like above, except that Comp might be != 0
     238#define   pIsConstant(p)            p_IsConstant(p,currRing)
     239// like above, except that p must be != NULL
     240#define   pLmIsConstantComp(p)      p_LmIsConstantComp(p, currRing)
     241#define   pLmIsConstant(p)          p_LmIsConstant(p,currRing)
     242
     243// return TRUE if all monomials of p are constant
     244#define   pIsConstantPoly(p)        p_IsConstantPoly(p, currRing)
     245
     246#define   pIsPurePower(p)   p_IsPurePower(p, currRing)
     247#define   pIsVector(p)      (pGetComp(p)>0)
    217248
    218249
     
    235266
    236267/*-------------predicate on polys ----------------------*/
    237 BOOLEAN   p_IsConstant(const poly p, const ring r);
    238 #define   pIsConstant(p)    p_IsConstant(p,currRing)
    239 BOOLEAN   pIsConstantPoly(poly p);
    240 #define   pIsPurePower(p)   p_IsPurePower(p, currRing)
    241 #define   pIsVector(p)      (pGetComp(p)>0)
    242268BOOLEAN   pHasNotCF(poly p1, poly p2);   /*has no common factor ?*/
    243269void      pSplit(poly p, poly * r);   /*p => IN(p), r => REST(p) */
     
    347373// the leading monomial of p2 in p1
    348374void      pCancelPolyByMonom (poly p1,poly p2,polyset * P,int * SizeOfSet);
    349 
    350 // orders monoms of poly using insertion sort, performs pSetm on each
    351 // monom (i.e. sets Order field)
    352 poly      pOrdPolyInsertSetm(poly p);
    353 
    354 // orders monoms of poly using merge sort (ususally faster than
    355 // insertion sort). ASSUMES that pSetm was performed on monoms
    356 // (i.e. that Order field is set correctly)
    357 poly      pOrdPolyMerge(poly p);
    358375
    359376poly      pPermPoly (poly p, int * perm, ring OldRing, nMapFunc nMap,
  • Singular/polys1.cc

    r33ec11 r2f436b  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: polys1.cc,v 1.60 2000-12-20 11:23:47 Singular Exp $ */
     4/* $Id: polys1.cc,v 1.61 2000-12-31 15:14:42 obachman Exp $ */
    55
    66/*
     
    2727#include "clapsing.h"
    2828#endif
    29 
    30 /*-------- several access procedures to monomials -------------------- */
    31 /*2
    32 *test if the monomial is a constant
    33 */
    34 BOOLEAN   p_IsConstant(const poly p, const ring r)
    35 {
    36   if (p!=NULL)
    37   {
    38     int i;
    39     for (i=r->N;i;i--)
    40     {
    41       if (p_GetExp(p,i,r)!=0) return FALSE;
    42     }
    43     if (p_GetComp(p,r)>0) return FALSE;
    44   }
    45   return TRUE;
    46 }
    47 
    48 /*2
    49 *test if the polynom is a constant
    50 */
    51 BOOLEAN   pIsConstantPoly(poly p)
    52 {
    53   while(p!=NULL)
    54   {
    55     for (int i=pVariables;i;i--)
    56     {
    57       if (pGetExp(p,i)!=0) return FALSE;
    58     }
    59     pIter(p);
    60   }
    61   return TRUE;
    62 }
    63 
    6429
    6530
     
    739704}
    740705
    741 // orders monoms of poly using merge sort (ususally faster than
    742 // insertion sort). ASSUMES that pSetm was performed on monoms
    743 poly pOrdPolyMerge(poly p)
    744 {
    745   poly qq,pp,result=NULL;
    746 
    747   if (p == NULL) return NULL;
    748 
    749   loop
    750   {
    751     qq = p;
    752     loop
    753     {
    754       if (pNext(p) == NULL)
    755       {
    756         result=pAdd(result, qq);
    757         pTest(result);
    758         return result;
    759       }
    760       if (pLmCmp(p,pNext(p)) != 1)
    761       {
    762         pp = p;
    763         pIter(p);
    764         pNext(pp) = NULL;
    765         result = pAdd(result, qq);
    766         break;
    767       }
    768       pIter(p);
    769     }
    770   }
    771 }
    772 
    773 // orders monoms of poly using insertion sort, performs pSetm on each monom
    774 poly pOrdPolyInsertSetm(poly p)
    775 {
    776   poly qq,result = NULL;
    777 
    778 #if 0
    779   while (p != NULL)
    780   {
    781     qq = p;
    782     pIter(p);
    783     qq->next = NULL;
    784     pSetm(qq);
    785     result = pAdd(result,qq);
    786     pTest(result);
    787   }
    788 #else
    789   while (p != NULL)
    790   {
    791     qq = p;
    792     pIter(p);
    793     qq->next = result;
    794     result = qq;
    795     pSetm(qq);
    796   }
    797   p = result;
    798   result = NULL;
    799   while (p != NULL)
    800   {
    801     qq = p;
    802     pIter(p);
    803     qq->next = NULL;
    804     result = pAdd(result, qq);
    805   }
    806   pTest(result);
    807 #endif
    808   return result;
    809 }
    810706
    811707/*2
     
    921817    }
    922818  }
    923   result=pOrdPolyMerge(result);
     819  result=pSortAdd(result);
    924820#else
    925821  //  if (qq!=NULL)
  • Singular/pp_Mult_Coeff_mm_DivSelect__Template.cc

    r33ec11 r2f436b  
    77 *  Author:  obachman (Olaf Bachmann)
    88 *  Created: 8/00
    9  *  Version: $Id: pp_Mult_Coeff_mm_DivSelect__Template.cc,v 1.4 2000-12-07 15:04:01 obachman Exp $
     9 *  Version: $Id: pp_Mult_Coeff_mm_DivSelect__Template.cc,v 1.5 2000-12-31 15:14:42 obachman Exp $
    1010 *******************************************************************/
    1111
     
    1717 *
    1818 ***************************************************************/
    19 LINKAGE poly pp_Mult_Coeff_mm_DivSelect(poly p, const poly m, const ring r)
     19LINKAGE poly pp_Mult_Coeff_mm_DivSelect(poly p, const poly m, int &shorter,
     20                                        const ring r)
    2021{
    2122  number n = pGetCoeff(m);
     
    2425  if (p == NULL) return NULL;
    2526  spolyrec rp;
     27  DECLARE_LENGTH(const unsigned long length = r->ExpL_Size);
     28  int Shorter = 0;
    2629  poly q = &rp;
    2730  omBin bin = r->PolyBin;
    28   DECLARE_LENGTH(const unsigned long length = r->ExpL_Size);
    2931
    3032  do
     
    3840      p_MemCopy(q->exp, p->exp, length);
    3941    }
     42    else
     43    {
     44      Shorter++;
     45    }
    4046    pIter(p);
    4147  }
     
    4349  pNext(q) = NULL;
    4450
     51  shorter = Shorter;
    4552  p_Test(rp.next, r);
    4653  return rp.next;
  • Singular/prCopy.cc

    r33ec11 r2f436b  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: prCopy.cc,v 1.10 2000-12-08 14:43:46 Singular Exp $ */
     4/* $Id: prCopy.cc,v 1.11 2000-12-31 15:14:43 obachman Exp $ */
    55/*
    66* ABSTRACT - implementation of functions for Copy/Move/Delete for Polys
     
    1414#include "ring.h"
    1515#include "ideals.h"
    16 
    17 // define to 0 to never revert,
    18 //           1 to always revert
    19 // undef if revert as given by parameter
    20 // #define REVERT 0
    21 
    22 // a sorting of polys based on buckets
    23 class pBucketPoly
    24 {
    25 public:
    26   poly p;
    27   long length;
    28   long max_length;
    29 };
    30 
    31 static inline poly p_BucketSort(poly p, const ring r)
    32 {
    33 #if PDEBUG > 0
    34   long l_orig = pLength(p);
    35 #endif
    36  
    37   long max_length = 1;
    38   long i;
    39   long l_p;
    40   pBucketPoly buckets[BIT_SIZEOF_LONG - 3];
    41   poly q;
    42 
    43   buckets[0].p = p;
    44   buckets[0].length = 1;
    45   buckets[0].max_length = 2;
    46   q = pNext(p);
    47   pNext(buckets[0].p) = NULL;
    48 
    49   while (q != NULL)
    50   {
    51     p = q;
    52     pIter(q);
    53     pNext(p) = NULL;
    54     i = 0;
    55     l_p = 1;
    56     while (1)
    57     {
    58       if (buckets[i].p == NULL)
    59       {
    60         buckets[i].p = p;
    61         buckets[i].length = l_p;
    62         break;
    63       }
    64       buckets[i].p = p_Merge_q(buckets[i].p, p, r);
    65       buckets[i].length += l_p;
    66       if (buckets[i].length <= buckets[i].max_length)
    67         break;
    68       p = buckets[i].p;
    69       l_p = buckets[i].length;
    70       buckets[i].p = NULL;
    71       buckets[i].length = 0;
    72       i++;
    73       if (i == max_length)
    74       {
    75         buckets[i].p = p;
    76         buckets[i].length = l_p;
    77         buckets[i].max_length = 1 << (i + 1);
    78         max_length = i+1;
    79         break;
    80       }
    81     }
    82   }
    83  
    84   i = 0;
    85   while (buckets[i].p == NULL) i++;
    86   p = buckets[i].p;
    87   for (i++; i<max_length; i++)
    88   {
    89     if (buckets[i].p != NULL)
    90       p = p_Merge_q(buckets[i].p, p, r);
    91   }
    92 
    93   p_Test(p, r);
    94 #if PDEBUG > 0
    95   assume(l_orig == pLength(p));
    96 #endif
    97   return p;
    98 }
    99 
    100 // Sorts poly, reverts it first -- this way, almost sorted polys's
    101 // don't have n^2 sorting property
    102 poly prSortR(poly p, ring r, BOOLEAN revert)
    103 {
    104   if (p == NULL) return NULL;
    105   poly qq, result = NULL;
    106 
    107 #ifdef REVERT 
    108 #if REVERT == 1
    109   revert = 1;
    110 #elif REVERT == 0
    111   revert = 0;
    112 #endif
    113 #endif
    114   if (revert)
    115   {
    116     // there must be a bug here: consider m1->m2
    117     while (p != NULL)
    118     {
    119       qq = p;
    120       pIter(p);
    121       qq->next = result;
    122       result = qq;
    123     }
    124     p = result;
    125   }
    126 
    127   return p_BucketSort(p, r);
    128 }
     16#include "sbuckets.h"
    12917
    13018static inline void
     
    330218}
    331219
    332 /////////////////////////////////////////////////////////////////////////
    333 // prDelete
    334 typedef void (*prDeleteProc_t)(poly &src_p, ring src_r);
    335 
    336 static inline void prDeleteR_NSimple(poly &p, ring r)
    337 {
    338   poly next;
    339  
    340   while (p != NULL)
    341   {
    342     next = pNext(p);
    343     omFreeBin(p, r->PolyBin);
    344     p = next;
    345   }
    346 }
    347 
    348 static inline void prDeleteR_NoNSimple(poly &p, ring r)
    349 {
    350   poly next;
    351  
    352   while (p != NULL)
    353   {
    354     next = pNext(p);
    355     nDelete(&pGetCoeff(p));
    356     omFreeBin(p, r->PolyBin);
    357     p = next;
    358   }
    359 }
    360 
    361 void prDelete(poly &p)
    362 {
    363   if (rField_has_simple_Alloc(currRing))
    364     prDeleteR_NSimple(p, currRing);
    365   else
    366     prDeleteR_NoNSimple(p, currRing);
    367 }
    368 
    369 void prDeleteR(poly &p, ring r)
    370 {
    371   if (rField_has_simple_Alloc(r))
    372     prDeleteR_NSimple(p, r);
    373   else
    374     prDeleteR_NoNSimple(p, r);
    375 }
    376 
    377 
    378 static inline void idrDelete(ideal &id, ring r,  prDeleteProc_t prproc)
    379 {
    380   if (id == NULL) return;
    381   int i = IDELEMS(id);
    382 
    383   for (; i>=0; i--)
    384     prproc(id->m[i], r);
    385  
    386   omFreeSize(id->m, IDELEMS(id)*sizeof(poly));
    387   omFreeBin(id, sip_sideal_bin);
    388   id = NULL;
    389 }
    390 
    391 void idrDelete(ideal &id)
    392 {
    393   prDeleteProc_t prproc;
    394   if (rField_has_simple_Alloc(currRing))
    395     prproc = prDeleteR_NSimple;
    396   else
    397     prproc = prDeleteR_NoNSimple;
    398  
    399   idrDelete(id, currRing, prproc);
    400 }
    401 
    402 void idrDeleteR(ideal &id, ring r)
    403 {
    404   prDeleteProc_t prproc;
    405   if (rField_has_simple_Alloc(r))
    406     prproc = prDeleteR_NSimple;
    407   else
    408     prproc = prDeleteR_NoNSimple;
    409  
    410   idrDelete(id, r, prproc);
    411 }
    412 
    413  
    414  
    415  
  • Singular/prCopy.h

    r33ec11 r2f436b  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: prCopy.h,v 1.1 1999-11-15 17:20:42 obachman Exp $ */
     4/* $Id: prCopy.h,v 1.2 2000-12-31 15:14:43 obachman Exp $ */
    55/*
    66* ABSTRACT - declarations of functions for Copy/Move/Delete for Polys
     
    1212 * MoveR, CopyR, DeleteR, HeadR, SortR
    1313 * Assume: ideal/poly from ring r
    14  *         Coef(r) == Coef(currRing)
     14 *         Coeff(r) == Coeff(currRing)
    1515 * Move, Delete: input object is destroyed and set to NULL
    1616 *
    17  * Sort: revert == TRUE is faster for polys which are almost sorted correctly
    1817 *
    1918 ************************************************************************/
     
    2322poly prCopyR(poly p, ring r);
    2423poly prHeadR(poly p, ring r);
    25 void prDeleteR(poly &p, ring r);
    26 poly prSortR(poly p, ring r, BOOLEAN revert = TRUE);
    27 poly prMergeR(poly p1, poly p2, ring r);
    2824
    2925ideal idrMoveR_NoSort(ideal &id, ring r);
     
    3228ideal idrCopyR(ideal id, ring r);
    3329ideal idrHeadR(ideal id, ring r);
    34 void  idrDeleteR(ideal &id, ring r);
    35 
    36 /*************************************************************************
    37  *
    38  * Copy, Delete, Sort
    39  *
    40  *************************************************************************/
    41 
    42 inline poly pSort(poly p, BOOLEAN revert = TRUE)
    43 {
    44   return prSortR(p, currRing, revert);
    45 }
    46 
    47 inline poly pMerge(poly p1, poly p2)
    48 {
    49   return prMergeR(p1, p2, currRing);
    50 }
    51 
    52 /*************************************************************************
    53  *
    54  * Specialized sort routines
    55  *
    56  *************************************************************************/
    57 // TBC:
    58 // Assume: If considerd only as poly in any component of p
    59 // (say, monomials of other components of p are set to 0),
    60 // then p is already sorted correctly
    61 #define pSortCompCorrect(p) pSort(p, TRUE)
    6230
    6331
     32
     33
  • Singular/prCopyMacros.h

    r33ec11 r2f436b  
    4646#define PR_SORT_POLY(p, d_r, s_r) ((void)0)
    4747#else
    48 #define PR_SORT_POLY(p, d_r, s_r) p = prSortR(p, d_r, d_r->OrdSgn == s_r->OrdSgn)
     48#define PR_SORT_POLY(p, d_r, s_r) p = p_SortMerge(p, d_r, d_r->OrdSgn == s_r->OrdSgn)
    4949#endif
    5050
  • Singular/ring.cc

    r33ec11 r2f436b  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: ring.cc,v 1.152 2000-12-20 11:15:48 obachman Exp $ */
     4/* $Id: ring.cc,v 1.153 2000-12-31 15:14:43 obachman Exp $ */
    55
    66/*
     
    19911991}
    19921992
     1993// return TRUE if p_SetComp requires p_Setm
     1994BOOLEAN rOrd_SetCompRequiresSetm(ring r)
     1995{
     1996  if (r->typ != NULL)
     1997  {
     1998    int pos;
     1999    for (pos=0;pos<r->OrdSize;pos++)
     2000    {
     2001      sro_ord* o=&(r->typ[pos]);
     2002      if (o->ord_typ == ro_syzcomp || o->ord_typ == ro_syz) return TRUE;
     2003    }
     2004  }
     2005  return FALSE;
     2006}
     2007
    19932008// return TRUE if p->exp[r->pOrdIndex] holds total degree of p */
    19942009BOOLEAN rOrd_is_Totaldegree_Ordering(ring r =currRing)
  • Singular/ring.h

    r33ec11 r2f436b  
    77* ABSTRACT - the interpreter related ring operations
    88*/
    9 /* $Id: ring.h,v 1.61 2000-12-14 16:38:55 obachman Exp $ */
     9/* $Id: ring.h,v 1.62 2000-12-31 15:14:44 obachman Exp $ */
    1010
    1111/* includes */
     
    231231// return TRUE if p->exp[r->pOrdIndex] holds total degree of p */
    232232BOOLEAN rOrd_is_Totaldegree_Ordering(ring r =currRing);
     233// return TRUE if p_SetComp requires p_Setm
     234BOOLEAN rOrd_SetCompRequiresSetm(ring r);
    233235rOrderType_t    rGetOrderType(ring r);
    234236/* returns TRUE if var(i) belongs to p-block */
    235237BOOLEAN rIsPolyVar(int i, ring r = currRing);
     238
     239inline BOOLEAN rOrd_is_c_dp(ring r)
     240{
     241  return (r->order[0] == ringorder_c &&
     242          r->order[1] == ringorder_dp &&
     243          r->order[2] == 0);
     244}
    236245
    237246#ifdef HAVE_PLURAL
  • Singular/sparsmat.cc

    r33ec11 r2f436b  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: sparsmat.cc,v 1.46 2000-12-06 11:03:30 Singular Exp $ */
     4/* $Id: sparsmat.cc,v 1.47 2000-12-31 15:14:45 obachman Exp $ */
    55
    66/*
     
    2222#include "sparsmat.h"
    2323#include "prCopy.h"
    24 
    25 /* ----------------- general definitions ------------------ */
    26 /* in structs.h
    27 typedef struct smprec sm_prec;
    28 typedef sm_prec * smpoly;
    29 struct smprec{
    30   smpoly n;            // the next element
    31   int pos;             // position
    32   int e;               // level
    33   poly m;              // the element
    34   float f;             // complexity of the element
    35 };
    36 */
    37 
    38 #if OLD > 0
    39 static poly smSelectCopy(poly, const poly);
     24#include "p_Procs.h"
     25#include "kbuckets.h"
     26#include "p_Mult_q.h"
     27
     28// define SM_NO_BUCKETS, if sparsemat stuff should not use buckets
     29// #define SM_NO_BUCKETS
     30
     31// this is also influenced by TEST_OPT_NOTBUCKETS
     32#ifndef SM_NO_BUCKETS
     33// buckets do carry a small additional overhead: only use them if
     34// min-length of polys is >= SM_MIN_LENGTH_BUCKET
     35#define SM_MIN_LENGTH_BUCKET MIN_LENGTH_BUCKET - 5
    4036#else
    41 #define smSelectCopy ppMult_Coeff_mm_DivSelect
     37#define SM_MIN_LENGTH_BUCKET    INT_MAX
    4238#endif
     39
    4340
    4441/* declare internal 'C' stuff */
     
    5855static BOOLEAN smHaveDenom(poly);
    5956static number smCleardenom(ideal);
     57
     58static poly pp_Mult_Coeff_mm_DivSelect_MultDiv(poly p, int &lp, poly m,
     59                                               poly a, poly b)
     60{
     61  if (rOrd_is_c_dp(currRing))
     62  {
     63    int shorter;
     64    p = currRing->p_Procs->pp_Mult_Coeff_mm_DivSelectMult(p, m, a, b,
     65                                                          shorter, currRing);
     66    lp -= shorter;
     67  }
     68  else
     69  {
     70    p = pp_Mult_Coeff_mm_DivSelect(p, lp, m, currRing);
     71    smExpMultDiv(p, a, b);
     72  }
     73  return p;
     74}
     75
     76static poly smSelectCopy_ExpMultDiv(poly p, poly m, poly a, poly b)
     77{
     78  int lp = 0;
     79  return pp_Mult_Coeff_mm_DivSelect_MultDiv(p, lp, m, a, b);
     80}
     81
    6082
    6183/* class for sparse matrix:
     
    134156};
    135157
     158Exponent_t smExpBound(ideal Id)
     159{
     160  Exponent_t max = 0;
     161  long ldeg;
     162  int dummy, i, n = IDELEMS(Id);
     163 
     164  for (i=0; i<n; i++)
     165  {
     166    if (Id->m[i] != NULL)
     167    {
     168      ldeg = pLDeg(Id->m[i], &dummy);
     169      if (ldeg > max) max = ldeg;
     170    }
     171  }
     172  return max*2*n;
     173}
     174
     175// #define HOMOG_LP
    136176/* ----------------- ops with rings ------------------ */
    137177ideal smRingCopy(ideal I, ring *ri, sip_sring &tmpR)
     
    139179  ring origR =NULL;
    140180  ideal II;
    141   if (currRing->order[0]!=ringorder_c)
    142   {
    143     origR =currRing;
    144     tmpR=*origR;
    145     int *ord=(int*)omAlloc0(3*sizeof(int));
    146     int *block0=(int*)omAlloc(3*sizeof(int));
    147     int *block1=(int*)omAlloc(3*sizeof(int));
    148     ord[0]=ringorder_c;
     181  origR =currRing;
     182  tmpR=*origR;
     183  int *ord=(int*)omAlloc0(3*sizeof(int));
     184  int *block0=(int*)omAlloc(3*sizeof(int));
     185  int *block1=(int*)omAlloc(3*sizeof(int));
     186  ord[0]=ringorder_c;
     187#ifdef HOMOG_LP
     188  if (idHomIdeal(I))
     189    ord[1] = ringorder_lp;
     190  else
     191#endif
    149192    ord[1]=ringorder_dp;
    150     tmpR.order=ord;
    151     tmpR.OrdSgn=1;
    152     block0[1]=1;
    153     tmpR.block0=block0;
    154     block1[1]=tmpR.N;
    155     tmpR.block1=block1;
    156     rComplete(&tmpR,1);
    157     rChangeCurrRing(&tmpR);
    158     // fetch data from the old ring
    159     II=idInit(IDELEMS(I),I->rank);
    160     int k;
    161     for (k=0;k<IDELEMS(I);k++) II->m[k] = prCopyR( I->m[k], origR);
    162   }
    163   else
    164   {
    165     II=idCopy(I);
    166   }
     193  tmpR.order=ord;
     194  tmpR.OrdSgn=1;
     195  block0[1]=1;
     196  tmpR.block0=block0;
     197  block1[1]=tmpR.N;
     198  tmpR.block1=block1;
     199
     200  tmpR.bitmask = smExpBound(I);
     201
     202  // unfortunately, we can not work (yet) with r->N == 0
     203  if (tmpR.bitmask < 1) tmpR.bitmask = 1;
     204  if (tmpR.bitmask > currRing->bitmask) tmpR.bitmask = currRing->bitmask;
     205
     206  rComplete(&tmpR,1);
     207  rChangeCurrRing(&tmpR);
     208  if (TEST_OPT_PROT)
     209    Print("[%d:%d]", (long) tmpR.bitmask, tmpR.ExpL_Size);
     210  // fetch data from the old ring
     211  II = idrCopyR(I, origR);
     212  idTest(II);
    167213  *ri = origR;
    168214  return II;
     
    951997        {
    952998          res = res->n = smElemCopy(b);
    953           res->m = smMult(b->m, w);
     999          res->m = ppMult_qq(b->m, w);
    9541000          res->e = 1;
    9551001          res->f = smPolyWeight(res);
     
    9661012      {
    9671013        res = res->n = smElemCopy(b);
    968         res->m = smMult(b->m, w);
     1014        res->m = ppMult_qq(b->m, w);
    9691015        res->e = 1;
    9701016        res->f = smPolyWeight(res);
     
    9731019      else
    9741020      {
    975         ha = smMult(a->m, p);
     1021        ha = ppMult_qq(a->m, p);
    9761022        pDelete(&a->m);
    977         hb = smMult(b->m, w);
     1023        hb = ppMult_qq(b->m, w);
    9781024        ha = pAdd(ha, hb);
    9791025        if (ha != NULL)
     
    16801726
    16811727/* ----------------- arithmetic ------------------ */
    1682 
    1683 /*
    1684 *  returns a*b
    1685 *  a,b NOT destroyed
    1686 */
    1687 poly smMult(poly a, poly b)
    1688 {
    1689   poly pa, res, r;
    1690 
    1691   if (smSmaller(a, b))
    1692   {
    1693     r = a;
    1694     a = b;
    1695     b = r;
    1696   }
    1697   if (pNext(b) == NULL)
    1698   {
    1699     if (pLmIsConstantComp(b))
    1700       return ppMult_nn(a, pGetCoeff(b));
    1701     else
    1702       return ppMult_mm(a, b);
    1703   }
    1704   pa = res = ppMult_mm(a, b);
    1705   pIter(b);
    1706   do
    1707   {
    1708     r = ppMult_mm(a, b);
    1709     smCombineChain(&pa, r);
    1710     pIter(b);
    1711   } while (b != NULL);
    1712   return res;
    1713 }
    1714 
    17151728/*2
    17161729* exact division a/b
     
    17701783}
    17711784
     1785#define X_MAS
     1786#ifdef X_MAS
     1787
    17721788/*
    17731789*  returns the part of (a*b)/exp(lead(c)) with nonegative exponents
     
    17761792{
    17771793  poly pa, e, res, r;
    1778   BOOLEAN lead;
    1779 
    1780   if (smSmaller(a, b))
     1794  BOOLEAN lead;\
     1795  int la, lb, lr;
     1796
     1797  if ((c == NULL) || pLmIsConstantComp(c))
     1798  {
     1799    return ppMult_qq(a, b);
     1800  }
     1801
     1802  pqLength(a, b, la, lb, SM_MIN_LENGTH_BUCKET);
     1803
     1804  // we iter over b, so, make sure b is the shortest
     1805  // such that we minimize our iterations
     1806  if (lb > la)
    17811807  {
    17821808    r = a;
    17831809    a = b;
    17841810    b = r;
    1785   }
    1786   if ((c == NULL) || pLmIsConstantComp(c))
    1787   {
    1788     if (pNext(b) == NULL)
    1789     {
    1790       if (pLmIsConstantComp(b))
    1791         return ppMult_nn(a, pGetCoeff(b));
    1792       else
    1793         return ppMult_mm(a, b);
    1794     }
    1795     pa = res = ppMult_mm(a, b);
    1796     pIter(b);
    1797     do
    1798     {
    1799       r = ppMult_mm(a, b);
    1800       smCombineChain(&pa, r);
    1801       pIter(b);
    1802     } while (b != NULL);
    1803     return res;
     1811    lr = la;
     1812    la = lb;
     1813    lb = lr;
    18041814  }
    18051815  res = NULL;
     
    18121822    {
    18131823      lead = pLmDivisibleByNoComp(e, a);
    1814       r = smSelectCopy(a, e);
    1815       smExpMultDiv(r, b, c);
     1824      r = smSelectCopy_ExpMultDiv(a, e, b, c);
    18161825    }
    18171826    else
     
    18421851    }
    18431852  }
    1844   do
     1853 
     1854  if (!TEST_OPT_NOT_BUCKETS && lb >= SM_MIN_LENGTH_BUCKET)
     1855  {
     1856    // use buckets if minimum length is smaller than threshold
     1857    spolyrec rp;
     1858    poly append;
     1859    // find the last monomial before pa
     1860    if (res == pa)
     1861    {
     1862      append = &rp;
     1863      pNext(append) = res;
     1864    }
     1865    else
     1866    {
     1867      append = res;
     1868      while (pNext(append) != pa)
     1869      {
     1870        assume(pNext(append) != NULL);
     1871        pIter(append);
     1872      }
     1873    }
     1874    kBucket_pt bucket = kBucketCreate(currRing);
     1875    kBucketInit(bucket, pNext(append), 0);
     1876    do
     1877    {
     1878      pSetCoeff0(e,pGetCoeff(b));
     1879      if (smIsNegQuot(e, b, c))
     1880      {
     1881        lr = la;
     1882        r = pp_Mult_Coeff_mm_DivSelect_MultDiv(a, lr, e, b, c);
     1883        if (pLmDivisibleByNoComp(e, a))
     1884          append = kBucket_ExtractLarger_Add_q(bucket, append, r, &lr);
     1885        else
     1886          kBucket_Add_q(bucket, r, &lr);
     1887      }
     1888      else
     1889      {
     1890        r = ppMult_mm(a, e);
     1891        append = kBucket_ExtractLarger_Add_q(bucket, append, r, &la);
     1892      }
     1893      pIter(b);
     1894    } while (b != NULL);
     1895    pNext(append) = kBucketClear(bucket);
     1896    kBucketDestroy(&bucket);
     1897  }
     1898  else
     1899  {
     1900    // use old sm stuff
     1901    do
     1902    {
     1903      pSetCoeff0(e,pGetCoeff(b));
     1904      if (smIsNegQuot(e, b, c))
     1905      {
     1906        r = smSelectCopy_ExpMultDiv(a, e, b, c);
     1907        if (pLmDivisibleByNoComp(e, a))
     1908          smCombineChain(&pa, r);
     1909        else
     1910          pa = pAdd(pa,r);
     1911      }
     1912      else
     1913      {
     1914        r = ppMult_mm(a, e);
     1915        smCombineChain(&pa, r);
     1916      }
     1917      pIter(b);
     1918    } while (b != NULL);
     1919  }
     1920  pLmFree(e);
     1921  return res;
     1922}
     1923
     1924#else
     1925
     1926/*
     1927*  returns the part of (a*b)/exp(lead(c)) with nonegative exponents
     1928*/
     1929poly smMultDiv(poly a, poly b, const poly c)
     1930{
     1931  poly pa, e, res, r;
     1932  BOOLEAN lead;
     1933
     1934  if ((c == NULL) || pLmIsConstantComp(c))
     1935  {
     1936    return ppMult_qq(a, b);
     1937  }
     1938  if (smSmaller(a, b))
     1939  {
     1940    r = a;
     1941    a = b;
     1942    b = r;
     1943  }
     1944  res = NULL;
     1945  e = pInit();
     1946  lead = FALSE;
     1947  while (!lead)
    18451948  {
    18461949    pSetCoeff0(e,pGetCoeff(b));
    18471950    if (smIsNegQuot(e, b, c))
    18481951    {
    1849       r = smSelectCopy(a, e);
    1850       smExpMultDiv(r, b, c);
     1952      lead = pLmDivisibleByNoComp(e, a);
     1953      r = smSelectCopy_ExpMultDiv(a, e, b, c);
     1954    }
     1955    else
     1956    {
     1957      lead = TRUE;
     1958      r = ppMult_mm(a, e);
     1959    }
     1960    if (lead)
     1961    {
     1962      if (res != NULL)
     1963      {
     1964        smFindRef(&pa, &res, r);
     1965        if (pa == NULL)
     1966          lead = FALSE;
     1967      }
     1968      else
     1969      {
     1970        pa = res = r;
     1971      }
     1972    }
     1973    else
     1974      res = pAdd(res, r);
     1975    pIter(b);
     1976    if (b == NULL)
     1977    {
     1978      pLmFree(e);
     1979      return res;
     1980    }
     1981  }
     1982  do
     1983  {
     1984    pSetCoeff0(e,pGetCoeff(b));
     1985    if (smIsNegQuot(e, b, c))
     1986    {
     1987      r = smSelectCopy_ExpMultDiv(a, e, b, c);
    18511988      if (pLmDivisibleByNoComp(e, a))
    18521989        smCombineChain(&pa, r);
     
    18642001  return res;
    18652002}
    1866 
     2003#endif
    18672004/*n
    18682005* exact division a/b
     
    18802017}
    18812018
     2019
    18822020/* ------------ internals arithmetic ------------- */
    18832021static void smExactPolyDiv(poly a, poly b)
     
    18872025  poly h;
    18882026  number y, yn;
    1889 
    1890   do
    1891   {
    1892     y = nDiv(pGetCoeff(a), x);
    1893     nNormalize(y);
    1894     pSetCoeff(a,y);
    1895     yn = nNeg(nCopy(y));
    1896     pSetCoeff0(e,yn);
    1897     if (smIsNegQuot(e, a, b))
    1898     {
    1899       h = smSelectCopy(tail, e);
    1900       smExpMultDiv(h, a, b);
    1901     }
    1902     else
    1903       h = ppMult_mm(tail, e);
    1904     nDelete(&yn);
    1905     a = pNext(a) = pAdd(pNext(a), h);
    1906   } while (a!=NULL);
     2027  int lt = pLength(tail);
     2028
     2029  if (lt + 1 >= SM_MIN_LENGTH_BUCKET &&  !TEST_OPT_NOT_BUCKETS)
     2030  {
     2031    kBucket_pt bucket = kBucketCreate(currRing);
     2032    kBucketInit(bucket, pNext(a), 0);
     2033    int lh = 0;
     2034    do
     2035    {
     2036      y = nDiv(pGetCoeff(a), x);
     2037      nNormalize(y);
     2038      pSetCoeff(a,y);
     2039      yn = nNeg(nCopy(y));
     2040      pSetCoeff0(e,yn);
     2041      lh = lt;
     2042      if (smIsNegQuot(e, a, b))
     2043      {
     2044        h = pp_Mult_Coeff_mm_DivSelect_MultDiv(tail, lh, e, a, b);
     2045      }
     2046      else
     2047        h = ppMult_mm(tail, e);
     2048      nDelete(&yn);
     2049      kBucket_Add_q(bucket, h, &lh);
     2050   
     2051      a = pNext(a) = kBucketExtractLm(bucket);
     2052    } while (a!=NULL);
     2053    kBucketDestroy(&bucket);
     2054  }
     2055  else
     2056  {
     2057    do
     2058    {
     2059      y = nDiv(pGetCoeff(a), x);
     2060      nNormalize(y);
     2061      pSetCoeff(a,y);
     2062      yn = nNeg(nCopy(y));
     2063      pSetCoeff0(e,yn);
     2064      if (smIsNegQuot(e, a, b))
     2065        h = smSelectCopy_ExpMultDiv(tail, e, a, b);
     2066      else
     2067        h = ppMult_mm(tail, e);
     2068      nDelete(&yn);
     2069      a = pNext(a) = pAdd(pNext(a), h);
     2070    } while (a!=NULL);
     2071  }
    19072072  pLmFree(e);
    19082073}
     
    19402105  pLmTest(b);
    19412106  pLmTest(c);
     2107  poly bc = p_New(currRing);
     2108 
     2109  p_ExpVectorDiff(bc, b, c, currRing);
     2110 
    19422111  while(t!=NULL)
    19432112  {
    1944     pExpVectorAddSub(t, b, c);
     2113    pExpVectorAdd(t, bc);
    19452114    pIter(t);
    19462115  }
    1947 }
     2116  p_LmFree(bc, currRing);
     2117}
     2118
    19482119
    19492120static void smPolyDivN(poly a, const number x)
     
    20162187  *px = pa;
    20172188}
     2189
    20182190
    20192191static void smFindRef(poly *ref, poly *px, poly r)
  • Singular/structs.h

    r33ec11 r2f436b  
    44*  Computer Algebra System SINGULAR     *
    55****************************************/
    6 /* $Id: structs.h,v 1.51 2000-12-20 11:15:49 obachman Exp $ */
     6/* $Id: structs.h,v 1.52 2000-12-31 15:14:45 obachman Exp $ */
    77/*
    88* ABSTRACT
     
    7979class namerec;
    8080class kBucket;
     81class sBucket;
    8182#endif
    8283
     
    145146typedef namerec *          namehdl;
    146147typedef kBucket*           kBucket_pt;
     148typedef sBucket*           sBucket_pt;
    147149typedef struct p_Procs_s p_Procs_s;
    148150
  • Singular/syz0.cc

    r33ec11 r2f436b  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: syz0.cc,v 1.35 2000-12-06 11:03:31 Singular Exp $ */
     4/* $Id: syz0.cc,v 1.36 2000-12-31 15:14:46 obachman Exp $ */
    55/*
    66* ABSTRACT: resolutions
     
    995995      {
    996996        if (res[1]->m[i])
    997           res[1]->m[i] = pOrdPolyMerge(res[1]->m[i]);
     997          res[1]->m[i] = pSort(res[1]->m[i]);
    998998      }
    999999    }
Note: See TracChangeset for help on using the changeset viewer.