Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97872177
RiskAnalyzer.java
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Jan 7, 00:44
Size
675 B
Mime Type
text/x-java
Expires
Thu, Jan 9, 00:44 (2 d)
Engine
blob
Format
Raw Data
Handle
23424258
Attached To
R3229 Genome Privacy - SHCS App
RiskAnalyzer.java
View Options
package
crypto.elgamal
;
import
java.math.BigInteger
;
public
class
RiskAnalyzer
{
public
static
final
int
PRECISION
=
100
;
public
static
final
BigInteger
PRECISION_BIG_INTEGER
=
BigInteger
.
valueOf
(
PRECISION
);
public
static
FragmentEncrypted
risk
(
FragmentEncrypted
[]
SNPs
,
BigInteger
[]
coefficients
)
{
if
(
SNPs
.
length
!=
coefficients
.
length
)
{
throw
new
ArrayIndexOutOfBoundsException
(
"dimension of fragments and coefficients do not match"
);
}
FragmentEncrypted
result
=
new
FragmentEncrypted
();
for
(
int
i
=
0
;
i
<
SNPs
.
length
;
i
++)
{
result
=
result
.
add
(
SNPs
[
i
].
scale
(
PRECISION_BIG_INTEGER
.
multiply
(
coefficients
[
i
])));
}
return
result
;
}
}
Event Timeline
Log In to Comment