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

◆ TEST() [7/10]

TEST ( ResMonoidDense ,
mult  )

Definition at line 127 of file ResTest.cpp.

128{
129 ResMonoidDense M(4,
130 std::vector<int>{1, 1, 1, 1},
131 std::vector<int>{},
133
134 int exp1[]{0, 0, 0, 0};
135 int exp2[]{0, 1, 0, 3};
136 int exp3[]{0, 0, 0, 0};
137 int mon1[]{0, 0, 0, 0, 0, 0};
138 int mon2[]{0, 0, 0, 0, 0, 0, 0, 0, 0};
139 int mon3[]{0, 0, 0, 0, 0, 0, 0, 0, 0};
140 int mon[]{0, 0, 0, 0, 0, 0, 0, 0, 0};
141 int comp;
142 M.from_expvector(exp1, 0, mon1);
143 M.from_expvector(exp2, 0, mon2);
144 M.mult(mon1, mon2, mon);
145 M.to_expvector(mon, exp3, comp);
146 EXPECT_EQ(6, M.monomial_size(mon1));
147 EXPECT_EQ(6, M.monomial_size(mon2));
148 EXPECT_EQ(6, M.monomial_size(mon));
149
150 for (int i = 0; i < M.n_vars(); i++)
151 for (int j = i; j < M.n_vars(); j++)
152 for (int k = 0; k < M.n_vars(); k++)
153 {
154 int exp1[]{0, 0, 0, 0};
155 exp1[i]++;
156 exp1[j]++;
157 int exp2[]{0, 0, 0, 0};
158 exp2[k]++;
159 M.from_expvector(exp1, 0, mon1);
160 M.from_expvector(exp2, 0, mon2);
161 M.mult(mon1, mon2, mon);
162 M.mult(mon1, mon2, mon3);
163 EXPECT_TRUE(M.is_equal(mon, mon3));
164 M.to_expvector(mon, exp3, comp);
165 int exp3a[]{0, 0, 0, 0};
166 exp3a[i]++;
167 exp3a[j]++;
168 exp3a[k]++;
169 for (int ell = 0; ell < M.n_vars(); ell++)
170 EXPECT_EQ(exp3[ell], exp3a[ell]);
171 EXPECT_EQ(M.monomial_size(mon), M.monomial_size(mon1));
172 EXPECT_EQ(M.monomial_size(mon), M.monomial_size(mon2));
173 }
174}
Dense-format ResMonoid implementation: monomials laid out as fixed-width exponent vectors.
const mpreal exp2(const mpreal &x, mp_rnd_t r=mpreal::get_default_rnd())
Definition mpreal.h:2299

References GRevLex.