Changeset 0d47ce in git
- Timestamp:
- Jul 3, 2019, 5:08:16 PM (5 years ago)
- Branches:
- (u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
- Children:
- 427a52f6ad87c09fcb69f2daedc7c3fc5f7aaad0
- Parents:
- d90ef21a873dee180216d6118489cf22ec4cdcc3
- Location:
- Singular/dyn_modules
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Singular/dyn_modules/gitfan/gitfan.cc
rd90ef2 r0d47ce 547 547 548 548 549 void subset(std::vector<int> &arr, int size, int left, int index, std::vector<int> &l, std::vector<std::vector<int> > &L)550 {551 if(left==0)552 {553 L.push_back(l);554 return;555 }556 557 for(int i=index; i<size;i++)558 {559 l.push_back(arr[i]);560 subset(arr,size,left-1,i+1,l,L);561 l.pop_back();562 }563 }564 565 549 extern "C" int SI_MOD_INIT(gitfan) (SModulFunctions* p) 566 550 { -
Singular/dyn_modules/subsets/subsets.cc
rd90ef2 r0d47ce 3 3 #include <vector> 4 4 5 voidsubset(std::vector<int> &arr, int size, int left, int index, std::vector<int> &l, std::vector<std::vector<int> > &L)5 static void s_subset(std::vector<int> &arr, int size, int left, int index, std::vector<int> &l, std::vector<std::vector<int> > &L) 6 6 { 7 7 if(left==0) … … 14 14 { 15 15 l.push_back(arr[i]); 16 s ubset(arr,size,left-1,i+1,l,L);16 s_subset(arr,size,left-1,i+1,l,L); 17 17 l.pop_back(); 18 18 } … … 24 24 // NOTE: the lists will be sorted lexicographically 25 25 // and the elements in each of the lists are sorted naturally 26 BOOLEAN subsets(leftv res, leftv args)26 static BOOLEAN subsets(leftv res, leftv args) 27 27 { 28 28 leftv u = args; … … 39 39 std::vector<int> ltemp; 40 40 std::vector<std::vector<int> > lt; 41 s ubset(array,n,k,0,ltemp,lt);41 s_subset(array,n,k,0,ltemp,lt); 42 42 43 43 lists Lt = (lists) omAllocBin(slists_bin);
Note: See TracChangeset
for help on using the changeset viewer.