Numpy 模块#

小技巧

请使用 from heu import numpy as hnp 引入 phe 模块

a numpy adapter for phe module which provides numpy-like api

class heu.numpy.CiphertextArray#
property cols#

Get the number of cols

property ndim#

The array’s number of dimensions

property rows#

Get the number of rows

property shape#

The array’s shape

property size#

Number of elements in the array

transpose(self: heu.numpy.CiphertextArray) heu.numpy.CiphertextArray#

Transpose the array

class heu.numpy.Decryptor#
decrypt(*args, **kwargs)#

Overloaded function.

  1. decrypt(self: heu.numpy.Decryptor, ciphertext: heu.phe.Ciphertext) -> heu.phe.Plaintext

Decrypt ciphertext (scalar) to plaintext (scalar)

  1. decrypt(self: heu.numpy.Decryptor, ciphertext_array: heu.numpy.CiphertextArray) -> heu.numpy.PlaintextArray

Decrypt ciphertext array to plaintext array

property phe#
class heu.numpy.DestinationHeKit#
array(*args, **kwargs)#

Overloaded function.

  1. array(self: heu.phe.HeKitPublicBase, ndarray: numpy.ndarray, encoder_params: heu.phe.BigintEncoderParams = BigintEncoderParams()) -> heu.numpy.PlaintextArray

Create and encode an array using heu::pylib::PyBigintEncoderParams

  1. array(self: heu.phe.HeKitPublicBase, object: object, encoder_params: heu.phe.BigintEncoderParams = BigintEncoderParams()) -> heu.numpy.PlaintextArray

Encode a numpy ndarray using heu::pylib::PyBigintEncoderParams

  1. array(self: heu.phe.HeKitPublicBase, ndarray: numpy.ndarray, encoder: heu.phe.BigintEncoder) -> heu.numpy.PlaintextArray

Create and encode an array using heu::pylib::PyBigintEncoder, same with hnp.array()

  1. array(self: heu.phe.HeKitPublicBase, object: object, encoder: heu.phe.BigintEncoder) -> heu.numpy.PlaintextArray

Encode a numpy ndarray using heu::pylib::PyBigintEncoder, same with hnp.array()

  1. array(self: heu.phe.HeKitPublicBase, ndarray: numpy.ndarray, encoder_params: heu.phe.IntegerEncoderParams) -> heu.numpy.PlaintextArray

Create and encode an array using heu::pylib::PyIntegerEncoderParams

  1. array(self: heu.phe.HeKitPublicBase, object: object, encoder_params: heu.phe.IntegerEncoderParams) -> heu.numpy.PlaintextArray

Encode a numpy ndarray using heu::pylib::PyIntegerEncoderParams

  1. array(self: heu.phe.HeKitPublicBase, ndarray: numpy.ndarray, encoder: heu.phe.IntegerEncoder) -> heu.numpy.PlaintextArray

Create and encode an array using heu::pylib::PyIntegerEncoder, same with hnp.array()

  1. array(self: heu.phe.HeKitPublicBase, object: object, encoder: heu.phe.IntegerEncoder) -> heu.numpy.PlaintextArray

Encode a numpy ndarray using heu::pylib::PyIntegerEncoder, same with hnp.array()

  1. array(self: heu.phe.HeKitPublicBase, ndarray: numpy.ndarray, encoder_params: heu.phe.FloatEncoderParams) -> heu.numpy.PlaintextArray

Create and encode an array using heu::pylib::PyFloatEncoderParams

  1. array(self: heu.phe.HeKitPublicBase, object: object, encoder_params: heu.phe.FloatEncoderParams) -> heu.numpy.PlaintextArray

Encode a numpy ndarray using heu::pylib::PyFloatEncoderParams

  1. array(self: heu.phe.HeKitPublicBase, ndarray: numpy.ndarray, encoder: heu.phe.FloatEncoder) -> heu.numpy.PlaintextArray

Create and encode an array using heu::pylib::PyFloatEncoder, same with hnp.array()

  1. array(self: heu.phe.HeKitPublicBase, object: object, encoder: heu.phe.FloatEncoder) -> heu.numpy.PlaintextArray

Encode a numpy ndarray using heu::pylib::PyFloatEncoder, same with hnp.array()

  1. array(self: heu.phe.HeKitPublicBase, ndarray: numpy.ndarray, encoder_params: heu.phe.BatchIntegerEncoderParams) -> heu.numpy.PlaintextArray

Create and encode an array using heu::pylib::PyBatchIntegerEncoderParams

  1. array(self: heu.phe.HeKitPublicBase, object: object, encoder_params: heu.phe.BatchIntegerEncoderParams) -> heu.numpy.PlaintextArray

Encode a numpy ndarray using heu::pylib::PyBatchIntegerEncoderParams

  1. array(self: heu.phe.HeKitPublicBase, ndarray: numpy.ndarray, encoder: heu.phe.BatchIntegerEncoder) -> heu.numpy.PlaintextArray

Create and encode an array using heu::pylib::PyBatchIntegerEncoder, same with hnp.array()

  1. array(self: heu.phe.HeKitPublicBase, object: object, encoder: heu.phe.BatchIntegerEncoder) -> heu.numpy.PlaintextArray

Encode a numpy ndarray using heu::pylib::PyBatchIntegerEncoder, same with hnp.array()

  1. array(self: heu.phe.HeKitPublicBase, ndarray: numpy.ndarray, encoder_params: heu.phe.BatchFloatEncoderParams) -> heu.numpy.PlaintextArray

Create and encode an array using heu::pylib::PyBatchFloatEncoderParams

  1. array(self: heu.phe.HeKitPublicBase, object: object, encoder_params: heu.phe.BatchFloatEncoderParams) -> heu.numpy.PlaintextArray

Encode a numpy ndarray using heu::pylib::PyBatchFloatEncoderParams

  1. array(self: heu.phe.HeKitPublicBase, ndarray: numpy.ndarray, encoder: heu.phe.BatchFloatEncoder) -> heu.numpy.PlaintextArray

Create and encode an array using heu::pylib::PyBatchFloatEncoder, same with hnp.array()

  1. array(self: heu.phe.HeKitPublicBase, object: object, encoder: heu.phe.BatchFloatEncoder) -> heu.numpy.PlaintextArray

Encode a numpy ndarray using heu::pylib::PyBatchFloatEncoder, same with hnp.array()

encryptor(self: heu.numpy.DestinationHeKit) heu::lib::numpy::Encryptor#

Get encryptor

evaluator(self: heu.numpy.DestinationHeKit) heu::lib::numpy::Evaluator#

Get evaluator

class heu.numpy.Encryptor#
encrypt(*args, **kwargs)#

Overloaded function.

  1. encrypt(self: heu.numpy.Encryptor, plaintext: heu.phe.Plaintext) -> heu.phe.Ciphertext

Encrypt plaintext (scalar) to ciphertext (scalar)

  1. encrypt(self: heu.numpy.Encryptor, plaintext_array: heu.numpy.PlaintextArray) -> heu.numpy.CiphertextArray

Encrypt plaintext array to ciphertext array

encrypt_with_audit(self: heu.numpy.Encryptor, arg0: heu.numpy.PlaintextArray) Tuple[heu.numpy.CiphertextArray, heu.numpy.StringArray]#

Encrypt and build audit string including plaintext/random/ciphertext info

property phe#

Get the instance of phe.Encryptor for scalar encryption

class heu.numpy.Evaluator#
add(*args, **kwargs)#

Overloaded function.

  1. add(self: heu.numpy.Evaluator, arg0: heu.numpy.CiphertextArray, arg1: heu.numpy.CiphertextArray) -> heu.numpy.CiphertextArray

  2. add(self: heu.numpy.Evaluator, arg0: heu.numpy.CiphertextArray, arg1: heu.numpy.PlaintextArray) -> heu.numpy.CiphertextArray

  3. add(self: heu.numpy.Evaluator, arg0: heu.numpy.PlaintextArray, arg1: heu.numpy.CiphertextArray) -> heu.numpy.CiphertextArray

  4. add(self: heu.numpy.Evaluator, arg0: heu.numpy.PlaintextArray, arg1: heu.numpy.PlaintextArray) -> heu.numpy.PlaintextArray

batch_feature_wise_bucket_sum(*args, **kwargs)#

Overloaded function.

  1. batch_feature_wise_bucket_sum(self: heu.numpy.Evaluator, arg0: heu.numpy.PlaintextArray, arg1: List[numpy.ndarray[numpy.int8[1, n]]], arg2: numpy.ndarray[numpy.int8[m, n], flags.c_contiguous], arg3: int, arg4: bool) -> List[heu.numpy.PlaintextArray]

Take elements in x according to order_map to caculate the row sum at each bin for each subgroup (Plaintext) e heu numpy evaluator x dense matrix, rows are elements of bin sum subgroup_map a list of 1d py np ndarray (vector) acts as filters. Its length should be equal to x.rows(), elements should be 0 or 1, with 1 indicates in this subgroup. order_map a 2d py ndarray. It has shape x.rows() * number of features.order_map(i, j) = k means row i feature j should be in bin k of feature j. bucket_num int. The number of buckets for each bin. cumsum bool. If apply cumulative sum to buckets for each feature. return list of dense matrix<T>, the row bin sum results. Each element has shape (bucket_num * feature_num, x.cols()).

  1. batch_feature_wise_bucket_sum(self: heu.numpy.Evaluator, arg0: heu.numpy.CiphertextArray, arg1: List[numpy.ndarray[numpy.int8[1, n]]], arg2: numpy.ndarray[numpy.int8[m, n], flags.c_contiguous], arg3: int, arg4: bool) -> List[heu.numpy.CiphertextArray]

Take elements in x according to order_map to caculate the row sum at each bin for each subgroup (Ciphertext) e heu numpy evaluator x dense matrix, rows are elements of bin sum subgroup_map a list of 1d py np ndarray (vector) acts as filters. Its length should be equal to x.rows(), elements should be 0 or 1, with 1 indicates in this subgroup. order_map a 2d py ndarray. It has shape x.rows() * number of features.order_map(i, j) = k means row i feature j should be in bin k of feature j. bucket_num int. The number of buckets for each bin. cumsum bool. If apply cumulative sum to buckets for each feature. return list of dense matrix<T>, the row bin sum results. Each element has shape (bucket_num * feature_num, x.cols()).

batch_select_sum(*args, **kwargs)#

Overloaded function.

  1. batch_select_sum(self: heu.numpy.Evaluator, arg0: heu.numpy.PlaintextArray, arg1: List[object]) -> heu.numpy.PlaintextArray

Compute an array of sum of selected elements (Plaintext), equivalent to [x[indices].sum() for indices in indices_list] but faster.

  1. batch_select_sum(self: heu.numpy.Evaluator, arg0: heu.numpy.CiphertextArray, arg1: List[object]) -> heu.numpy.CiphertextArray

Compute an array of sum of selected elements (Ciphertext), equivalent to [x[indices].sum() for indices in indices_list] but faster.

feature_wise_bucket_sum(*args, **kwargs)#

Overloaded function.

  1. feature_wise_bucket_sum(self: heu.numpy.Evaluator, arg0: heu.numpy.PlaintextArray, arg1: numpy.ndarray[numpy.int8[1, n]], arg2: numpy.ndarray[numpy.int8[m, n], flags.c_contiguous], arg3: int, arg4: bool) -> heu.numpy.PlaintextArray

Take elements in x according to order_map to caculate the row sum at each bin. (Plaintext) e heu numpy evaluator x dense matrix, rows are elements of bin sum subgroup_map a 1d py np ndarray (vector) acts as a filter. Its length should be equal to x.rows(), elements should be 0 or 1, with 1 indicates in this subgroup. order_map a 2d py ndarray. It has shape x.rows() * number of features.order_map(i, j) = k means row i feature j should be in bin k of feature j. bucket_num int. The number of buckets for each bin. cumsum bool. If apply cumulative sum to buckets for each feature. return dense matrix<T>, the row bin sum result. It has shape (bucket_num * feature_num, x.cols()).

  1. feature_wise_bucket_sum(self: heu.numpy.Evaluator, arg0: heu.numpy.CiphertextArray, arg1: numpy.ndarray[numpy.int8[1, n]], arg2: numpy.ndarray[numpy.int8[m, n], flags.c_contiguous], arg3: int, arg4: bool) -> heu.numpy.CiphertextArray

Take elements in x according to order_map to caculate the row sum at each bin. (Ciphertext) e heu numpy evaluator x dense matrix, rows are elements of bin sum subgroup_map a 1d py np ndarray (vector) acts as a filter. Its length should be equal to x.rows(), elements should be 0 or 1, with 1 indicates in this subgroup. order_map a 2d py ndarray. It has shape x.rows() * number of features.order_map(i, j) = k means row i feature j should be in bin k of feature j. bucket_num int. The number of buckets for each bin. cumsum bool. If apply cumulative sum to buckets for each feature. return dense matrix<T>, the row bin sum result. It has shape (bucket_num * feature_num, x.cols()).

matmul(*args, **kwargs)#

Overloaded function.

  1. matmul(self: heu.numpy.Evaluator, arg0: heu.numpy.PlaintextArray, arg1: heu.numpy.PlaintextArray) -> heu.numpy.PlaintextArray

  2. matmul(self: heu.numpy.Evaluator, arg0: heu.numpy.PlaintextArray, arg1: heu.numpy.CiphertextArray) -> heu.numpy.CiphertextArray

  3. matmul(self: heu.numpy.Evaluator, arg0: heu.numpy.CiphertextArray, arg1: heu.numpy.PlaintextArray) -> heu.numpy.CiphertextArray

mul(*args, **kwargs)#

Overloaded function.

  1. mul(self: heu.numpy.Evaluator, arg0: heu.numpy.CiphertextArray, arg1: heu.numpy.PlaintextArray) -> heu.numpy.CiphertextArray

  2. mul(self: heu.numpy.Evaluator, arg0: heu.numpy.PlaintextArray, arg1: heu.numpy.CiphertextArray) -> heu.numpy.CiphertextArray

  3. mul(self: heu.numpy.Evaluator, arg0: heu.numpy.PlaintextArray, arg1: heu.numpy.PlaintextArray) -> heu.numpy.PlaintextArray

property phe#
select_sum(*args, **kwargs)#

Overloaded function.

  1. select_sum(self: heu.numpy.Evaluator, arg0: heu.numpy.PlaintextArray, arg1: object) -> heu.phe.Plaintext

Compute the sum of selected elements (Plaintext), equivalent to x[indices].sum() but faster.

  1. select_sum(self: heu.numpy.Evaluator, arg0: heu.numpy.CiphertextArray, arg1: object) -> heu.phe.Ciphertext

Compute the sum of selected elements (Ciphertext), equivalent to x[indices].sum() but faster.

sub(*args, **kwargs)#

Overloaded function.

  1. sub(self: heu.numpy.Evaluator, arg0: heu.numpy.CiphertextArray, arg1: heu.numpy.CiphertextArray) -> heu.numpy.CiphertextArray

  2. sub(self: heu.numpy.Evaluator, arg0: heu.numpy.CiphertextArray, arg1: heu.numpy.PlaintextArray) -> heu.numpy.CiphertextArray

  3. sub(self: heu.numpy.Evaluator, arg0: heu.numpy.PlaintextArray, arg1: heu.numpy.CiphertextArray) -> heu.numpy.CiphertextArray

  4. sub(self: heu.numpy.Evaluator, arg0: heu.numpy.PlaintextArray, arg1: heu.numpy.PlaintextArray) -> heu.numpy.PlaintextArray

sum(*args, **kwargs)#

Overloaded function.

  1. sum(self: heu.numpy.Evaluator, arg0: heu.numpy.PlaintextArray) -> heu.phe.Plaintext

  2. sum(self: heu.numpy.Evaluator, arg0: heu.numpy.CiphertextArray) -> heu.phe.Ciphertext

class heu.numpy.HeKit#
array(*args, **kwargs)#

Overloaded function.

  1. array(self: heu.phe.HeKitPublicBase, ndarray: numpy.ndarray, encoder_params: heu.phe.BigintEncoderParams = BigintEncoderParams()) -> heu.numpy.PlaintextArray

Create and encode an array using heu::pylib::PyBigintEncoderParams

  1. array(self: heu.phe.HeKitPublicBase, object: object, encoder_params: heu.phe.BigintEncoderParams = BigintEncoderParams()) -> heu.numpy.PlaintextArray

Encode a numpy ndarray using heu::pylib::PyBigintEncoderParams

  1. array(self: heu.phe.HeKitPublicBase, ndarray: numpy.ndarray, encoder: heu.phe.BigintEncoder) -> heu.numpy.PlaintextArray

Create and encode an array using heu::pylib::PyBigintEncoder, same with hnp.array()

  1. array(self: heu.phe.HeKitPublicBase, object: object, encoder: heu.phe.BigintEncoder) -> heu.numpy.PlaintextArray

Encode a numpy ndarray using heu::pylib::PyBigintEncoder, same with hnp.array()

  1. array(self: heu.phe.HeKitPublicBase, ndarray: numpy.ndarray, encoder_params: heu.phe.IntegerEncoderParams) -> heu.numpy.PlaintextArray

Create and encode an array using heu::pylib::PyIntegerEncoderParams

  1. array(self: heu.phe.HeKitPublicBase, object: object, encoder_params: heu.phe.IntegerEncoderParams) -> heu.numpy.PlaintextArray

Encode a numpy ndarray using heu::pylib::PyIntegerEncoderParams

  1. array(self: heu.phe.HeKitPublicBase, ndarray: numpy.ndarray, encoder: heu.phe.IntegerEncoder) -> heu.numpy.PlaintextArray

Create and encode an array using heu::pylib::PyIntegerEncoder, same with hnp.array()

  1. array(self: heu.phe.HeKitPublicBase, object: object, encoder: heu.phe.IntegerEncoder) -> heu.numpy.PlaintextArray

Encode a numpy ndarray using heu::pylib::PyIntegerEncoder, same with hnp.array()

  1. array(self: heu.phe.HeKitPublicBase, ndarray: numpy.ndarray, encoder_params: heu.phe.FloatEncoderParams) -> heu.numpy.PlaintextArray

Create and encode an array using heu::pylib::PyFloatEncoderParams

  1. array(self: heu.phe.HeKitPublicBase, object: object, encoder_params: heu.phe.FloatEncoderParams) -> heu.numpy.PlaintextArray

Encode a numpy ndarray using heu::pylib::PyFloatEncoderParams

  1. array(self: heu.phe.HeKitPublicBase, ndarray: numpy.ndarray, encoder: heu.phe.FloatEncoder) -> heu.numpy.PlaintextArray

Create and encode an array using heu::pylib::PyFloatEncoder, same with hnp.array()

  1. array(self: heu.phe.HeKitPublicBase, object: object, encoder: heu.phe.FloatEncoder) -> heu.numpy.PlaintextArray

Encode a numpy ndarray using heu::pylib::PyFloatEncoder, same with hnp.array()

  1. array(self: heu.phe.HeKitPublicBase, ndarray: numpy.ndarray, encoder_params: heu.phe.BatchIntegerEncoderParams) -> heu.numpy.PlaintextArray

Create and encode an array using heu::pylib::PyBatchIntegerEncoderParams

  1. array(self: heu.phe.HeKitPublicBase, object: object, encoder_params: heu.phe.BatchIntegerEncoderParams) -> heu.numpy.PlaintextArray

Encode a numpy ndarray using heu::pylib::PyBatchIntegerEncoderParams

  1. array(self: heu.phe.HeKitPublicBase, ndarray: numpy.ndarray, encoder: heu.phe.BatchIntegerEncoder) -> heu.numpy.PlaintextArray

Create and encode an array using heu::pylib::PyBatchIntegerEncoder, same with hnp.array()

  1. array(self: heu.phe.HeKitPublicBase, object: object, encoder: heu.phe.BatchIntegerEncoder) -> heu.numpy.PlaintextArray

Encode a numpy ndarray using heu::pylib::PyBatchIntegerEncoder, same with hnp.array()

  1. array(self: heu.phe.HeKitPublicBase, ndarray: numpy.ndarray, encoder_params: heu.phe.BatchFloatEncoderParams) -> heu.numpy.PlaintextArray

Create and encode an array using heu::pylib::PyBatchFloatEncoderParams

  1. array(self: heu.phe.HeKitPublicBase, object: object, encoder_params: heu.phe.BatchFloatEncoderParams) -> heu.numpy.PlaintextArray

Encode a numpy ndarray using heu::pylib::PyBatchFloatEncoderParams

  1. array(self: heu.phe.HeKitPublicBase, ndarray: numpy.ndarray, encoder: heu.phe.BatchFloatEncoder) -> heu.numpy.PlaintextArray

Create and encode an array using heu::pylib::PyBatchFloatEncoder, same with hnp.array()

  1. array(self: heu.phe.HeKitPublicBase, object: object, encoder: heu.phe.BatchFloatEncoder) -> heu.numpy.PlaintextArray

Encode a numpy ndarray using heu::pylib::PyBatchFloatEncoder, same with hnp.array()

decryptor(self: heu.numpy.HeKit) heu::lib::numpy::Decryptor#

Get decryptor

encryptor(self: heu.numpy.HeKit) heu::lib::numpy::Encryptor#

Get encryptor

evaluator(self: heu.numpy.HeKit) heu::lib::numpy::Evaluator#

Get evaluator

class heu.numpy.PlaintextArray#
property cols#

Get the number of cols

property ndim#

The array’s number of dimensions

property rows#

Get the number of rows

property shape#

The array’s shape

property size#

Number of elements in the array

to_bytes(self: heu.numpy.PlaintextArray, bytes_per_int: int, endian: str) bytes#

Construct Python bytes containing the raw data bytes in the array.

The endian argument determines the byte order used to represent an integer. To request the native byte order of the host system, use sys.byteorder as the byte order value.

to_numpy(*args, **kwargs)#

Overloaded function.

  1. to_numpy(self: heu.numpy.PlaintextArray, encoder: heu.phe.BigintDecoder = BigintDecoder()) -> numpy.ndarray

Decode plaintext array to numpy ndarray with type ‘object’

  1. to_numpy(self: heu.numpy.PlaintextArray, encoder: heu.phe.IntegerEncoder) -> numpy.ndarray

Decode plaintext array to numpy ndarray with type ‘int64’

  1. to_numpy(self: heu.numpy.PlaintextArray, encoder: heu.phe.FloatEncoder) -> numpy.ndarray

Decode plaintext array to numpy ndarray with type ‘float64’

  1. to_numpy(self: heu.numpy.PlaintextArray, encoder: heu.phe.BatchIntegerEncoder) -> numpy.ndarray

Decode plaintext array to numpy ndarray with type ‘int64’

  1. to_numpy(self: heu.numpy.PlaintextArray, encoder: heu.phe.BatchFloatEncoder) -> numpy.ndarray

Decode plaintext array to numpy ndarray with type ‘float64’

transpose(self: heu.numpy.PlaintextArray) heu.numpy.PlaintextArray#

Transpose the array

class heu.numpy.Shape#
class heu.numpy.StringArray#
property cols#

Get the number of cols

property ndim#

The array’s number of dimensions

property rows#

Get the number of rows

property shape#

The array’s shape

property size#

Number of elements in the array

transpose(self: heu.numpy.StringArray) heu.numpy.StringArray#

Transpose the array

heu.numpy.array(*args, **kwargs)#

Overloaded function.

  1. array(ndarray: numpy.ndarray, encoder: heu.phe.BigintEncoder) -> heu.numpy.PlaintextArray

Create and encode an array using heu::pylib::PyBigintEncoder

  1. array(object: object, encoder: heu.phe.BigintEncoder) -> heu.numpy.PlaintextArray

Encode a numpy ndarray using heu::pylib::PyBigintEncoder

  1. array(ndarray: numpy.ndarray, encoder: heu.phe.IntegerEncoder) -> heu.numpy.PlaintextArray

Create and encode an array using heu::pylib::PyIntegerEncoder

  1. array(object: object, encoder: heu.phe.IntegerEncoder) -> heu.numpy.PlaintextArray

Encode a numpy ndarray using heu::pylib::PyIntegerEncoder

  1. array(ndarray: numpy.ndarray, encoder: heu.phe.FloatEncoder) -> heu.numpy.PlaintextArray

Create and encode an array using heu::pylib::PyFloatEncoder

  1. array(object: object, encoder: heu.phe.FloatEncoder) -> heu.numpy.PlaintextArray

Encode a numpy ndarray using heu::pylib::PyFloatEncoder

  1. array(ndarray: numpy.ndarray, encoder: heu.phe.BatchIntegerEncoder) -> heu.numpy.PlaintextArray

Create and encode an array using heu::pylib::PyBatchIntegerEncoder

  1. array(object: object, encoder: heu.phe.BatchIntegerEncoder) -> heu.numpy.PlaintextArray

Encode a numpy ndarray using heu::pylib::PyBatchIntegerEncoder

  1. array(ndarray: numpy.ndarray, encoder: heu.phe.BatchFloatEncoder) -> heu.numpy.PlaintextArray

Create and encode an array using heu::pylib::PyBatchFloatEncoder

  1. array(object: object, encoder: heu.phe.BatchFloatEncoder) -> heu.numpy.PlaintextArray

Encode a numpy ndarray using heu::pylib::PyBatchFloatEncoder

class heu.numpy.random#
static randbits(schema: heu.phe.SchemaType, bits: int, shape: heu.numpy.Shape) heu.numpy.PlaintextArray#

Return a random integer array where each element is ‘bits’ bits long

static randint(min: heu.phe.Plaintext, max: heu.phe.Plaintext, shape: heu.numpy.Shape) heu.numpy.PlaintextArray#

Return a random integer array from the “discrete uniform” distribution in interval [min, max)

heu.numpy.setup(*args, **kwargs)#

Overloaded function.

  1. setup(schema_type: heu.phe.SchemaType = <SchemaType.ZPaillier: 3>, key_size: int = 2048) -> heu.numpy.HeKit

Setup phe (numpy) environment by schema type and key size

  1. setup(schema_string: str = ‘z-paillier’, key_size: int = 2048) -> heu.numpy.HeKit

Setup phe (numpy) environment by schema string and key size

  1. setup(public_key: heu.phe.PublicKey) -> heu.numpy.DestinationHeKit

Setup phe (numpy) environment by an already generated public key

heu.numpy.tree_predict(arg0: numpy.ndarray[numpy.float64[m, n], flags.c_contiguous], arg1: List[int], arg2: List[float]) numpy.ndarray[numpy.int8[m, n]]#

Compute tree predict based on split features and points.