-
Notifications
You must be signed in to change notification settings - Fork 14
/
calcPLbyFunc.m
38 lines (31 loc) · 1.11 KB
/
calcPLbyFunc.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
%=========================================
% This function calculate the incremental privacy leakag, i.e. L(a), by L(a) function.
%
% 05-Dec-2017 author: Yang Cao
%-----------------inputs-----------------
% a: the previous BPL or the next FPL
% aArrMax: vector, contains transition points,defines domains on each segment of L(a)
% qArrMax: vector, contains values of q, defines parameters of L(a)
% dArrMax: vector, contains values of d, defines parameters of L(a)
%-----------------outputs-----------------
% maxPL: maximum incremental privacy leakage L(a)
% q,d: two scalars that satisfy Theorem 4 in our TKDE paper
%=========================================
function [maxBPL, q, d] = calcPLbyFunc(a, aArrMax, qArrMax, dArrMax)
% aArrMax = evalin('base', 'aArrMax');
% qArrMax = evalin('base', 'qArrMax');
% dArrMax = evalin('base', 'dArrMax');
if isempty(aArrMax)
maxBPL = 0;
q=0;
d=0;
else
if a>aArrMax(end)
error('a should be in the range of aArrMax');
end
idx = sum(aArrMax<a)+1;
q=qArrMax(idx);
d=dArrMax(idx);
maxBPL = log( (q*(exp(a)-1)+1)/(d*(exp(a)-1)+1));
end
end