# Difference between revisions of "ApCoCoA-1:LinAlg.REF"

## LinearAlgebra.REF

compute row echelon form

### Syntax

```LinearAlgebra.REF(M:MAT, CompRREF:BOOL):MAT
LinearAlgebra.REF(M:MAT, P:INT, CompRREF:BOOL):MAT
```

### Description

Please note: The function(s) explained on this page is/are using the ApCoCoAServer. You will have to start the ApCoCoAServer in order to use

it/them.

This function allows you to compute a (reduced) row echelon form of a matrix M defined over a field. If you want to use the first version without the parameter P, the components of the input matrix M must be castable to type RAT and your current working ring must be the same ring over which M has been defined. The second version of this function lets you compute a (reduced) row echelon form of M mod P and the components of M must be of type INT.

The parameter CompRREF lets you specify if you want to compute a row echelon form or the reduced row echelon form of M. If CompRREF is set to TRUE, the reduced row echelon form will be computed, and if it is set to FALSE, a row echelon form where all pivot elements are equal to one will be computed.

The return value of both functions is the computed (reduced) row echelon form of M.

#### Example

```Use Q[x,y];
M := Mat([[ 1/2, 1/3, 2], [200, 3000, 1], [2, 5, 17], [1, 1, 1]]);
M;
LinearAlgebra.REF(M, FALSE);
Mat([
[1/2, 1/3, 2],
[200, 3000, 1],
[2, 5, 17],
[1, 1, 1]
])
-------------------------------
Mat([
[1, 2/3, 4],
[0, 1, -2397/8600],
[0, 0, 1],
[0, 0, 0]
])
-------------------------------

Use Q[x,y];
M := Mat([[ 1, 1, 2], [200, 3000, 1], [2, 5, 17], [1, 1, 1]]);
M;
LinearAlgebra.REF(M, 17, TRUE);
Mat([
[1, 1, 2],
[200, 3000, 1],
[2, 5, 17],
[1, 1, 1]
])
-------------------------------
Mat([
[1, 0, 0],
[0, 1, 0],
[0, 0, 1],
[0, 0, 0]
])
-------------------------------
```