Basic Manipulations of Galois Arrays

Basic array operations on Galois arrays are in the table below. The functionality of these operations is analogous to the MATLAB operations having the same syntax.

OperationSyntax
Index into array, possibly using colon operator instead of a vector of explicit indices a(vector) or a(vector,vector1), where vector and/or vector1 can be ":" instead of a vector
Transpose array a'
Concatenate matrices [a,b] or [a;b]
Create array having specified diagonal elements diag(vector) or diag(vector,k)
Extract diagonal elements diag(a) or diag(a,k)
Extract lower triangular part tril(a) or tril(a,k)
Extract upper triangular part triu(a) or triu(a,k)
Change shape of array reshape(a,k1,k2)

The code below uses some of these syntaxes.

m = 4; a = gf([0:15],m);
a(1:2) = [13 13]; % Replace some elements of the vector a.
b = reshape(a,2,8); % Create 2-by-8 matrix.
c = [b([1 1 2],1:3); a(4:6)]; % Create 4-by-3 matrix.
d = [c, a(1:4)']; % Create 4-by-4 matrix.
dvec = diag(d); % Extract main diagonal of d.
dmat = diag(a(5:9)); % Create 5-by-5 diagonal matrix
dtril = tril(d); % Extract upper and lower triangular
dtriu = triu(d); % parts of d.


© 1994-2005 The MathWorks, Inc.