NCP
objects are worker objects that separate a
master process from communicating directly with the worker
processes. Typically two such are needed for a distributed
homomorphic computation. A master process can communicate with
NCP
objects and the NCP
objects can communicate
with worker processes. However, the two NCP
objects,
designated by numbers 1 and 2, are non-cooperating in the sense
that they don't communicate with each other and are isolated
from each other.
pubkey
the master's public key visible to everyone
pubkey_bits
the number of bits in the public key (used for reconstructing public key remotely by serializing to character)
pubkey_n
the n
for the public key used for reconstructing public key remotely
den
the denominator for rational arithmetic
den_bits
the number of bits in the denominator used for reconstructing denominator remotely
new()
Create a new NCP
object.
NCP$new(
ncp_defn,
comp_defn,
sites = list(),
pubkey_bits = NULL,
pubkey_n = NULL,
den_bits = NULL
)
ncp_defn
the NCP definition; see example
comp_defn
the computation definition
sites
list of sites
pubkey_bits
the number of bits in public key
pubkey_n
the n
for the public key
den_bits
the number of bits in the denominator (power of 2) used in rational approximations
a new NCP
object
getStateful()
Retrieve the value of the stateful
field
NCP$getStateful()
setParams()
Set some parameters of the NCP
object for homomorphic computations
NCP$setParams(pubkey_bits, pubkey_n, den_bits)
pubkey_bits
the number of bits in public key
pubkey_n
the n
for the public key
den_bits
the number of bits in the denominator (power of 2) used in rational approximations
getSites()
Retrieve the value of the private sites
field
NCP$getSites()
setSites()
Set the value of the private sites
field
NCP$setSites(sites)
sites
the list of sites
addSite()
Add a url or worker object for a site for participating in the distributed computation. The worker object can be used to avoid complications in debugging remote calls during prototyping.
NCP$addSite(name, url = NULL, worker = NULL)
name
of the site
url
web url of the site; exactly one of url
or worker
should be specified
worker
worker object for the site; exactly one of url
or worker
should be specified
cleanupInstance()
Clean up by destroying instance objects created in workspace.
NCP$cleanupInstance(token)
token
the token for the instance
run()
Run the distributed homomorphic computation
NCP$run(token)
token
a unique token for the run, used to ensure that correct parts of cached results are returned appropriately
the result of the computation
clone()
The objects of this class are cloneable with this method.
NCP$clone(deep = FALSE)
deep
Whether to make a deep clone.