Changeset 9c0b20a in git


Ignore:
Timestamp:
Nov 25, 2010, 4:11:10 PM (13 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', '00e2e9c41af3fde1273eb3633f4c0c7c3db2579d')
Children:
488872b51cd1fa36918b12c9c2476c1edff62026
Parents:
c512d93f75cc91a718679d4a03b14439936966e2
Message:
LLL via system("LLL",M) for matrix (char 0)/intmat


git-svn-id: file:///usr/local/Singular/svn/trunk@13670 2c84dea3-7e68-4137-9b89-c4e89433aadc
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • Singular/extra.cc

    rc512d9 r9c0b20a  
    34513451      }
    34523452      else
     3453      if (strcmp(sys_cmd, "LLL") == 0)
     3454      {
     3455        if (h!=NULL)
     3456        {
     3457          res->rtyp=h->Typ();
     3458          if (h->Typ()==MATRIX_CMD)
     3459          {
     3460            res->data=(char *)singntl_LLL((matrix)h->Data());
     3461            return FALSE;
     3462          }
     3463          else if (h->Typ()==INTMAT_CMD)
     3464          {
     3465            res->data=(char *)singntl_LLL((intvec*)h->Data());
     3466            return FALSE;
     3467          }
     3468          else return TRUE;
     3469        }
     3470        else return TRUE;
     3471      }
     3472      else
    34533473  /*================= factoras =========================*/
    34543474      if (strcmp (sys_cmd, "factoras") == 0)
  • factory/cf_hnf.cc

    rc512d9 r9c0b20a  
    1919#include <NTL/mat_ZZ.h>
    2020#include <NTL/HNF.h>
     21#include <NTL/LLL.h>
    2122
    2223// The input matrix A is an n x m matrix of rank m (so n >= m), and D
     
    4041  return convertNTLmat_ZZ2FacCFMatrix(WW);
    4142}
     43CFMatrix* cf_LLL(CFMatrix& A)
     44{
     45  mat_ZZ *AA=convertFacCFMatrix2NTLmat_ZZ(A);
     46  LLL_RR(*AA);
     47  delete AA;
     48  CFMatrix *r= convertNTLmat_ZZ2FacCFMatrix(*AA);
     49  delete AA;
     50  return r;
     51}
    4252#endif
  • factory/cf_hnf.h

    rc512d9 r9c0b20a  
    2424CFMatrix* cf_HNF(CFMatrix& A);
    2525
     26// performs LLL reduction.
     27
     28// B is an m x n matrix, viewed as m rows of n-vectors.  m may be less
     29// than, equal to, or greater than n, and the rows need not be
     30// linearly independent.  B is transformed into an LLL-reduced basis,
     31// and the return value is the rank r of B.  The first m-r rows of B
     32// are zero. 
     33
     34// More specifically, elementary row transformations are performed on
     35// B so that the non-zero rows of new-B form an LLL-reduced basis
     36// for the lattice spanned by the rows of old-B.
     37// The default reduction parameter is delta=3/4, which means
     38// that the squared length of the first non-zero basis vector
     39// is no more than 2^{r-1} times that of the shortest vector in
     40// the lattice.
     41
     42CFMatrix* cf_LLL(CFMatrix& A);
     43
    2644/*ENDPUBLIC*/
    2745
  • kernel/clapsing.cc

    rc512d9 r9c0b20a  
    15771577      }
    15781578    }
    1579     for(i=r;i>0;i--)
    1580     {
    1581       for(j=r;j>0;j--)
    1582       {
    1583         M(i,j)=convSingPFactoryP(MATELEM(m,i,j));
    1584       }
    1585     }
    15861579    CFMatrix *MM=cf_HNF(M);
    15871580    for(i=r;i>0;i--)
     
    16191612  {
    16201613    for(j=r;j>0;j--)
     1614    {
     1615      IMATELEM(*mm,i,j)=convFactoryISingI((*MM)(i,j));
     1616    }
     1617  }
     1618  delete MM;
     1619  return mm;
     1620}
     1621matrix singntl_LLL(matrix  m )
     1622
     1623  int r=m->rows();
     1624  int c=m->cols();
     1625  matrix res=mpNew(r,c);
     1626  if (rField_is_Q(currRing))
     1627  {
     1628    CFMatrix M(r,c);
     1629    int i,j;
     1630    for(i=r;i>0;i--)
     1631    {
     1632      for(j=c;j>0;j--)
     1633      {
     1634        M(i,j)=convSingPFactoryP(MATELEM(m,i,j));
     1635      }
     1636    }
     1637    CFMatrix *MM=cf_LLL(M);
     1638    for(i=r;i>0;i--)
     1639    {
     1640      for(j=c;j>0;j--)
     1641      { 
     1642        MATELEM(res,i,j)=convFactoryPSingP((*MM)(i,j));
     1643      }
     1644    }
     1645    delete MM;
     1646  }
     1647  return res;
     1648}
     1649intvec* singntl_LLL(intvec*  m )
     1650{
     1651  int r=m->rows();
     1652  int c=m->cols();
     1653  setCharacteristic( 0 );
     1654  CFMatrix M(r,c);
     1655  int i,j;
     1656  for(i=r;i>0;i--)
     1657  {
     1658    for(j=r;j>0;j--)
     1659    {
     1660      M(i,j)=IMATELEM(*m,i,j);
     1661    }
     1662  }
     1663  CFMatrix *MM=cf_LLL(M);
     1664  intvec *mm=ivCopy(m);
     1665  for(i=r;i>0;i--)
     1666  {
     1667    for(j=c;j>0;j--)
    16211668    {
    16221669      IMATELEM(*mm,i,j)=convFactoryISingI((*MM)(i,j));
  • kernel/clapsing.h

    rc512d9 r9c0b20a  
    4242matrix singntl_HNF(matrix A);
    4343intvec* singntl_HNF(intvec* A);
     44matrix singntl_LLL(matrix A);
     45intvec* singntl_LLL(intvec* A);
    4446
    4547BOOLEAN singclap_isSqrFree(poly f);
Note: See TracChangeset for help on using the changeset viewer.