Skip to content

Commit

Permalink
Changed result_type signature; renamed test.
Browse files Browse the repository at this point in the history
  • Loading branch information
Iluvmagick committed Jan 3, 2024
1 parent 83858af commit 6dd1b5e
Show file tree
Hide file tree
Showing 53 changed files with 89 additions and 92 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ namespace nil {
var(component.W(8), start_row_index + 1, false)};
}

std::vector<var> all_vars() const {
std::vector<std::reference_wrapper<var>> all_vars() {
return {output.x[0], output.x[1], output.x[2], output.x[3],
output.y[0], output.y[1], output.y[2], output.y[3]};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ namespace nil {
var(component.W(3), start_row_index + non_native_range_component_rows_amount, false)};
}

std::vector<var> all_vars() const {
std::vector<std::reference_wrapper<var>> all_vars() {
return {output.x[0], output.x[1], output.x[2], output.x[3],
output.y[0], output.y[1], output.y[2], output.y[3]};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ namespace nil {
var(component.W(3), start_row_index + non_native_rows_amount, false)};
}

std::vector<var> all_vars() const {
std::vector<std::reference_wrapper<var>> all_vars() {
return {output.x[0], output.x[1], output.x[2], output.x[3],
output.y[0], output.y[1], output.y[2], output.y[3]};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ namespace nil {
};
}

std::vector<var> all_vars() const {
std::vector<std::reference_wrapper<var>> all_vars() {
return {output[0], output[1], output[2], output[3], output[4], output[5],
output[6], output[7], output[8], output[9], output[10], output[11]};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ namespace nil {
final_mul_per_bit_res.output.y[3]};
}

std::vector<var> all_vars() const {
std::vector<std::reference_wrapper<var>> all_vars() {
return {output.x[0], output.x[1], output.x[2], output.x[3],
output.y[0], output.y[1], output.y[2], output.y[3]};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ namespace nil {
final_addition_res.output.y[3]};
}

std::vector<var> all_vars() const {
std::vector<std::reference_wrapper<var>> all_vars() {
return {output.x[0], output.x[1], output.x[2], output.x[3],
output.y[0], output.y[1], output.y[2], output.y[3]};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ namespace nil {
false, var::column_type::witness);
}

std::vector<var> all_vars() const {
std::vector<std::reference_wrapper<var>> all_vars() {
return {output};
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ namespace nil {
result_type() {
}

std::vector<var> all_vars() const {
std::vector<std::reference_wrapper<var>> all_vars() {
return {X, Y};
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ namespace nil {
Y = var(component.W(1), start_row_index + component.rows_amount - 1, false, var::column_type::witness);
}

std::vector<var> all_vars() const {
std::vector<std::reference_wrapper<var>> all_vars() {
return {X, Y};
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ namespace nil {
output = var(component.W(2), start_row_index, false, var::column_type::witness);
}

std::vector<var> all_vars() const {
std::vector<std::reference_wrapper<var>> all_vars() {
return {output};
}
};
Expand All @@ -133,7 +133,7 @@ namespace nil {
std::initializer_list<typename component_type::public_input_container_type::value_type>
public_inputs) :
component_type(witnesses, constants, public_inputs, get_manifest()) {};

static typename BlueprintFieldType::value_type calculate(typename BlueprintFieldType::value_type x,
typename BlueprintFieldType::value_type y) {
return x + y;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ namespace nil {
component.composition_subcomponent, row).output;
}

std::vector<var> all_vars() const {
std::vector<std::reference_wrapper<var>> all_vars() {
return {output};
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ namespace nil {
output = var(component.W(2), start_row_index, false, var::column_type::witness);
}

std::vector<var> all_vars() const {
std::vector<std::reference_wrapper<var>> all_vars() {
return {output};
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ namespace nil {
output = var(component.W(2), start_row_index, false, var::column_type::witness);
}

std::vector<var> all_vars() const {
std::vector<std::reference_wrapper<var>> all_vars() {
return {output};
}
};
Expand All @@ -133,7 +133,7 @@ namespace nil {
std::initializer_list<
typename component_type::public_input_container_type::value_type> public_inputs):
component_type(witnesses, constants, public_inputs, get_manifest()){};

static typename BlueprintFieldType::value_type calculate(typename BlueprintFieldType::value_type x,
typename BlueprintFieldType::value_type y) {
return (y == 0) ? 0 : x / y;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ namespace nil {
start_row_index + component.rows_amount - 1, false);
}

std::vector<var> all_vars() const {
std::vector<std::reference_wrapper<var>> all_vars() {
return {output};
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ namespace nil {
var(component.W(5), start_row_index, false, var::column_type::witness)};
}

std::vector<var> all_vars() const {
std::vector<std::reference_wrapper<var>> all_vars() {
return {output[0], output[1]};
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ namespace nil {
output = var(component.W(0), start_row_index, false);
}

std::vector<var> all_vars() const {
std::vector<std::reference_wrapper<var>> all_vars() {
return {output};
}
};
Expand All @@ -161,7 +161,7 @@ namespace nil {

static typename BlueprintFieldType::value_type calculate(typename BlueprintFieldType::value_type x,
typename BlueprintFieldType::value_type y) {

std::array<typename BlueprintFieldType::value_type, 5> t;
t[0] = x;
t[1] = y;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ namespace nil {
output = var(component.W(0), start_row_index, false);
}

std::vector<var> all_vars() const {
std::vector<std::reference_wrapper<var>> all_vars() {
return {output};
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ namespace nil {
output = var(component.W(2), start_row_index, false, var::column_type::witness);
}

std::vector<var> all_vars() const {
std::vector<std::reference_wrapper<var>> all_vars() {
return {output};
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ namespace nil {
output = var(component.W(1), start_row_index, false, var::column_type::witness);
}

std::vector<var> all_vars() const {
std::vector<std::reference_wrapper<var>> all_vars() {
return {output};
}
};
Expand All @@ -136,7 +136,7 @@ namespace nil {
value_type constant_):
component_type(witnesses, constants, public_inputs, get_manifest()),
constant(constant_) {};

static typename BlueprintFieldType::value_type calculate(typename BlueprintFieldType::value_type x,
typename BlueprintFieldType::value_type constant) {
return x * constant;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ namespace nil {
var(component.W(3), start_row_index, false)};
}

std::vector<var> all_vars() const {
std::vector<std::reference_wrapper<var>> all_vars() {
return {output[0], output[1], output[2], output[3]};
}
};
Expand Down Expand Up @@ -363,13 +363,13 @@ namespace nil {
typename BlueprintFieldType::integral_type(var_value(assignment, instance_input.A[1]).data),
typename BlueprintFieldType::integral_type(var_value(assignment, instance_input.A[2]).data),
typename BlueprintFieldType::integral_type(var_value(assignment, instance_input.A[3]).data)};

std::array<typename BlueprintFieldType::value_type, 4> b = {
typename BlueprintFieldType::integral_type(var_value(assignment, instance_input.B[0]).data),
typename BlueprintFieldType::integral_type(var_value(assignment, instance_input.B[1]).data),
typename BlueprintFieldType::integral_type(var_value(assignment, instance_input.B[2]).data),
typename BlueprintFieldType::integral_type(var_value(assignment, instance_input.B[3]).data)};

auto r = component_type::calculate(a, b);

assignment.witness(component.W(0), start_row_index) = r[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ namespace nil {
output = var(component.W(0), start_row_index, false);
}

std::vector<var> all_vars() const {
std::vector<std::reference_wrapper<var>> all_vars() {
return {output};
}
};
Expand Down Expand Up @@ -243,7 +243,7 @@ namespace nil {
for (std::uint32_t i = 0; i < component.bits_amount; ++i) {
input_bits[i] = var_value(assignment, instance_input.bits[i]) != 0 ? true : false;
}

assignment.witness(component.W(0), start_row_index) = component_type::calculate(input_bits, component.mode);

return typename plonk_bit_composition<BlueprintFieldType, ArithmetizationParams>::result_type(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ namespace nil {
}
}

std::vector<var> all_vars() const {
std::vector<std::reference_wrapper<var>> all_vars() {
return output;
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ namespace nil {
struct result_type {
result_type(const comparison_checked &component, std::size_t start_row_index) {}

std::vector<var> all_vars() const {
std::vector<std::reference_wrapper<var>> all_vars() {
return {};
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ namespace nil {
flag = var(component.W(0), start_row_index, false);
}

std::vector<var> all_vars() const {
std::vector<std::reference_wrapper<var>> all_vars() {
return {flag};
}
};
Expand Down Expand Up @@ -293,7 +293,7 @@ namespace nil {
typename BlueprintFieldType::value_type x,
typename BlueprintFieldType::value_type y,
std::size_t arg_bits_amount, comparison_mode arg_mode) {

using value_type = typename BlueprintFieldType::value_type;
using integral_type = typename BlueprintFieldType::integral_type;
using chunk_type = std::uint8_t;
Expand Down Expand Up @@ -603,7 +603,7 @@ namespace nil {
value_type x = var_value(assignment, instance_input.x),
y = var_value(assignment, instance_input.y);

assignment.witness(component.W(0), start_row_index) =
assignment.witness(component.W(0), start_row_index) =
component_type::calculate(component.witness_amount(), x, y, component.bits_amount, component.mode);

return typename component_type::result_type(component, start_row_index, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ namespace nil {
struct result_type {
result_type(const comparison_unchecked &component, std::size_t start_row_index) {}

std::vector<var> all_vars() const {
std::vector<std::reference_wrapper<var>> all_vars() {
return {};
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ namespace nil {
output = var(component.W(2), start_row_index, false);
}

std::vector<var> all_vars() const {
std::vector<std::reference_wrapper<var>> all_vars() {
return {output};
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ namespace nil {
output = var(component.W(ArgNum), start_row_index, false);
}

std::vector<var> all_vars() const {
std::vector<std::reference_wrapper<var>> all_vars() {
return {output};
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ namespace nil {
remainder = var(component.W(1), start_row_index);
}

std::vector<var> all_vars() const {
std::vector<std::reference_wrapper<var>> all_vars() {
return {quotient, remainder};
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ namespace nil {
output = var(component.W(3), start_row_index, false, var::column_type::witness);
}

std::vector<var> all_vars() const {
std::vector<std::reference_wrapper<var>> all_vars() {
return {output};
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ namespace nil {
var(component.W(3), start_row_index, false)};
}

std::vector<var> all_vars() const {
std::vector<std::reference_wrapper<var>> all_vars() {
return {output[0], output[1], output[2], output[3]};
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ namespace nil {
struct result_type {
result_type(const range &component, std::uint32_t start_row_index) {}

std::vector<var> all_vars() const {
std::vector<std::reference_wrapper<var>> all_vars() {
return {};
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ namespace nil {
output = var(component.W(4), start_row_index + component.rows_amount - 3, false);
}

std::vector<var> all_vars() const {
std::vector<std::reference_wrapper<var>> all_vars() {
return {output};
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ namespace nil {
var(component.W(3), start_row_index, false)};
}

std::vector<var> all_vars() const {
std::vector<std::reference_wrapper<var>> all_vars() {
return {output[0], output[1], output[2], output[3]};
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ namespace nil {
var(component.W(8), start_row_index, false, var::column_type::witness) };
}

std::vector<var> all_vars() const {
std::vector<std::reference_wrapper<var>> all_vars() {
return {output[0], output[1], output[2]};
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ namespace nil {
struct result_type {
result_type(const range_check &component, std::size_t start_row_index) {}

std::vector<var> all_vars() const {
std::vector<std::reference_wrapper<var>> all_vars() {
return {};
}
};
Expand Down
Loading

0 comments on commit 6dd1b5e

Please sign in to comment.