# Singular

#### D.10.2.11 genMDSMat

Procedure from library `decodegb.lib` (see decodegb_lib).

Usage:
genMDSMat(n, a); n is int, a is number
 ``` - n x n are dimensions of the MDS matrix, - a is a primitive element of the field. ```

Note:
An MDS matrix is constructed in the following way. We take 'a' to be a generator of the multiplicative group of the field. Then we construct the Vandermonde matrix with this 'a'.

Assume:
extension field should already be defined

Return:
a matrix with the MDS property.

Example:
 ```LIB "decodegb.lib"; int q=16; int n=15; ring r=(q,a),x,dp; //generate an MDS (Vandermonde) matrix matrix h_full=genMDSMat(n,a); print(h_full); ==> 1,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ==> 1,a, a2, a3, a4, a5, a6, a7, a8, a9, a10,a11,a12,a13,a14, ==> 1,a2, a4, a6, a8, a10,a12,a14,a, a3, a5, a7, a9, a11,a13, ==> 1,a3, a6, a9, a12,1, a3, a6, a9, a12,1, a3, a6, a9, a12, ==> 1,a4, a8, a12,a, a5, a9, a13,a2, a6, a10,a14,a3, a7, a11, ==> 1,a5, a10,1, a5, a10,1, a5, a10,1, a5, a10,1, a5, a10, ==> 1,a6, a12,a3, a9, 1, a6, a12,a3, a9, 1, a6, a12,a3, a9, ==> 1,a7, a14,a6, a13,a5, a12,a4, a11,a3, a10,a2, a9, a, a8, ==> 1,a8, a, a9, a2, a10,a3, a11,a4, a12,a5, a13,a6, a14,a7, ==> 1,a9, a3, a12,a6, 1, a9, a3, a12,a6, 1, a9, a3, a12,a6, ==> 1,a10,a5, 1, a10,a5, 1, a10,a5, 1, a10,a5, 1, a10,a5, ==> 1,a11,a7, a3, a14,a10,a6, a2, a13,a9, a5, a, a12,a8, a4, ==> 1,a12,a9, a6, a3, 1, a12,a9, a6, a3, 1, a12,a9, a6, a3, ==> 1,a13,a11,a9, a7, a5, a3, a, a14,a12,a10,a8, a6, a4, a2, ==> 1,a14,a13,a12,a11,a10,a9, a8, a7, a6, a5, a4, a3, a2, a ```