Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

gflineq

Find particular solution of Ax = b over prime Galois field

Syntax

x = gflineq(A,b)
x = gflineq(A,b,p)
[x,vld] = gflineq(...)

Description

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

x = gflineq(A,b) outputs a particular solution of the linear equation A x = 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.

x = gflineq(A,b,p) returns a particular solution of the linear equation A x = b over GF(p), where p is a prime number. If A is a k-by-n matrix and b is a vector of length k, x is a vector of length n. Each entry of A, x, and b is an integer between 0 and p-1. If no solution exists, x is empty.

[x,vld] = gflineq(...) returns a flag vld that indicates the existence of a solution. If vld = 1, the solution x exists and is valid; if vld = 0, no solution exists.

Examples

The code below produces some valid solutions of a linear equation over GF(3).

A = [2 0 1;
     1 1 0;
     1 1 2];
% An example in which the solutions are valid
[x,vld] = gflineq(A,[1;0;0],3)

The output is below.

x =

     2
     1
     0


vld =

     1

By contrast, the command below finds that the linear equation has no solutions.

[x2,vld2] = gflineq(zeros(3,3),[2;0;0],3)

The output is below.

This linear equation has no solution.

x2 =

     []


vld2 =

     0

More About

collapse all

Algorithms

gflineq uses Gaussian elimination.

See Also

| | | | |

Introduced before R2006a

Was this topic helpful?