LibHilbertPoincareTest.cpp
Go to the documentation of this file.
/* Frobby: Software for monomial ideal computations.
Copyright (C) 2007 Bjarke Hammersholt Roune (www.broune.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/.
*/
#include "stdinc.h"
#include "frobby.h"
#include "tests.h"
#include "BigIdeal.h"
#include "BigPolynomial.h"
#include "IdealFactory.h"
#include "PolynomialFactory.h"
#include "LibTest.h"
TEST_SUITE2(LibraryInterface, HilbertPoincare)
TEST(HilbertPoincare, TypicalMultigraded) {
Frobby::Ideal ideal = toLibIdeal(IdealFactory::xx_yy_xz_yz());
LibPolynomialConsumer consumer(IdealFactory::ring_xyzt());
Frobby::multigradedHilbertPoincareSeries(ideal, consumer);
ASSERT_EQ(consumer.getPolynomial(), PolynomialFactory::hilbert_xx_yy_xz_yz());
}
TEST(HilbertPoincare, TypicalUnivariate) {
Frobby::Ideal ideal = toLibIdeal(IdealFactory::xx_yy_xz_yz());
BigPolynomial output = PolynomialFactory::one_minus4tt_3ttt_tttt_minusttttt();
LibPolynomialConsumer consumer(output.getNames());
Frobby::univariateHilbertPoincareSeries(ideal, consumer);
ASSERT_EQ(consumer.getPolynomial(), output);
}
TEST(HilbertPoincare, ZeroIdealMultigraded) {
for (size_t varCount = 0; varCount <= 3; ++varCount) {
Frobby::Ideal ideal(varCount);
LibPolynomialConsumer consumer((VarNames(varCount)));
Frobby::multigradedHilbertPoincareSeries(ideal, consumer);
ASSERT_EQ(consumer.getPolynomial(), PolynomialFactory::one(varCount));
}
}
TEST(HilbertPoincare, ZeroIdealUnivariate) {
for (size_t varCount = 0; varCount <= 3; ++varCount) {
Frobby::Ideal ideal(varCount);
LibPolynomialConsumer consumer((VarNames(1)));
Frobby::univariateHilbertPoincareSeries(ideal, consumer);
ASSERT_EQ(consumer.getPolynomial(), PolynomialFactory::one(1));
}
}
TEST(HilbertPoincare, WholeRingMultigraded) {
for (size_t varCount = 0; varCount <= 3; ++varCount) {
Frobby::Ideal ideal = toLibIdeal(IdealFactory::wholeRing(varCount));
LibPolynomialConsumer consumer((VarNames(varCount)));
Frobby::multigradedHilbertPoincareSeries(ideal, consumer);
ASSERT_EQ(consumer.getPolynomial(), PolynomialFactory::zero(varCount));
}
}
TEST(HilbertPoincare, WholeRingUnivariate) {
for (size_t varCount = 0; varCount <= 3; ++varCount) {
Frobby::Ideal ideal = toLibIdeal(IdealFactory::wholeRing(varCount));
LibPolynomialConsumer consumer((VarNames(1)));
Frobby::univariateHilbertPoincareSeries(ideal, consumer);
ASSERT_EQ(consumer.getPolynomial(), PolynomialFactory::zero(1));
}
}
BigIdeal.h
BigPolynomial.h
IdealFactory.h
toLibIdeal
Frobby::Ideal toLibIdeal(const BigIdeal &ideal)
Returns a library interface ideal that corresponds to the parameter ideal.
Definition LibTest.cpp:26
LibTest.h
PolynomialFactory.h
ASSERT_EQ
#define ASSERT_EQ(A, B)
Definition asserts.h:152
BigPolynomial
Definition BigPolynomial.h:27
BigPolynomial::getNames
const VarNames & getNames() const
Definition BigPolynomial.cpp:42
Frobby::Ideal
Definition frobby.h:35
IdealFactory::xx_yy_xz_yz
static BigIdeal xx_yy_xz_yz()
Returns .
Definition IdealFactory.cpp:31
IdealFactory::ring_xyzt
static VarNames ring_xyzt()
Returns the ring in the four variables , , and .
Definition IdealFactory.cpp:22
IdealFactory::wholeRing
static BigIdeal wholeRing(size_t varCount)
Returns in the ring VarNames(varCount).
Definition IdealFactory.cpp:149
LibPolynomialConsumer
Records library interface output into a BigPolynomial.
Definition LibTest.h:74
LibPolynomialConsumer::getPolynomial
const BigPolynomial & getPolynomial() const
Returns the recorded polynomial in a canonical form.
Definition LibTest.cpp:113
PolynomialFactory::one
static BigPolynomial one(size_t varCount)
Returns the polynomial 1 in the ring VarNames(varCount).
Definition PolynomialFactory.cpp:51
PolynomialFactory::one_minus4tt_3ttt_tttt_minusttttt
static BigPolynomial one_minus4tt_3ttt_tttt_minusttttt()
Returns the polynomial 1 - 4t^2 + 3t^3 + t^4 - t^5.
Definition PolynomialFactory.cpp:38
PolynomialFactory::zero
static BigPolynomial zero(size_t varCount)
Return the zero polynomial in the ring VarNames(varCount).
Definition PolynomialFactory.cpp:63
PolynomialFactory::hilbert_xx_yy_xz_yz
static BigPolynomial hilbert_xx_yy_xz_yz()
Returns the multigraded Hilbert-Poincare series numerator of the ideal <x^2, y^2, xz,...
Definition PolynomialFactory.cpp:22
VarNames
Defines the variables of a polynomial ring and facilities IO involving them.
Definition VarNames.h:40
frobby.h
TEST_SUITE2
#define TEST_SUITE2(PARENT, SUITE)
Definition macroes.h:28
TEST
#define TEST(SUITE, TEST_NAME)
Definition macroes.h:41
Frobby::univariateHilbertPoincareSeries
void univariateHilbertPoincareSeries(const Ideal &ideal, PolynomialConsumer &consumer)
Compute the univariate Hilbert-Poincare series of ideal.
Definition frobby.cpp:315
Frobby::multigradedHilbertPoincareSeries
void multigradedHilbertPoincareSeries(const Ideal &ideal, PolynomialConsumer &consumer)
Compute the multigraded Hilbert-Poincare series of ideal.
Definition frobby.cpp:303
stdinc.h
This header file includes common definitions and is included as the first line of code in every imple...
tests.h