Skip to content

Commit

Permalink
Merge pull request scipr-lab#4 from gnosis/r1cs-evaluation
Browse files Browse the repository at this point in the history
remove assumption that first column of constraint system is always 1
  • Loading branch information
bh2smith authored Nov 26, 2018
2 parents 8268b56 + b1ddb64 commit 9693469
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/main/java/relations/objects/LinearCombination.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,10 @@ public boolean isValid(final int numVariables) {

public FieldT evaluate(final Assignment<FieldT> input) {
FieldT result = input.get(0).zero();
final FieldT one = result.one();

for (int i = 0; i < terms.size(); i++) {
final long index = terms.get(i).index();
final FieldT value = index == 0 ? one : input.get((int) index).mul(terms.get(i).value());
final FieldT value = input.get((int) index).mul(terms.get(i).value());

result = result.add(value);
}
Expand Down

0 comments on commit 9693469

Please sign in to comment.