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