galois.typing.ArrayLike

galois.typing.ArrayLike

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

Union

  • IterableLike: A recursive iterable of iterables of elements.

    In [1]: GF = galois.GF(3**5)
    
    In [2]: GF([[17, 4], [148, 205]])
    Out[2]: 
    GF([[ 17,   4],
        [148, 205]], order=3^5)
    
    # Mix and match integers and strings
    In [3]: GF([["x^2 + 2x + 2", 4], ["x^4 + 2x^3 + x^2 + x + 1", 205]])
    Out[3]: 
    GF([[ 17,   4],
        [148, 205]], order=3^5)
    
  • ndarray: A NumPy array of integers, representing finite field elements in their integer representation.

    In [4]: x = np.array([[17, 4], [148, 205]]); x
    Out[4]: 
    array([[ 17,   4],
           [148, 205]])
    
    In [5]: GF(x)
    Out[5]: 
    GF([[ 17,   4],
        [148, 205]], order=3^5)
    
  • Array: A previously-created Array object. No coercion is necessary.

Alias

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


Last update: May 17, 2022