shared3p_statistics_common.sc
shared3p_statistics_common.sc
Module with statistics support functions that are useful primarily in other statistics modules.
Functions:
contingencyTable
Create a contingency table.
Detailed Description
D - all protection domains |
Supported types - uint32 / uint64 |
Parameters
data |
- input vector |
cases |
- vector indicating which elements of data belong to cases |
controls |
- vector indicating which elements of data belong to controls |
codeBook |
- matrix used for coding the answer. The first row contains expected values of the input vector and the second row contains the classes that these values will be put into. The classes should be consecutive and begin from 1. |
returns a contingency table in the format |
|
None |
cut
Remove unavailable elements.
Detailed Description
D - shared3p protection domain |
Supported types - bool / uint8 / uint16 / uint32 / uint / int8 / int16 / int32 / int64 / float32 / float64 / xor_uint8 / xor_uint16 / xor_uint32 / xor_uint64 |
Parameters
data |
- input vector |
isAvailable |
- vector indicating which elements of the input vector are available |
returns a vector where elements of the input vector have been removed if the corresponding element in isAvailable is zero. |
Leaks the number of true values in isAvailable |
Function Overloads
D bool cut(D bool[[1]] data, D bool[[1]] isAvailable)
D uint8 cut(D uint8[[1]] data, D bool[[1]] isAvailable)
D uint16 cut(D uint16[[1]] data, D bool[[1]] isAvailable)
D uint32 cut(D uint32[[1]] data, D bool[[1]] isAvailable)
D uint64 cut(D uint64[[1]] data, D bool[[1]] isAvailable)
D int8 cut(D int8[[1]] data, D bool[[1]] isAvailable)
D int16 cut(D int16[[1]] data, D bool[[1]] isAvailable)
D int32 cut(D int32[[1]] data, D bool[[1]] isAvailable)
D int64 cut(D int64[[1]] data, D bool[[1]] isAvailable)
D float32 cut(D float32[[1]] data, D bool[[1]] isAvailable)
D float64 cut(D float64[[1]] data, D bool[[1]] isAvailable)
D xor_uint8 cut(D xor_uint8[[1]] data, D bool[[1]] isAvailable)
D xor_uint16 cut(D xor_uint16[[1]] data, D bool[[1]] isAvailable)
D xor_uint32 cut(D xor_uint32[[1]] data, D bool[[1]] isAvailable)
D xor_uint64 cut(D xor_uint64[[1]] data, D bool[[1]] isAvailable)
cut(multiple samples)
Remove unavailable elements from N samples using the same shuffling key.
Detailed Description
D - shared3p protection domain |
Supported types - int32 / int64 / float32 / float64 |
Parameters
data |
- input matrix. Each column is a sample. |
isAvailable |
- vector indicating which elements of the input samples are available. Has to have as many elements as there are rows in the data matrix. |
Leaks the number of true values in isAvailable |
Function Overloads
D int32 cut(D int32[[2]] data, D bool[[1]] isAvailable)
D int64 cut(D int64[[2]] data, D bool[[1]] isAvailable)
D uint32 cut(D uint32[[2]] data, D bool[[1]] isAvailable)
D uint64 cut(D uint64[[2]] data, D bool[[1]] isAvailable)
D float32 cut(D float32[[2]] data, D bool[[1]] isAvailable)
D float64 cut(D float64[[2]] data, D bool[[1]] isAvailable)
nthElement
Find the nth element in size from a vector.
Detailed Description
D - shared3p protection domain |
Supported types - int32 / int64 |
Parameters
data |
- input vector |
k |
- index of the value’s rank (starts from 0) |
shuffle |
- indicates if the input vector should be shuffled before running the algorithm. Shuffling is necessary to hide the execution flow but if the input vector has already been shuffled it’s unnecessary. |
returns the nth element in size of the input vector. |
Does not leak anything if the input is shuffled Leaks the number of equal elements if the input is not shuffled |