np.linalg.solve

np.linalg.solve(x)[source]

Solves the system of linear equations.

References

Examples

In [1]: GF = galois.GF(31)

In [2]: A = GF.Random((4,4)); A
Out[2]: 
GF([[13, 14, 30,  0],
    [14,  2, 10, 15],
    [ 0, 15, 21,  0],
    [ 2, 29, 15, 19]], order=31)

In [3]: b = GF.Random(4); b
Out[3]: GF([19,  1, 29, 18], order=31)

In [4]: x = np.linalg.solve(A, b); x
Out[4]: GF([10,  8,  6, 27], order=31)

In [5]: A @ x
Out[5]: GF([19,  1, 29, 18], order=31)
In [6]: GF = galois.GF(31)

In [7]: A = GF.Random((4,4)); A
Out[7]: 
GF([[17, 25, 14, 16],
    [12, 21,  1,  4],
    [18,  8, 21, 29],
    [22,  7, 30,  7]], order=31)

In [8]: B = GF.Random((4,2)); B
Out[8]: 
GF([[26, 26],
    [16, 22],
    [12, 29],
    [28, 24]], order=31)

In [9]: X = np.linalg.solve(A, B); X
Out[9]: 
GF([[18,  5],
    [27, 16],
    [16, 20],
    [29, 10]], order=31)

In [10]: A @ X
Out[10]: 
GF([[26, 26],
    [16, 22],
    [12, 29],
    [28, 24]], order=31)