Changeset 96f9fdf in git


Ignore:
Timestamp:
Sep 5, 2011, 1:52:09 PM (12 years ago)
Author:
Martin Lee <martinlee84@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'cdfcdb8287f66bc6070028082cbbc6eff10e609b')
Children:
3426de24a82fe29ddf501d02bcb6bd50a782f43f
Parents:
38ffb7aa68530ae0bcc0c2bb95142f15951ff00c
Message:
minor fixes and optimizations to Kronecker substitution multiplication


git-svn-id: file:///usr/local/Singular/svn/trunk@14379 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • factory/facHensel.cc

    r38ffb7 r96f9fdf  
    573573{
    574574  int degAy= degree (A);
    575   subA1.rep.SetLength ((long) d*(degAy + 1));
    576   subA2.rep.SetLength ((long) d*(degAy + 1));
     575  subA1.rep.SetLength ((long) d*(degAy + 2));
     576  subA2.rep.SetLength ((long) d*(degAy + 2));
    577577
    578578  Variable v;
     
    602602    for (int j= 0; j < bufRepLength; j++)
    603603    {
    604       subA1p [j + k]= bufp [j];
    605       subA2p [j + kk]= bufp [j];
     604      subA1p [j + k] += bufp [j];
     605      subA2p [j + kk] += bufp [j];
    606606    }
    607607  }
     
    614614{
    615615  int degAy= degree (A);
    616   subA1.rep.SetLength ((long) d*(degAy + 1));
    617   subA2.rep.SetLength ((long) d*(degAy + 1));
    618 
    619   Variable v;
     616  subA1.rep.SetLength ((long) d*(degAy + 2));
     617  subA2.rep.SetLength ((long) d*(degAy + 2));
     618
    620619  zz_p *subA1p;
    621620  zz_p *subA2p;
     
    635634    for (int j= 0; j < bufRepLength; j++)
    636635    {
    637       subA1p [j + k]= bufp [j];
    638       subA2p [j + kk]= bufp [j];
     636      subA1p [j + k] += bufp [j];
     637      subA2p [j + kk] += bufp [j];
    639638    }
    640639  }
     
    739738      if (repLengthBuf2 > degfSubLf + 1)
    740739        degfSubLf= repLengthBuf2 - 1;
    741       int tmp= tmin (repLengthBuf1, deggSubLg);
     740      int tmp= tmin (repLengthBuf1, deggSubLg + 1);
    742741      for (int ind= 0; ind < tmp; ind++)
    743742        gp [ind + lg] -= buf1p [ind];
     
    853852      if (repLengthBuf2 > degfSubLf + 1)
    854853        degfSubLf= repLengthBuf2 - 1;
    855       int tmp= tmin (repLengthBuf1, deggSubLg);
     854      int tmp= tmin (repLengthBuf1, deggSubLg + 1);
    856855      for (int ind= 0; ind < tmp; ind++)
    857856        gp [ind + lg] -= buf1p [ind];
     
    952951                  CanonicalForm& M)
    953952{
    954   int d1= tmax (degree (F, 1), degree (G, 1)) + 1;
    955   int d2= tmax (degree (F, 2), degree (G, 2));
     953  int d1= degree (F, 1) + degree (G, 1) + 1;
     954  d1 /= 2;
     955  d1 += 1;
    956956
    957957  zz_pX F1, F2;
     
    963963  MulTrunc (F1, F1, G1, (long) k);
    964964
    965   mul (F2, F2, G2);
    966   if (deg (F2) > k - 2)
    967     F2 >>= (deg (F2) - k + 2);
    968 
     965  int degtailF= degree (tailcoeff (F), 1);
     966  int degtailG= degree (tailcoeff (G), 1);
     967  int taildegF= taildegree (F);
     968  int taildegG= taildegree (G);
     969  int b= k + degtailF + degtailG - d1*(2+taildegF+taildegG);
     970
     971  reverse (F2, F2);
     972  reverse (G2, G2);
     973  MulTrunc (F2, F2, G2, b + 1);
     974  reverse (F2, F2, b);
     975
     976  int d2= tmax (deg (F2)/d1, deg (F1)/d1);
    969977  return reverseSubst (F1, F2, d1, d2);
    970978}
     
    983991  int degBy= degree (B, 2);
    984992  int d1= degAx + 1 + degBx;
    985   int d2= tmax (degree (A, 2), degree (B, 2));
     993  int d2= tmax (degAy, degBy);
    986994
    987995  if (d1 > 128 && d2 > 160 && (degAy == degBy) && (2*degAy > degree (M)))
     
    10041012                  CanonicalForm& M, const Variable& alpha)
    10051013{
    1006   int d1= tmax (degree (F, 1), degree (G, 1)) + 1;
    1007   int d2= tmax (degree (F, 2), degree (G, 2));
     1014  int d1= degree (F, 1) + degree (G, 1) + 1;
     1015  d1 /= 2;
     1016  d1 += 1;
    10081017
    10091018  zz_pEX F1, F2;
     
    10151024  MulTrunc (F1, F1, G1, (long) k);
    10161025
    1017   mul (F2, F2, G2);
    1018   if (deg (F2) > k - 2)
    1019     F2 >>= (deg (F2) - k + 2);
    1020 
    1021   CanonicalForm result= reverseSubst (F1, F2, d1, d2, alpha);
    1022 
    1023   return result;
     1026  int degtailF= degree (tailcoeff (F), 1);
     1027  int degtailG= degree (tailcoeff (G), 1);
     1028  int taildegF= taildegree (F);
     1029  int taildegG= taildegree (G);
     1030  int b= k + degtailF + degtailG - d1*(2+taildegF+taildegG);
     1031
     1032  reverse (F2, F2);
     1033  reverse (G2, G2);
     1034  MulTrunc (F2, F2, G2, b + 1);
     1035  reverse (F2, F2, b);
     1036
     1037  int d2= tmax (deg (F2)/d1, deg (F1)/d1);
     1038  return reverseSubst (F1, F2, d1, d2, alpha);
    10241039}
    10251040
     
    10391054    int degBy= degree (B, 2);
    10401055    int d1= degAx + degBx + 1;
    1041     int d2= tmax (degree (A, 2), degree (B, 2));
     1056    int d2= tmax (degAy, degBy);
    10421057    zz_p::init (getCharacteristic());
    10431058    zz_pX NTLMipo= convertFacCF2NTLzzpX (getMipo (alpha));
Note: See TracChangeset for help on using the changeset viewer.