MCPcopy Create free account
hub / github.com/PolyhedraZK/ExpanderCompilerCollection / GetColumnRandomness

Function GetColumnRandomness

circuit-std-go/logup/utils.go:67–97  ·  view source on GitHub ↗
(api ecgo.API, n_columns uint, column_combine_options ColumnCombineOptions)

Source from the content-addressed store, hash-verified

65}
66
67func GetColumnRandomness(api ecgo.API, n_columns uint, column_combine_options ColumnCombineOptions) []frontend.Variable {
68 var randomness = make([]frontend.Variable, n_columns)
69 if column_combine_options == Poly {
70 beta := api.GetRandomValue()
71 randomness[0] = 1
72 randomness[1] = beta
73
74 // Hopefully this will generate fewer layers than sequential pows
75 max_deg := uint(1)
76 for max_deg < n_columns {
77 for i := max_deg + 1; i <= SimpleMin(max_deg*2, n_columns-1); i++ {
78 randomness[i] = api.Mul(randomness[max_deg], randomness[i-max_deg])
79 }
80 max_deg *= 2
81 }
82
83 // Debug Code:
84 // for i := 1; i < n_columns; i++ {
85 // api.AssertIsEqual(randomness[i], api.Mul(randomness[i - 1], beta))
86 // }
87
88 } else if column_combine_options == FullRandom {
89 randomness[0] = 1
90 for i := 1; i < int(n_columns); i++ {
91 randomness[i] = api.GetRandomValue()
92 }
93 } else {
94 panic("Unknown poly combine options")
95 }
96 return randomness
97}
98
99func CombineColumn(api ecgo.API, vec_2d [][]frontend.Variable, randomness []frontend.Variable) []frontend.Variable {
100 n_rows := len(vec_2d)

Callers 2

FinalCheckFunction · 0.70
CheckMethod · 0.70

Calls 3

SimpleMinFunction · 0.70
GetRandomValueMethod · 0.65
MulMethod · 0.45

Tested by

no test coverage detected