Skip to content
Draft
5 changes: 5 additions & 0 deletions .github/workflows/github-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
run:
shell: bash
strategy:
fail-fast: false
matrix:
# TODO: shared builds
package_build: [ON, OFF]
Expand All @@ -50,6 +51,10 @@ jobs:
hexl: ON
steps:
- uses: actions/checkout@v2
- name: System Check
run: |
clang --version
gcc -v
- run: |
set -x
env
Expand Down
26 changes: 13 additions & 13 deletions src/EncryptedArray.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Copyright (C) 2012-2020 IBM Corp.
/* Copyright (C) 2012-2022 Intel Corp.
* This program is Licensed under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
Expand Down Expand Up @@ -707,32 +707,32 @@ void runningSums(const EncryptedArray& ea, Ctxt& ctxt)

void totalSums(const EncryptedArray& ea, Ctxt& ctxt)
{
long n = ea.size();
long n = ea.size(); // slot-count

if (n == 1)
return;

Ctxt orig = ctxt;

long k = NTL::NumBits(n);
long b = NTL::NumBits(n);
long e = 1;

for (long i = k - 2; i >= 0; i--) {
Ctxt tmp1 = ctxt;
ea.rotate(tmp1, e);
ctxt += tmp1; // ctxt = ctxt + (ctxt >>> e)
for (long i = b - 2; i >= 0; i--) {

Ctxt tmp1 = orig;
helib::rotate(tmp1, e);
orig += tmp1;
e = 2 * e;

if (NTL::bit(n, i)) {
Ctxt tmp2 = orig;
ea.rotate(tmp2, e);
ctxt += tmp2; // ctxt = ctxt + (orig >>> e)
// NOTE: we could have also computed
// ctxt = (ctxt >>> e) + orig, however,
// this would give us greater depth/noise
helib::rotate(tmp2, 1);
tmp2 += ctxt;
orig = tmp2;
e += 1;
}
}
ctxt = orig;
}

// Linearized polynomials.
Expand Down
2 changes: 2 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ if (NOT ONLY_ADD_TEST)
"TestClonedPtr.cpp"
"TestContext.cpp"
"TestCtxt.cpp"
"TestEncryptedArray.cpp"
"TestErrorHandling.cpp"
"TestHEXL.cpp"
"TestLogging.cpp"
Expand Down Expand Up @@ -148,6 +149,7 @@ set(TEST_NAMES
"TestClonedPtr"
"TestContext"
"TestCtxt"
"TestEncryptedArray"
"TestErrorHandling"
"TestFatBootstrappingWithMultiplications"
"TestHEXL"
Expand Down
Loading