Contenuto principale

gflineq

R2026b

Find particular solution of ax = b over prime Galois field

Description

x = gflineq(a,b) outputs a particular solution of the linear equation where a multiplied by x is equal to b in GF(2). The elements in a, b and x are either 0 or 1. If the equation has no solution, then x is empty.

example

x = gflineq(a,b,p) returns a particular solution of the linear equation where a multiplied by x is equal to b over GF(p),

[x,tf] = gflineq(___) returns a flag tf that indicates the existence of a solution.

Examples

collapse all

Consider a Galois Field (GF) with three elements.

A = [2 0 1;
     1 1 0;
     1 1 2];

Use gflineq to find a solution.

[x,tf] = gflineq(A,[1;0;0],3)
x = 3×1

     2
     1
     0

tf = 
1

This means the solution is valid over GF(3).

Input Arguments

collapse all

Coefficients of a system of linear equations, specified as a k-by-n matrix.

Data Types: double

Right hand side vector of equations, specified as a n-element vector.

Data Types: double

Prime number, specified as a scalar prime number.

Data Types: double

Output Arguments

collapse all

Solution for linear equation ax = b, returned as a row vector. If a is a k-by-n matrix and b is a vector of length k, x is a vector of length n. If no solution exists, x is empty.

True or false result, returned as logical 1 (true) or logical 0 (false) indicating existence of a valid solution.

Data Types: logical

Tips

  • This function performs computations in GF(pm) where p is a prime number. To work in GF(2m), apply the \ or / operator to Galois arrays. For details, see Solving Linear Equations.

Algorithms

gflineq uses Gaussian elimination.

Version History

Introduced before R2006a

See Also

| | | | |