Page MenuHomec4science

RiskAnalyzer.java
No OneTemporary

File Metadata

Created
Tue, Jan 7, 00:44

RiskAnalyzer.java

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