Giter Club home page Giter Club logo

Comments (6)

dhuynh95 avatar dhuynh95 commented on May 23, 2024 1

I think you did too many multiplications. You set {60, 40, 40, 60} for the primes used in the moduli, therefore you can do only 2 multiplications while you asked to do 5.

from tenseal.

apignet avatar apignet commented on May 23, 2024 1

okay thank you @youben11
I am going to look further on this choice of parameters

from tenseal.

apignet avatar apignet commented on May 23, 2024

Hi.
This issue is closed, but I have the same problem. How did you solved it ?

I am trying to evaluate a polynomial expression of a dot product.

The SEAL documentation explains that I missed a relinearization or a rescale step, but I thought both operations are done automatically using tenseal ?

context = ts.context(ts.SCHEME_TYPE.CKKS, 8192, coeff_mod_bit_sizes=[60, 40, 40, 60])
context.global_scale = pow(2,40)
context.generate_galois_keys()

plain_vector = [-1, 0,9, 6, 90 ]
vec = np.array(plain_vector)
plain_vector2 = [-1 ,3 , 2,3,0 ]
vec2= np.array(plain_vector2)

encrypted_vector = ts.ckks_vector(context, plain_vector)
encrypted_vector2 = ts.ckks_vector(context, plain_vector2)

Edot = encrypted_vector.dot(encrypted_vector)
Udot= vec.dot(vec2)

(EdotEdot) * (Edot[0.5])

ValueError: scale out of bounds

from tenseal.

youben11 avatar youben11 commented on May 23, 2024

Hi @apignet, you are trying to perform 3 multiplications in a chain when your parameters are set to support two multiplications only. You will need to increase the parameters while creating the context in context = ts.context(ts.SCHEME_TYPE.CKKS, 8192, coeff_mod_bit_sizes=[60, 40, 40, 60]) in order to support 3 multiplications.

from tenseal.

apignet avatar apignet commented on May 23, 2024

Reading SEAL example and this issue [64](ehttps://github.com/microsoft/SEAL/issues/64 ), I understood that the relinearization/rescaling operations transform a cipertext of level l in a ciphertext of level l-1. Therefore, with auto-relin and auto-rescale, I did not understand why I am not able to support more than 2 multiplications.

from tenseal.

youben11 avatar youben11 commented on May 23, 2024

The auto_|relin|rescale] features of TenSEAL allow users to focus on the computation without the need to do the relinearization/rescaling, but those operations are still done by TenSEAL. A new ciphertext has some coefficient modulus q and every time a multiplication is done and we perform a rescaling, the modulus goes down, until it reaches some value that can no longer holds the coefficient with a certain scale, so for being able to perform many multiplication for a certain scale, you will need to choose your parameters accordingly.

from tenseal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.