galois.typing.IterableLike

A Union representing iterable objects that can be coerced into a Galois field array.

Union

  • Sequence [ ElementLike ]: An iterable of elements.

    In [1]: GF = galois.GF(3**5)
    
    In [2]: GF([17, 4])
    Out[2]: GF([17,  4], order=3^5)
    
    # Mix and match integers and strings
    In [3]: GF([17, "x + 1"])
    Out[3]: GF([17,  4], order=3^5)
    
    In [4]: GF = galois.GF(3**5, display="poly")
    
    In [5]: GF([17, 4])
    Out[5]: GF([α^2 + 2α + 2,        α + 1], order=3^5)
    
    # Mix and match integers and strings
    In [6]: GF([17, "x + 1"])
    Out[6]: GF([α^2 + 2α + 2,        α + 1], order=3^5)
    
    In [7]: GF = galois.GF(3**5, display="power")
    
    In [8]: GF([17, 4])
    Out[8]: GF([α^222,  α^69], order=3^5)
    
    # Mix and match integers and strings
    In [9]: GF([17, "x + 1"])
    Out[9]: GF([α^222,  α^69], order=3^5)
    
  • Sequence [ IterableLike ]: A recursive iterable of iterables of elements.

    In [10]: GF = galois.GF(3**5)
    
    In [11]: GF([[17, 4], [148, 205]])
    Out[11]: 
    GF([[ 17,   4],
        [148, 205]], order=3^5)
    
    # Mix and match integers and strings
    In [12]: GF([["x^2 + 2x + 2", 4], ["x^4 + 2x^3 + x^2 + x + 1", 205]])
    Out[12]: 
    GF([[ 17,   4],
        [148, 205]], order=3^5)
    
    In [13]: GF = galois.GF(3**5, display="poly")
    
    In [14]: GF([[17, 4], [148, 205]])
    Out[14]: 
    GF([[             α^2 + 2α + 2,                     α + 1],
        [ α^4 + 2α^3 + α^2 + α + 1, 2α^4 + α^3 + α^2 + 2α + 1]], order=3^5)
    
    # Mix and match integers and strings
    In [15]: GF([["x^2 + 2x + 2", 4], ["x^4 + 2x^3 + x^2 + x + 1", 205]])
    Out[15]: 
    GF([[             α^2 + 2α + 2,                     α + 1],
        [ α^4 + 2α^3 + α^2 + α + 1, 2α^4 + α^3 + α^2 + 2α + 1]], order=3^5)
    
    In [16]: GF = galois.GF(3**5, display="power")
    
    In [17]: GF([[17, 4], [148, 205]])
    Out[17]: 
    GF([[α^222,  α^69],
        [ α^54,  α^24]], order=3^5)
    
    # Mix and match integers and strings
    In [18]: GF([["x^2 + 2x + 2", 4], ["x^4 + 2x^3 + x^2 + x + 1", 205]])
    Out[18]: 
    GF([[α^222,  α^69],
        [ α^54,  α^24]], order=3^5)
    

Alias

alias of Union[Sequence[Union[int, str, Array]], Sequence[IterableLike]]