# Reduced row echelon form

**URL:** https://discourse.julialang.org/t/reduced-row-echelon-form/8656
**Category:** General Usage
**Created:** [January 28, 2018, 8:04pm UTC](https://discourse.julialang.org/t/reduced-row-echelon-form/8656 "2018-01-28T20:04:32Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![harven](https://avatars.discourse-cdn.com/v4/letter/h/3da27b/32.png) [@harven](https://discourse.julialang.org/u/harven)
#### Post date: [January 28, 2018, 8:04pm UTC](https://discourse.julialang.org/t/reduced-row-echelon-form/8656/1 "2018-01-28T20:04:32Z")

</div>

There used to be a `rref` function to put a matrix in reduced row echelon form, but it is not available anymore.  
Is it in some package, or has it been renamed?

---

<div class="post-metadata">

### Author: ![ysimillides](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ysimillides/32/2538_2.png) [@ysimillides](https://discourse.julialang.org/u/ysimillides)
#### Post date: [January 28, 2018, 8:17pm UTC](https://discourse.julialang.org/t/reduced-row-echelon-form/8656/2 "2018-01-28T20:17:57Z")

</div>

[https://github.com/blegat/RowEchelon.jl](https://github.com/blegat/RowEchelon.jl) seems to be what you need 🙂

---

<div class="post-metadata">

### Author: ![harven](https://avatars.discourse-cdn.com/v4/letter/h/3da27b/32.png) [@harven](https://discourse.julialang.org/u/harven)
#### Post date: [January 28, 2018, 8:35pm UTC](https://discourse.julialang.org/t/reduced-row-echelon-form/8656/3 "2018-01-28T20:35:10Z")

</div>

Thanks, that works. Also thanks to B. Legat from Belgium who saved `rref` from the ongoing slimming of Base.

---

<div class="post-metadata">

### Author: ![Paul\_Warburton](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/paul_warburton/32/206802_2.png) [@Paul\_Warburton](https://discourse.julialang.org/u/Paul_Warburton)
#### Post date: [August 20, 2024, 2:32pm UTC](https://discourse.julialang.org/t/reduced-row-echelon-form/8656/4 "2024-08-20T14:32:39Z")

</div>

This code does not work properly under all situations. DO NOT reply on it. I have tested it against Mathematica and with back substitution and it fails occasionally.

---

<div class="post-metadata">

### Author: ![DanielVandH](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/danielvandh/32/31134_2.png) [@DanielVandH](https://discourse.julialang.org/u/DanielVandH)
#### Post date: [August 20, 2024, 2:43pm UTC](https://discourse.julialang.org/t/reduced-row-echelon-form/8656/5 "2024-08-20T14:43:12Z")

</div>

This is a pretty old thread but such a comment is probably better suited as an issue on the associated repo, showing actual cases where the package computes the wrong result. I doubt much will be fixed without an actual example

---

<div class="post-metadata">

### Author: ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)
#### Post date: [August 20, 2024, 3:03pm UTC](https://discourse.julialang.org/t/reduced-row-echelon-form/8656/6 "2024-08-20T15:03:50Z")

</div>

rref form without partial pivoting is well known to be numerically unstable — you can easily contrive cases where roundoff errors blow up (for inexact arithmetic, e.g. standard floating-point arithmetic). (The RowEchelon.jl documentation [acknowledges that it’s “sensitive to numerical imprecision”](https://github.com/blegat/RowEchelon.jl/blob/24ad95db78b9638a11ea4752e992b9151fff1ce2/src/RowEchelon.jl#L47).) rref form is really only useful for pedagogy in comparison to hand calculations for simple cases.

Never use rref form for “serious” numerical calculations — that’s why it’s not included in the LinearAlgebra standard library or in similar libraries (numpy, LAPACK, …). Use LU and other factorizations instead.

---

<div class="post-metadata">

### Author: ![nsajko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nsajko/32/221187_2.png) [@nsajko](https://discourse.julialang.org/u/nsajko)
#### Post date: [August 20, 2024, 6:39pm UTC](https://discourse.julialang.org/t/reduced-row-echelon-form/8656/7 "2024-08-20T18:39:40Z")

</div>

On the other hand, if the _exact_ rref is necessary, AFAIK AbstractAlgebra.jl and/or Nemo.jl provide such functionality.
