NCP {distcomp} | R Documentation |

## R6 object to use as non-cooperating party in a distributed homomorphic computation

### Description

`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.

### Public fields

`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

### Methods

#### Public methods

#### Method `new()`

Create a new `NCP`

object.

##### Usage

NCP$new( ncp_defn, comp_defn, sites = list(), pubkey_bits = NULL, pubkey_n = NULL, den_bits = NULL )

##### Arguments

`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

##### Returns

a new `NCP`

object

#### Method `getStateful()`

Retrieve the value of the `stateful`

field

##### Usage

NCP$getStateful()

#### Method `setParams()`

Set some parameters of the `NCP`

object for homomorphic computations

##### Usage

NCP$setParams(pubkey_bits, pubkey_n, den_bits)

##### Arguments

`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

#### Method `getSites()`

Retrieve the value of the private `sites`

field

##### Usage

NCP$getSites()

#### Method `setSites()`

Set the value of the private `sites`

field

##### Usage

NCP$setSites(sites)

##### Arguments

`sites`

the list of sites

#### Method `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.

##### Usage

NCP$addSite(name, url = NULL, worker = NULL)

##### Arguments

`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

#### Method `cleanupInstance()`

Clean up by destroying instance objects created in workspace.

##### Usage

NCP$cleanupInstance(token)

##### Arguments

`token`

the token for the instance

#### Method `run()`

Run the distributed homomorphic computation

##### Usage

NCP$run(token)

##### Arguments

`token`

a unique token for the run, used to ensure that correct parts of cached results are returned appropriately

##### Returns

the result of the computation

#### Method `clone()`

The objects of this class are cloneable with this method.

##### Usage

NCP$clone(deep = FALSE)

##### Arguments

`deep`

Whether to make a deep clone.

*distcomp*version 1.3-3 Index]