Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
| Download
GAP 4.8.9 installation with standard packages -- copy to your CoCalc project to get it
Project: cocalc-sagemath-dev-slelievre
Path: gap4r8 / pkg / NormalizInterface-1.0.2 / Normaliz.git / Qsource / libQnormaliz / Qcone_helper.cpp
Views: 418384/*1* Normaliz2* Copyright (C) 2007-2014 Winfried Bruns, Bogdan Ichim, Christof Soeger3* This program is free software: you can redistribute it and/or modify4* it under the terms of the GNU General Public License as published by5* the Free Software Foundation, either version 3 of the License, or6* (at your option) any later version.7*8* This program is distributed in the hope that it will be useful,9* but WITHOUT ANY WARRANTY; without even the implied warranty of10* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the11* GNU General Public License for more details.12*13* You should have received a copy of the GNU General Public License14* along with this program. If not, see <http://www.gnu.org/licenses/>.15*16* As an exception, when this program is distributed through (i) the App Store17* by Apple Inc.; (ii) the Mac App Store by Apple Inc.; or (iii) Google Play18* by Google Inc., then that store may impose any digital rights management,19* device limits and/or redistribution restrictions that are required by its20* terms of service.21*/2223#ifdef NMZ_MIC_OFFLOAD24#pragma offload_attribute (push, target(mic))25#endif2627#include "libQnormaliz/Qcone_helper.h"28#include <vector>2930namespace libQnormaliz {31using std::vector;3233//---------------------------------------------------------------------------3435// determines the maximal subsets in a vector of subsets given by their indicator vectors36// result returned in is_max_subset -- must be initialized outside37// only set to false in this routine38// if a set occurs more than once, only the last instance is recognized as maximal39void maximal_subsets(const vector<vector<bool> >& ind, vector<bool>& is_max_subset) {4041if(ind.size()==0)42return;4344size_t nr_sets=ind.size();45size_t card=ind[0].size();46vector<key_t> elem(card);4748for (size_t i = 0; i <nr_sets; i++) {49if(!is_max_subset[i]) // already known to be non-maximal50continue;5152size_t k=0; // counts the number of elements in set with index i53for (size_t j = 0; j <card; j++) {54if (ind[i][j]) {55elem[k]=j;56k++;57}58}5960for (size_t j = 0; j <nr_sets; j++) {61if (i==j || !is_max_subset[j] ) // don't compare with itself or something known not to be maximal62continue;63size_t t;64for (t = 0; t<k; t++) {65if (!ind[j][elem[t]])66break; // not a superset67}68if (t==k) { // found a superset69is_max_subset[i]=false;70break; // the loop over j71}72}73}74}7576//---------------------------------------------------------------------------7778#ifdef NMZ_MIC_OFFLOAD79#pragma offload_attribute (pop)80#endif8182} //end namespace libQnormaliz838485