001/*
002 * $Id$
003 */
004
005package edu.jas.gbmod;
006
007
008import java.util.List;
009
010import org.apache.logging.log4j.Logger;
011import org.apache.logging.log4j.LogManager; 
012
013import edu.jas.poly.GenPolynomial;
014import edu.jas.poly.ModuleList;
015import edu.jas.poly.PolynomialList;
016import edu.jas.structure.GcdRingElem;
017
018
019/**
020 * Module Groebner Bases abstract class. Implements Groebner bases and GB test.
021 * @author Heinz Kredel
022 * @deprecated use respective methods from GroebnerBaseAbstract
023 */
024@Deprecated
025public abstract class ModGroebnerBaseAbstract<C extends GcdRingElem<C>> implements ModGroebnerBase<C> {
026
027
028    private static final Logger logger = LogManager.getLogger(ModGroebnerBaseAbstract.class);
029
030
031    /**
032     * isGB.
033     * @param M a module basis.
034     * @return true, if M is a Groebner base, else false.
035     */
036    public boolean isGB(ModuleList<C> M) {
037        if (M == null || M.list == null) {
038            return true;
039        }
040        if (M.rows == 0 || M.cols == 0) {
041            return true;
042        }
043        PolynomialList<C> F = M.getPolynomialList();
044        int modv = M.cols; // > 0  
045        return isGB(modv, F.list);
046    }
047
048
049    /**
050     * GB.
051     * @param M a module basis.
052     * @return GB(M), a Groebner base of M.
053     */
054    public ModuleList<C> GB(ModuleList<C> M) {
055        ModuleList<C> N = M;
056        if (M == null || M.list == null) {
057            return N;
058        }
059        if (M.rows == 0 || M.cols == 0) {
060            return N;
061        }
062
063        PolynomialList<C> F = M.getPolynomialList();
064        int modv = M.cols;
065        List<GenPolynomial<C>> G = GB(modv, F.list);
066        F = new PolynomialList<C>(F.ring, G);
067        N = F.getModuleList(modv);
068        return N;
069    }
070
071
072    /**
073     * Cleanup and terminate ThreadPool.
074     */
075    public void terminate() {
076        logger.info("terminate not implemented");
077    }
078
079
080    /**
081     * Cancel ThreadPool.
082     */
083    public int cancel() {
084        logger.info("cancel not implemented");
085        return 0;
086    }
087
088}