17#include <gtest/gtest.h>
33Vec broadcast(
const fr& s)
38TEST(VecRelationSpike, UnivariateVecDefaultAndScalarCtor)
48TEST(VecRelationSpike, UnivariateVecArithmetic)
51 std::array<Vec, 6> av{ random_vec(), random_vec(), random_vec(), random_vec(), random_vec(), random_vec() };
52 std::array<Vec, 6> bv{ random_vec(), random_vec(), random_vec(), random_vec(), random_vec(), random_vec() };
66TEST(VecRelationSpike, UnivariateVecExtendTo)
70 auto extended = u2.template extend_to<6>();
77TEST(VecRelationSpike, UnivariateVecBroadcastParity)
84 for (
size_t k = 0; k < 6; ++k) {
93 for (
size_t k = 0; k < 6; ++k) {
94 a_vec_arr[k] = broadcast(a_arr[k]);
95 b_vec_arr[k] = broadcast(b_arr[k]);
97 UVec a_vec{ a_vec_arr };
98 UVec b_vec{ b_vec_arr };
100 auto result_ff = a_ff * b_ff + a_ff - b_ff;
101 auto result_vec = a_vec * b_vec + a_vec - b_vec;
103 for (
size_t k = 0; k < 6; ++k) {
104 auto lanes = result_vec.evaluations[k].to_array();
105 for (
size_t L = 0; L < 5; ++L) {
106 EXPECT_EQ(lanes[L], result_ff.evaluations[k]) <<
"k=" << k <<
" lane=" << L;
112TEST(VecRelationSpike, ArithmeticRelationImplInstantiates)
116 static_assert(Rel::SUBRELATION_PARTIAL_LENGTHS[0] == 6);
117 static_assert(Rel::SUBRELATION_PARTIAL_LENGTHS[1] == 5);
125TEST(VecRelationSpike, RelationsInstantiateWithVecElement)
144TEST(VecRelationSpike, UnivariateVecIsZeroMeansAllLanesAllCoeffs)
149 EXPECT_TRUE((UVec{ zeros }).is_zero());
156 EXPECT_FALSE((UVec{ arr }).is_zero());
163 EXPECT_FALSE((UVec{ arr }).is_zero());
TEST(acir_formal_proofs, uint_terms_add)
Tests 128-bit unsigned addition Verifies that the ACIR implementation of addition is correct Executio...
Expression for the Ultra (width-4) Arithmetic gate.
static void accumulate(ContainerOverSubrelations &evals, const AllEntities &in, BB_UNUSED const Parameters ¶ms, const FF &scaling_factor)
A wrapper for Relations to expose methods used by the Sumcheck prover or verifier to add the contribu...
static void accumulate(ContainerOverSubrelations &accumulators, const AllEntities &in, const Parameters ¶ms, const FF &scaling_factor)
Compute contribution of the permutation relation for a given edge (internal function)
A univariate polynomial represented by its values on {0, 1,..., domain_end - 1}.
Inner sum(Cont< Inner, Args... > const &in)
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Container for parameters used by the grand product (permutation, lookup) Honk relations.
static VectorField zero() noexcept
static VectorField broadcast(const Field &s) noexcept
static VectorField one() noexcept
static constexpr field one()
static field random_element(numeric::RNG *engine=nullptr) noexcept
static constexpr field zero()
bb::VectorField< bb::Bn254FrParams > Vec