Changeset cdcbf3 in git


Ignore:
Timestamp:
Mar 10, 2017, 10:50:05 AM (7 years ago)
Author:
Andreas Steenpass <steenpass@…>
Branches:
(u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
Children:
c85a29d68f3b14b5466567b25ce4f175fd4d3512
Parents:
f4cb688bd460cad06792559a83e52103e9699d83
git-author:
Andreas Steenpass <steenpass@mathematik.uni-kl.de>2017-03-10 10:50:05+01:00
git-committer:
Andreas Steenpass <steenpass@mathematik.uni-kl.de>2018-02-02 11:16:48+01:00
Message:
chg: delete unused variables
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/GBEngine/syz4.cc

    rf4cb688 rcdcbf3  
    529529        std::vector<bool> &variables)
    530530{
    531     update_variables(variables, res[index-1]);
    532     if (index == 2) {   // we don't know if the input is a reduced SB
    533         variables[currRing->N] = false;
    534     }
    535531#if CACHE
    536532    initialize_cache(res[index-1]->ncols);
     
    552548}
    553549
     550static inline bool contains_unused_variable(const poly m,
     551    const std::vector<bool> &variables)
     552{
     553    const ring R = currRing;
     554    for (int j = R->N; j > 0; j--) {
     555        if (!variables[j-1] && p_GetExp(m, j, R) > 0) {
     556            return true;
     557        }
     558    }
     559    return false;
     560}
     561
     562static void delete_variables(resolvente &res, const int index,
     563    std::vector<bool> variables)
     564{
     565    for (int i = 0; i < res[index]->ncols; i++) {
     566        poly p_iter = res[index]->m[i]->next;
     567        if (p_iter != NULL) {
     568            while (p_iter->next != NULL) {
     569                if (contains_unused_variable(p_iter->next, variables)) {
     570                    pLmDelete(&p_iter->next);
     571                } else {
     572                    pIter(p_iter);
     573                }
     574            }
     575        }
     576    }
     577}
     578
    554579static void delete_tails(resolvente res, const int index)
    555580{
     
    576601        std::vector<bool> variables;
    577602        variables.resize(currRing->N+1, true);
     603        if (do_lifting) {
     604            update_variables(variables, res[0]);
     605            delete_variables(res, 0, variables);
     606        }
    578607        while (!idIs0(res[index])) {
    579608            if (do_lifting) {
     
    582611                    delete_tails(res, index-1);
    583612                }
     613                update_variables(variables, res[index]);
     614                // we don't know if the input is a reduced SB:
     615                if (index == 2) {
     616                    variables[currRing->N] = false;
     617                }
     618                delete_variables(res, index, variables);
    584619            }
    585620            if (index >= max_index) { break; }
Note: See TracChangeset for help on using the changeset viewer.