Skip to content

Commit

Permalink
added *Pooled to the polyEval cases
Browse files Browse the repository at this point in the history
  • Loading branch information
Soleimani193 committed Oct 22, 2024
1 parent 2ea64d5 commit 1647b69
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
4 changes: 4 additions & 0 deletions prover/maths/common/smartvectors/arithmetic_basic.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ func PolyEval(vecs []SmartVector, x field.Element, p ...mempool.MemPool) (result
anyReg = true
v := *casted
accumulateReg(resReg, v, xPow)
case *Pooled: // e.g. from product
anyReg = true
v := casted.Regular
accumulateReg(resReg, v, xPow)
case *PaddedCircularWindow:
// treat it as a regular, reusing the buffer
anyReg = true
Expand Down
4 changes: 2 additions & 2 deletions prover/maths/common/smartvectors/arithmetic_gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,12 @@ func processOperator(op operator, coeffs []int, svecs []SmartVector, p ...mempoo

switch {
case matchedRegular == totalToMatch:
return &regularRes.Regular
return regularRes
case matchedRegular+matchedConst == totalToMatch:
// In this case, there are no windowed in the list. This means we only
// need to merge the const one into the regular one before returning
op.constTermIntoVec(regularRes.Regular, &constRes.val)
return &regularRes.Regular
return regularRes
default:

// If windowRes is a regular (can happen if all windows arguments cover the full circle)
Expand Down
4 changes: 2 additions & 2 deletions prover/maths/common/smartvectors/arithmetic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,8 @@ func TestOpBasicEdgeCases(t *testing.T) {
for i, testCase := range testCases {
t.Run(fmt.Sprintf("case-%v", i), func(t *testing.T) {
t.Logf("test-case details: %v", testCase.explainer)
res := testCase.fn(testCase.inputs...)
actual := res
res := testCase.fn(testCase.inputs...).(*Pooled)
actual := NewRegular(res.Regular)
require.Equal(t, testCase.expectedRes, actual, "expectedRes=%v\nres=%v", testCase.expectedRes.Pretty(), res.Pretty())
})
}
Expand Down
11 changes: 1 addition & 10 deletions prover/protocol/wizardutils/evaluation.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,13 @@ func EvalExprColumn(run *wizard.ProverRuntime, board symbolic.ExpressionBoard) s

// returns the symbolic expression of a column obtained as a random linear combinations of differents handles
// without committing to the column itself
// @Azam this function is temporarily ignored and addressed in issue https://github.com/Consensys/linea-monorepo/issues/192
/*func RandLinCombColSymbolic(x coin.Info, hs []ifaces.Column) *symbolic.Expression {
func RandLinCombColSymbolic(x coin.Info, hs []ifaces.Column) *symbolic.Expression {
cols := make([]*symbolic.Expression, len(hs))
for c := range cols {
cols[c] = ifaces.ColumnAsVariable(hs[c])
}
expr := symbolic.NewPolyEval(x.AsVariable(), cols)
return expr
}*/
func RandLinCombColSymbolic(x coin.Info, hs []ifaces.Column) *symbolic.Expression {
res := symbolic.NewConstant(0)
for i := len(hs) - 1; i >= 0; i-- {
res = symbolic.Mul(res, x)
res = symbolic.Add(res, hs[i])
}
return res
}

// return the runtime assignments of a linear combination column
Expand Down

0 comments on commit 1647b69

Please sign in to comment.