MakeModularExponentiationError
public enum MakeModularExponentiationError : Error
Errors throwed by Gate.makeModularExponentiation(base:modulus:exponent:inputs:)
-
Throwed when
base
is 0 (or less). First, this implementation only works with a positivebase
. It also has to be different from 0 because ifbase
is 0, the modulo is always 0 which would end up producing a non-unitary matrixDeclaration
Swift
case baseHasToBeBiggerThanZero
-
Throwed if
inputs
is an empty listDeclaration
Swift
case inputsCanNotBeAnEmptyList
-
Throwed when
modulus
is 1 (or less). First, this implementation only works with a positivemodulus
. It also has to be different from 0 because we can not divide by 0. And it can not be 1 because, regardless ofbase
, the modulo of 1 is always 0 which would end up producing a non-unitary matrixDeclaration
Swift
case modulusHasToBeBiggerThanOne
-
Throwed if it was not possible to build a unitary matrix with the provided
modulus
, most likely becausemodulus
is a power ofbase
Declaration
Swift
case modulusProducesANonUnitaryMatrix