Changeset 5402320 in git


Ignore:
Timestamp:
Jun 24, 2010, 1:56:07 PM (14 years ago)
Author:
Frank Seelisch <seelisch@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', '648d28f488f6ff08f5607ff229b9ad9e4a5b93c2')
Children:
7c4567365d4b984af1971a4e0e08294f46788f75
Parents:
be8dbbe24ea3d24955f3335b0be7c4c0bafd4d87
Message:
primefactors is now implemented in the kernel

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

Legend:

Unmodified
Added
Removed
  • Singular/iparith.cc

    rbe8dbb r5402320  
    5858#include "MinorInterface.h"
    5959#include "linearAlgebra.h"
     60#include "misc.h"
    6061#ifdef HAVE_FACTORY
    6162#include "clapsing.h"
     
    372373  { "preimage",    0, PREIMAGE_CMD ,      CMD_13},
    373374  { "prime",       0, PRIME_CMD ,         CMD_1},
     375  { "primefactors",0, PFAC_CMD ,          CMD_12},
    374376  { "print",       0, PRINT_CMD ,         CMD_12},
    375377  { "prune",       0, PRUNE_CMD ,         CMD_1},
     
    31813183}
    31823184#endif
     3185static BOOLEAN jjPFAC2(leftv res, leftv u, leftv v)
     3186{
     3187  number m = (number)u->Data();
     3188  int bound = (int)(long)v->Data();
     3189  number n;
     3190  if (u->Typ() == BIGINT_CMD) n = m;
     3191  else
     3192  {
     3193    /* then, we expect some other type of number inside m;
     3194       it needs to be converted to bigint; we do this via 'int' */
     3195    int i = n_Int(m, currRing);
     3196    n = nlInit(i, NULL);
     3197  }
     3198  lists l = primeFactorisation(n, bound);
     3199  res->data=(char*)l;
     3200  return FALSE;
     3201}
    31833202static BOOLEAN jjRSUM(leftv res, leftv u, leftv v)
    31843203{
     
    36523671,{jjRES,       MRES_CMD,       RESOLUTION_CMD, MODUL_CMD,  INT_CMD, ALLOW_PLURAL |ALLOW_RING}
    36533672//,{nuMPResMat,  MPRES_CMD,      MODUL_CMD,      IDEAL_CMD,  INT_CMD, NO_PLURAL |ALLOW_RING}
     3673,{jjPFAC2,     PFAC_CMD,       LIST_CMD,       BIGINT_CMD, INT_CMD, ALLOW_PLURAL |ALLOW_RING}
     3674,{jjPFAC2,     PFAC_CMD,       LIST_CMD,       NUMBER_CMD, INT_CMD, ALLOW_PLURAL |ALLOW_RING}
    36543675#ifdef HAVE_PLURAL
    36553676,{jjPlural_num_poly, NCALGEBRA_CMD,NONE,       POLY_CMD,   POLY_CMD  , NO_PLURAL |NO_RING}
     
    44414462#define jjLONG2N(D) nlInit((int)D, NULL)
    44424463#endif
     4464static BOOLEAN jjPFAC1(leftv res, leftv v)
     4465{
     4466  number m = (number)v->Data();
     4467  number n;
     4468  if (v->Typ() == BIGINT_CMD) n = m;
     4469  else
     4470  {
     4471    /* then, we expect some other type of number inside m;
     4472       it needs to be converted to bigint; we do this via 'int' */
     4473    int i = n_Int(m, currRing);
     4474    n = nlInit(i, NULL);
     4475  }
     4476  lists l = primeFactorisation(n, 0);
     4477  res->data=(char*)l;
     4478  return FALSE;
     4479}
    44434480static BOOLEAN jjLU_DECOMP(leftv res, leftv v)
    44444481{
     
    54315468,{jjKBASE,      KBASE_CMD,       MODUL_CMD,      MODUL_CMD     , ALLOW_PLURAL |ALLOW_RING}
    54325469,{jjLU_DECOMP,  LU_CMD,          LIST_CMD,       MATRIX_CMD    , NO_PLURAL |NO_RING}
     5470,{jjPFAC1,      PFAC_CMD,        LIST_CMD,       BIGINT_CMD    , ALLOW_PLURAL |ALLOW_RING}
     5471,{jjPFAC1,      PFAC_CMD,        LIST_CMD,       NUMBER_CMD    , ALLOW_PLURAL |ALLOW_RING}
    54335472,{atKILLATTR1,  KILLATTR_CMD,    NONE,           IDHDL         , ALLOW_PLURAL |ALLOW_RING}
    54345473#ifdef MDEBUG
Note: See TracChangeset for help on using the changeset viewer.