-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fbc2bd4
commit ebd4441
Showing
2 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package fhetest.Generate | ||
|
||
import fhetest.LibConfig | ||
import fhetest.Utils.* | ||
|
||
def mulDepthIsSmall(realMulDepth: Int, configMulDepth: Int): Boolean = | ||
realMulDepth < configMulDepth | ||
|
||
def firstModSizeIsLargest(firstModSize: Int, scalingModSize: Int): Boolean = | ||
scalingModSize <= firstModSize | ||
|
||
def modSizeIsUpto60bits(firstModSize: Int, scalingModSize: Int): Boolean = | ||
(firstModSize <= 60) && (scalingModSize <= 60) | ||
|
||
def ringDimIsPowerOfTwo(n: Int): Boolean = (n > 0) && ((n & (n - 1)) == 0) | ||
|
||
def plainModIsPositive(m: Int): Boolean = m > 0 | ||
|
||
def plainModEnableBatching(m: Int, n: Int): Boolean = (m % n) == 1 | ||
|
||
def lenIsLessThanRingDim(len: Int, n: Int, scheme: Scheme): Boolean = | ||
scheme match { | ||
case Scheme.CKKS => len <= (n / 2) | ||
case _ => len <= n | ||
} | ||
|
||
def boundIsLessThanPowerOfModSize( | ||
bound: Int | Double, | ||
firstModSize: Int, | ||
): Boolean = bound match { | ||
case intBound: Int => intBound < math.pow(2, firstModSize) | ||
case doubleBound: Double => doubleBound < math.pow(2, firstModSize) | ||
} |