Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/main/scala/io/github/acl4s/Convolution.scala
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private def butterfly[M <: Int](a: Array[ModInt[M]])(using m: Modulus[M]): Unit
while (len < h) {
if (h - len == 1) {
val p = 1 << (h - len - 1)
val rot = ModInt(1)
var rot = ModInt(1)
foreach(0 until (1 << len))(s => {
val offset = s << (h - len)
foreach(0 until p)(i => {
Expand All @@ -101,7 +101,7 @@ private def butterfly[M <: Int](a: Array[ModInt[M]])(using m: Modulus[M]): Unit
} else {
// 4-base
val p = 1 << (h - len - 2)
val rot = ModInt(1)
var rot = ModInt(1)
val imag = info.root(2)
foreach(0 until (1 << len))(s => {
val rot2 = rot * rot
Expand Down Expand Up @@ -139,7 +139,7 @@ private def butterflyInv[M <: Int](a: Array[ModInt[M]])(using m: Modulus[M]): Un
while (len > 0) {
if (len == 1) {
val p = 1 << (h - len)
val iRot = ModInt(1)
var iRot = ModInt(1)
foreach(0 until (1 << (len - 1)))(s => {
val offset = s << (h - len + 1)
foreach(0 until p)(i => {
Expand All @@ -156,7 +156,7 @@ private def butterflyInv[M <: Int](a: Array[ModInt[M]])(using m: Modulus[M]): Un
} else {
// 4-base
val p = 1 << (h - len)
val iRot = ModInt(1)
var iRot = ModInt(1)
val iImag = info.iRoot(2)
foreach(0 until (1 << (len - 2)))(s => {
val iRot2 = iRot * iRot
Expand Down Expand Up @@ -279,8 +279,8 @@ final class FftInfo[M <: Int] private (using m: Modulus[M]) {
})

{
val prod = ModInt(1)
val iProd = ModInt(1)
var prod = ModInt(1)
var iProd = ModInt(1)
foreach(0 to (rank2 - 2))(i => {
rate2(i) = root(i + 2) * prod
iRate2(i) = iRoot(i + 2) * iProd
Expand All @@ -289,8 +289,8 @@ final class FftInfo[M <: Int] private (using m: Modulus[M]) {
})
}
{
val prod = ModInt(1)
val iProd = ModInt(1)
var prod = ModInt(1)
var iProd = ModInt(1)
foreach(0 to (rank2 - 3))(i => {
rate3(i) = root(i + 3) * prod
iRate3(i) = iRoot(i + 3) * iProd
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/io/github/acl4s/FenwickTree.scala
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ object AddSub {
override def subtract(a: ModInt1000000007, b: ModInt1000000007): ModInt1000000007 = a - b
}

given [T <: Int](using m: Add[StaticModInt[T]]): AddSub[StaticModInt[T]] with {
given [T <: Int](using m: Add[StaticModInt[T]], _mod: Modulus[T]): AddSub[StaticModInt[T]] with {
override def e(): StaticModInt[T] = m.e()
override def combine(a: StaticModInt[T], b: StaticModInt[T]): StaticModInt[T] = m.combine(a, b)
override def subtract(a: StaticModInt[T], b: StaticModInt[T]): StaticModInt[T] = a - b
Expand Down
Loading