Changeset 9fe6c3 in git


Ignore:
Timestamp:
Oct 24, 2018, 2:36:24 PM (5 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', '0d6b7fcd9813a1ca1ed4220cfa2b104b97a0a003')
Children:
99d02931f1b01b2ae7d88ca405c300918c8c6919
Parents:
e552b7ba49ec3df67c55e5cc36c00cc4783cbda0
Message:
add: subsets(kn,) in subsets.so (all subsets of 1..n with k elements)
Files:
1 added
1 deleted
5 edited
1 moved

Legend:

Unmodified
Added
Removed
  • Singular/LIB/gitfan.lib

    re552b7 r9fe6c3  
    8484  LIB "gfanlib.so";
    8585  LIB "gitfan.so";
     86  //LIB "subsets.so";
    8687  newstruct("permutation","intvec image");
    8788  system("install","permutation","*",composePermutations,2);
  • Singular/dyn_modules/Makefile.am

    re552b7 r9fe6c3  
    11ACLOCAL_AMFLAGS = -I ../m4
    22
    3 SUBDIRS=staticdemo bigintm syzextra pyobject customstd gfanlib python gitfan polymake singmathic Order interval cohomo
     3SUBDIRS=staticdemo bigintm subsets syzextra pyobject customstd gfanlib python gitfan polymake singmathic Order interval cohomo
  • Singular/dyn_modules/gitfan/gitfan.cc

    re552b7 r9fe6c3  
    563563}
    564564
    565 BOOLEAN subsets(leftv res, leftv args)
    566 {
    567   leftv u = args;
    568   if ((u!=NULL) && (u->Typ()==INT_CMD))
    569   {
    570     leftv v = u->next;
    571     if ((v!=NULL) && (v->Typ()==INT_CMD) && (v->next==NULL))
    572     {
    573       int n = (int)(long) u->Data();
    574       int k = (int)(long) v->Data();
    575       std::vector<int> array(n);
    576       for (int i=0; i<n; i++)
    577         array[i]=i+1;
    578       std::vector<int> ltemp;
    579       std::vector<std::vector<int> > lt;
    580       subset(array,n,k,0,ltemp,lt);
    581 
    582       lists Lt = (lists) omAllocBin(slists_bin);
    583       Lt->Init(lt.size());
    584       for (int i=0; i<lt.size(); i++)
    585       {
    586         std::vector<int> lti = lt[i];
    587         lists Lti = (lists) omAllocBin(slists_bin);
    588         Lti->Init(k);
    589         for(int j=0; j<lti.size(); j++)
    590         {
    591           Lti->m[j].rtyp = INT_CMD;
    592           Lti->m[j].data = (void*)(long)lti[j];
    593         }
    594         Lt->m[i].rtyp = LIST_CMD;
    595         Lt->m[i].data = (void*) Lti;
    596       }
    597 
    598       res->rtyp = LIST_CMD;
    599       res->data = (void*) Lt;
    600       return FALSE;
    601     }
    602   }
    603   WerrorS("subsets: unexpected parameter");
    604   return TRUE;
    605 }
    606 
    607 
    608565extern "C" int SI_MOD_INIT(gitfan) (SModulFunctions* p)
    609566{
     
    616573  p->iiAddCproc("gitfan.lib","composeIntvecs",FALSE,composeIntvecs);
    617574  p->iiAddCproc("gitfan.lib","findPlaceToInsert",FALSE,findPlaceToInsert);
    618   p->iiAddCproc("gitfan.lib","subsets",FALSE,subsets);
    619575  return (MAX_TOK);
    620576}
  • Singular/dyn_modules/subsets/subsets.cc

    re552b7 r9fe6c3  
    4343      lists Lt = (lists) omAllocBin(slists_bin);
    4444      Lt->Init(lt.size());
    45       for (int i=0; i<lt.size(); i++)
     45      for (unsigned i=0; i<lt.size(); i++)
    4646      {
    4747        std::vector<int> lti = lt[i];
    4848        lists Lti = (lists) omAllocBin(slists_bin);
    4949        Lti->Init(k);
    50         for(int j=0; j<lti.size(); j++)
     50        for(unsigned j=0; j<lti.size(); j++)
    5151        {
    5252          Lti->m[j].rtyp = INT_CMD;
     
    6868//------------------------------------------------------------------------
    6969// initialisation of the module
    70 extern "C" int SI_MOD_INIT(customstd)(SModulFunctions* p)
     70extern "C" int SI_MOD_INIT(subsets)(SModulFunctions* p)
    7171{
    7272  p->iiAddCproc("subsets.so","subsets",FALSE,subsets);
  • configure.ac

    re552b7 r9fe6c3  
    249249AC_CONFIG_FILES([Singular/dyn_modules/singmathic/Makefile])
    250250AC_CONFIG_FILES([Singular/dyn_modules/staticdemo/Makefile])
     251AC_CONFIG_FILES([Singular/dyn_modules/subsets/Makefile])
    251252AC_CONFIG_FILES([Singular/dyn_modules/gitfan/Makefile])
    252253AC_CONFIG_FILES([Singular/dyn_modules/interval/Makefile])
  • m4/options.m4

    re552b7 r9fe6c3  
    324324  L=""
    325325  bi_staticdemo=false
     326  bi_subsets=false
    326327  bi_syzextra=false
    327328  bi_pyobject=false
     
    358359      case "${a}" in
    359360       staticdemo ) bi_staticdemo=true;;
     361       subsets ) bi_subsets=true;;
    360362       syzextra ) bi_syzextra=true ;;
    361363       pyobject ) bi_pyobject=true ;;
     
    395397
    396398 AM_CONDITIONAL([SI_BUILTIN_STATICDEMO], [test x$bi_staticdemo = xtrue])
     399 AM_CONDITIONAL([SI_BUILTIN_SUBSETS], [test x$bi_subsets = xtrue])
    397400 AM_CONDITIONAL([SI_BUILTIN_SYZEXTRA], [test x$bi_syzextra = xtrue])
    398401 AM_CONDITIONAL([SI_BUILTIN_PYOBJECT], [test x$bi_pyobject = xtrue])
Note: See TracChangeset for help on using the changeset viewer.