External Issue: LU factoring fails for matrices without full rank in some cases

16581, “CaptainSharf”, “LU factoring fails for matrices without full rank in some cases”, “2020-10-13T06:57:10Z”

Summary of Problem

LU factoring fails sometimes for matrices without full rank, giving inf and nan values for some positions.

Steps to Reproduce

Source Code:

use LinearAlgebra;
var dom = {1..3,1..3};
var arr:[dom] real;
arr[1,1] = 1.0;
arr[1,2] = 2.0;
arr[1,3] = 3.0;
arr[2,1] = 4.0;
arr[2,2] = 5.0;
arr[2,3] = 6.0;
arr[3,1] = 8.0;
arr[3,2] = 10.0;
arr[3,3] = 12.0;
var (LU,ipiv) = lu(arr);

writeln("Given matrix\n",arr);
writeln("Pivots\n",ipiv);
writeln("LU from custom\n",LU);

Compile command:
chpl -I/usr/local/opt/openblas/include -L/usr/local/opt/openblas/lib -lblas LUTest.chpl

Execution command:
./LUTest

Output

Given matrix
1.0 2.0 3.0
4.0 5.0 6.0
8.0 10.0 12.0

Pivots
3 2 1

LU from custom
8.0 10.0 12.0
0.5 0.0 0.0
0.125 inf nan