mirror of
https://github.com/logos-storage/circom-witnessgen.git
synced 2026-01-02 13:03:09 +00:00
add Pow operation
This commit is contained in:
parent
b8052dbf34
commit
a597168daf
@ -89,4 +89,9 @@ func `-`*(x, y: F ): F = ( var z : F = x ; z -= y ; return z )
|
||||
func `*`*(x, y: F ): F = ( var z : F = x ; z *= y ; return z )
|
||||
func `/`*(x, y: F ): F = ( var z : F = x ; z *= invF(y) ; return z )
|
||||
|
||||
func powF*(x: F, y: B): F =
|
||||
var z: F = x
|
||||
z.pow_vartime(y)
|
||||
return z
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
@ -149,7 +149,7 @@ func evalDuoOpNode(op: DuoOp, x: F, y: F): F =
|
||||
of Div: return if isZeroF(y): zeroF else: x / y
|
||||
of Add: return x + y
|
||||
of Sub: return x - y
|
||||
of Pow: assert( false, "Pow: not yet implemented" )
|
||||
of Pow: return powF(x, fToBig(y)) # assert( false, "Pow: not yet implemented" )
|
||||
of Idiv: assert( false, "Idiv: not yet implemented" ) # return bigToF( fToBig(x) div fToBig(y) )
|
||||
of Mod: assert( false, "Mod: not yet implemented" ) # return bigToF( fToBig(x) mod fToBig(y) )
|
||||
of Eq: return boolToF( x === y )
|
||||
|
||||
11
nim/main.nim
11
nim/main.nim
@ -6,10 +6,9 @@ import circom_witnessgen/export_wtns
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
const graph_file: string = "../tmp/graph4.bin"
|
||||
const input_file: string = "../tmp/input4.json"
|
||||
const wtns_file: string = "../tmp/nim4.wtns"
|
||||
const comp_file: string = "../tmp/nim4_full.bin"
|
||||
const graph_file: string = "../tmp/graph3.bin"
|
||||
const input_file: string = "../tmp/input3.json"
|
||||
const wtns_file: string = "../tmp/nim3.wtns"
|
||||
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
@ -23,10 +22,6 @@ when isMainModule:
|
||||
let gr = loadGraph(graph_file)
|
||||
# echo $gr
|
||||
|
||||
# echo "generating full computation"
|
||||
# let comp = generateFullComputation( gr, inp )
|
||||
# exportFeltSequence(comp_file, comp)
|
||||
|
||||
echo "generating witness"
|
||||
let wtns = generateWitness( gr, inp )
|
||||
exportWitness(wtns_file, wtns)
|
||||
Loading…
x
Reference in New Issue
Block a user