Comments (3)
Hi,
(Disclaimer : I'm not affiliated with Zama, and just happened to have had similar issues before. Obviously, if there is any contradiction, an answer given by a member of the Zama team should be seen as more trustworthy than mine.)
I think the issue here is that Rust does not automatically convert between integer types (like 2) and floating-point types (like 2.). Your code may work if you add a dot after the 2
, e.g, replace 2*x*x
by 2.*x*x
. For instance, to compute 2x^2, replacing the line
let encoder_output = Encoder::new(0., 100., 6, 0)?;
by
let encoder_output = Encoder::new(0., 200., 6, 0)?;
and
let c2 = c1.bootstrap_with_function(&bsk, |x| x * x, &encoder_output)?;
by
let c2 = c1.bootstrap_with_function(&bsk, |x| 2. * x * x, &encoder_output)?;
in the example should work.
As far as I am aware, programmable bootstrapping only allows to evaluate univariate functions, and so can not be used to compute (x+y)/2 if x and y are different messages. However, since this particular function is linear, it can be reconstructed using ciphertext addition (see https://docs.zama.ai/concrete/lib/simple-operations/adding-two-ciphertexts.html) and multiplication by a constant (https://docs.zama.ai/concrete/lib/simple-operations/multiplying-a-ciphertext-by-a-constant.html#multiplying-an-lwe-by-a-real-constant), e.g.
x.add_with_padding_inplace(&y)?;
x.mul_constant_with_padding_inplace(0.5, 0.5, 4)?;
(The second and third parameters may not be optimal for your use case.)
from concrete.
Hello @dimk1 👋 ,
Thanks @FlorentCLMichel for answering on this one 🙂 .
Indeed, your problem is just that the 2
literal is expected to be coerced to an integer type by the compiler, whereas 2.
is coerced to a floating point number type. Usually if you see {integer}
or {float}
in an error message, it means that the compiler is not able to coerce a numeric literal to a raw type.
Also, note that in Rust, the ^
operator is not used for exponentiation, but for bitwise xoring.
For multivariate bootstrap, there is, to the best of our knowledge, no solution to support it in a general way unfortunately.
I close the issue since there is nothing actionable on our side, but feel free to add more comments or open a new one if necessary 🙂
from concrete.
Excellent support, thank you very much.
from concrete.
Related Issues (20)
- Attempt to read property "pTemplateID" on null in Page.php HOT 2
- Make Mul, DotEintEint, MatMulEintEint support multi-precision HOT 1
- Help for installing Concrete version 1.0.0-beta HOT 4
- Error while setting up Concrete-Python for development HOT 13
- Comparison sequence of enc_numbers HOT 2
- 【source compile】ModuleNotFoundError: No module named 'mlir._mlir_libs'
- Cannot query encrypted KeyValueDatabase examples HOT 2
- if_then_else support clear values for branch result HOT 1
- Fail to run the quick start with docker HOT 4
- Startup failed HOT 1
- Compilation failing with "RuntimeError: Cannot open compilation feedback" HOT 3
- Concrete-Python ARM image for Linux HOT 3
- Update Makefile so tests run on Raspberry Pi don't fail due to resource constraints. HOT 1
- keygen method's encryption_seed value actually refers to secret_seed HOT 1
- Sample code crashes on Apple M1 HOT 1
- Support of **please-fill** in Concrete HOT 2
- Can I implementation of Luhn's algorithm to validate a credit card number encrypted using homomorphic encryption, using concrete TFHE Compiler? HOT 3
- Key-value database examples not working (seems to be a regression in 2.6.0, used to work for 2.5.0) HOT 7
- Segmentation Fault HOT 21
- How to reproduce the NN inference experiments in eprint.iacr.org/2021/091 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from concrete.