Timing attack against DES 0.1
|
The pcc library, a software library dedicated to the computation of estimates of Pearson Correlation Coefficients (PCC). More...
Go to the source code of this file.
Functions | |
void | pcc_s2s (float *pcc, int samples_length, int ny, float *x, int **y) |
The `pcc_s2s` (s2s for scalar-to-scalar) function estimates the PCC between a floating point random variable \(X\) and a set of \(ny\) integer random variables \(Y_n, 0\le n<ny\), based on samples of each. More... | |
void | pcc_v2s (float **pcc, int samples_length, int vectors_length, int ny, float **x, int **y) |
The `pcc_v2s` (v2s for vector-to-scalar) function estimates the PCC between a vector floating point random variable (denoted \(X\)) and a set of \(ny\) scalar integer random variables \(Y_n, 0\le n<ny\), based on samples of each. More... | |
The pcc library, a software library dedicated to the computation of estimates of Pearson Correlation Coefficients (PCC).
Defines functions to estimate Pearson Correlation Coefficients (PCC) between a random variable \(X\) and a set of \(ny\) random variables \(Y_n, 0\le n<ny\).
These coefficients are statistical tools to evaluate the correlation between random variables. The formula of a PCC between random variables \(X\) and \(Y\) is: \(PCC(X,Y) = [E(X\times Y) - E(X)\times E(Y)] / [\sigma(X)\times\sigma(Y)]\) where \(E(Z)\) is the expectation of random variable \(Z\) and \(\sigma(Z)\) is its standard deviation. The value of the PCC is in range -1 to +1. Values close to 0 indicate no or a weak correlation. Values close to -1 or +1 indicate strong correlations.
void pcc_s2s | ( | float * | pcc, |
int | samples_length, | ||
int | ny, | ||
float * | x, | ||
int ** | y | ||
) |
The `pcc_s2s` (s2s
for scalar-to-scalar) function estimates the PCC between a floating point random variable \(X\) and a set of \(ny\) integer random variables \(Y_n, 0\le n<ny\), based on samples of each.
The sample of \(X\) is passed as an array x
of float
values where x[i]
is the i
-th realization in the sample. The samples of the \(Y_n\) are passed as an array of \(ny\) arrays of int
values where y[n][i]
is the i
-th realization in the sample of \(Y_n\). The length of the samples must be specified and set to the smallest of all samples' lengths. The extra realizations in larger samples, if any, are ignored.
Example of use with samples of length 1000 and 4 \(Y_n\) variables. get_next_x
and get_next_y(n)
are two functions returning realizations of the \(X\) and \(Y_n\) random variables, respectively:
If there is only one single \(Y\) variable the code can be silghtly simplified:
Note that, if \(ny>1\), using \(ny\) times this second version is not equivalent to using only once the first version because many operations involving only \(X\) would be re-computated \(ny\) times. If \(ny>1\) always prefer the first version, it is far more efficient.
pcc | array of result PCCs, pcc[n] = \(PCC(X,Y_n)\) |
samples_length | length of smallest sample |
ny | number of \(Yn\) random variables |
x | \(X\) sample, x[i] = i-th realization of \(X\) |
y | \(Y_n\) samples, y[n][i] = i-th realization of \(Yn\) |
void pcc_v2s | ( | float ** | pcc, |
int | samples_length, | ||
int | vectors_length, | ||
int | ny, | ||
float ** | x, | ||
int ** | y | ||
) |
The `pcc_v2s` (v2s
for vector-to-scalar) function estimates the PCC between a vector floating point random variable (denoted \(X\)) and a set of \(ny\) scalar integer random variables \(Y_n, 0\le n<ny\), based on samples of each.
Each realization of \(X\) is thus itself an array of float
components. Pearson coefficients are computed component-wise of \(X\) and the results are vectors of PCC estimates: \(PCC(X,Y_n)[i]=PCC(X[i],Y_n), 0\le i<\lvert X\rvert, 0\le n<ny\). The sample of \(X\) is passed as an array of arrays of float
values where x[i][j]
is the j
-th component of the i
-th realization in the sample of \(X\). The samples of the \(Y_n\) are passed as an array of \(ny\) arrays of int
values where y[n][i]
is the i
-th realization in the sample of \(Y_n, 0\le n<ny\). The length of the samples must be specified and set to the smallest of all samples' lengths. The extra realizations in larger samples, if any, are ignored. Example of use with 500-components vectors, samples of length 1000 and 4 \(Y_n\) variables. get_next_x(j)
and get_next_y(n)
are two functions returning realizations of the j
-th component of \(X\) and of \(Y_n\), respectively:
pcc | array of arrays of result PCCs, pcc[n][j] = j-th component of \(PCC(X,Y_n)\) |
samples_length | number of realizations in each sample |
vectors_length | length of \(X\) vector random variable |
ny | number of \(Yi\) random variables |
x | X sample, x[i][j] = j-th component of i-th realization of \(X\) |
y | Y sample, y[n][i] = i-th realization of \(Y_n\) |