IdentityKeySwitching((𝐚,b),𝐊𝐒)
roundoffset = 1 << (32 - (1 + basebit * t)) //四捨五入のため
b̄=b
𝐚̄ = 0⃗
for i from 0 to t-1
for j from 0 to kN - 1
âᵢⱼ = ((aⱼ+roundoffset)>> (32 - (i+1)⋅basebit))&(2ᵇᵃˢᵉᵇⁱᵗ - 1)
for i from t-1 to 0
for j from 0 to kN-1
if âᵢⱼ ≥ 2ᵇᵃˢᵉᵇⁱᵗ⁻¹
âᵢⱼ -= 2ᵇᵃˢᵉᵇⁱᵗ
â₍ᵢ₋₁₎ⱼ += 1
(𝐚̄,b̄) -= âᵢⱼ ⋅ KSᵢⱼ
return (𝐚̄,b̄)
IdentityKeySwitching((𝐚,b),𝐊𝐒)
roundoffset = 1 << (32 - (1 + basebit * t)) //四捨五入のため
b̄=b
𝐚̄ = 0⃗
for i from 0 to t-1
for j from 0 to kN - 1
âᵢⱼ = ((aⱼ+roundoffset)>> (32 - (i+1)⋅basebit))&(2ᵇᵃˢᵉᵇⁱᵗ - 1)
for i from t-1 to 0
for j from 0 to kN-1
if âᵢⱼ ≥ 2ᵇᵃˢᵉᵇⁱᵗ⁻¹
âᵢⱼ -= 2ᵇᵃˢᵉᵇⁱᵗ
â₍ᵢ₋₁₎ⱼ += 1
k = abs(âᵢⱼ)
if âᵢⱼ > 0
(𝐚̄,b̄) -= KSᵢⱼₖ
else if âᵢⱼ < 0
(𝐚̄,b̄) += KSᵢⱼₖ
return (𝐚̄,b̄)
page_number: true