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

◆ TEST() [6/10]

TEST ( ResMonoidDense ,
encodeDecode  )

Definition at line 61 of file ResTest.cpp.

62{
64 std::vector<int>{1, 1, 1, 1},
65 std::vector<int>{},
67
68 // Loop through a number of exponent vectors, encode, then decode.
69
70 for (int i = 0; i < M.n_vars(); i++)
71 for (int j = i; j < M.n_vars(); j++)
72 {
73 int exp[]{0, 0, 0, 0};
74 exp[i]++;
75 exp[j]++;
76 int mon[]{0, 0, 0, 0, 0, 0, 0, 0};
77 // first encode
78 M.from_expvector(exp, 3, mon);
79 // now decode
80 component_index comp;
81 int exp2[]{0, 0, 0, 0};
82 M.to_expvector(mon, exp2, comp);
83 EXPECT_EQ(3, comp);
84 for (int k = 0; k < M.n_vars(); k++) EXPECT_EQ(exp[k], exp2[k]);
85 std::cout << "i=" << i << " j=" << j << " mon = ";
86 M.dump(std::cout, mon);
87 std::cout << std::endl;
88 }
89}
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
const mpreal exp(const mpreal &x, mp_rnd_t r=mpreal::get_default_rnd())
Definition mpreal.h:2298
myword component_index

References GRevLex.