Macaulay2 Engine
Loading...
Searching...
No Matches

◆ testRingNegateRRi()

void testRingNegateRRi ( const M2::ARingRRi & R,
const M2::ARingRRR & S,
int ntrials )

Definition at line 90 of file ARingRRiTest.cpp.

91{
94 R.init(a);
95 R.init(b);
96 R.init(c);
97
99 S.init(d);
100 for (int i = 0; i < ntrials; i++)
101 {
102 // test: (-a) + (a) == 0
103 gen.nextElement(a);
104 R.negate(b,a);
105 R.add(c,a,b);
106 R.midpoint(d,c);
107 EXPECT_TRUE(S.is_zero(d));
108 }
109 S.clear(d);
110 R.clear(c);
111 R.clear(b);
112 R.clear(a);
113}
const int ntrials
Definition ARingTest.hpp:42
bool is_zero(const ElementType &f) const
Definition aring-RRR.hpp:96
static void clear(ElementType &result)
void init(ElementType &result) const
static void clear(ElementType &result)
void midpoint(ARingRRR::ElementType &a, const ElementType &b) const
void init(ElementType &result) const
void negate(ElementType &result, const ElementType &a) const
void add(ElementType &result, const ElementType &a, const ElementType &b) const

References M2::ARingRRi::add(), M2::ARingRRi::clear(), M2::ARingRRR::clear(), M2::ARingRRi::init(), M2::ARingRRR::init(), M2::ARingRRR::is_zero(), M2::ARingRRi::midpoint(), M2::ARingRRi::negate(), ARingElementGenerator< RingType >::nextElement(), and ntrials.

Referenced by TEST().