Unexpected output in CosineSimilarityCircuit when utilizing AssertIsEqual
#688
Unanswered
sigridjineth
asked this question in
Q&A
Replies: 1 comment
-
Without going through the math thoroughly, I think the problems is that we work in different domains: the witness is computed using the floats, but the computations in-circuit are defined in the emulated field. For example Sqrt(20) in floats is 4.nnn, but in a finite field it is a large field element. I'm not sure if gnark is right now applicable to your use case as it doesn't support floating point arithmetic and we do not plan implementing near term. There has been another user interested in floating point arithmetic, see #684 (comment). Maybe you could cooperate on implementing it? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I'm new to writing gnark circuits directly, without using any DSLs like Circom, and I've encountered an issue with my
CosineSimilarityCircuit
.In my CosineSimilarityCircuit test, I've set
CS_RAW
to 0 at runtime. However, when I run the test, I receive an error message wherec.CS
is not 0 but a (weirdly) large number.Here's the error message:
Here is the link to the CosineSimilarityCircuit test and the CosineSimilarityCircuit definition:
Additionally, it is difficult to debug since the elliptic curve of
secp256k1
doesn't have thePrintln
method unlikeapi
package.I would appreciate any guidance on why this might be happening and how to fix it.
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions