## Checking for invertibility of large matrices in MAGMA

Open discussion for MAGMA library (Matrix Algebra on GPU and Multicore Architectures)
Daniel_Wilson
Posts: 2
Joined: Tue Sep 11, 2018 9:48 am
Contact:

### Checking for invertibility of large matrices in MAGMA

If you have a number of large matrices, and you wish to determine whether each matrix has determinant zero or not, what is the most efficient way to do this in MAGMA

(it appears that calculating the rank is slightly more efficient than calculating the determinant).

**EDIT: **In case it helps, the matrix entries are rational functions in two commuting variables, which come from the coefficients of a power series in a third, noncommuting variable: the aim is to get some sort of indication of when a power series represents a rational function, which requires checking the determinant of progressively larger matrices until it starts being zero. (Although the overall setting is noncommutative, everything in the matrices themselves is commutative so there's no need to worry about left/right determinants, quasi-determinants, etc.)
Last edited by mgates3 on Mon Sep 17, 2018 10:43 am, edited 2 times in total.

mgates3
Posts: 916
Joined: Fri Jan 06, 2012 2:13 pm

### Re: Checking for invertibility of large matrices in MAGMA

It's unclear if you are using the MAGMA GPU linear algebra library (this forum), or the MAGMA computational algebra software (http://magma.maths.usyd.edu.au/magma/).

In any case, it's usually a bad idea to compute determinants. Computing the rank is a more reliable way to tell if a matrix is (numerically) non-singular. Or do an LU factorization and check whether U has a zero on the diagonal. (Incidentally, the product of the diagonal of U is a reasonable way to compute the determinant of the original matrix A.)

-mark

Daniel_Wilson
Posts: 2
Joined: Tue Sep 11, 2018 9:48 am
Contact:

### Re: Checking for invertibility of large matrices in MAGMA

okay got it sir. thankss for the reply.

mgates3
Posts: 916
Joined: Fri Jan 06, 2012 2:13 pm

### Re: Checking for invertibility of large matrices in MAGMA

Correction: the determinant also requires checking whether the permutation P in ipiv is odd or even. If odd, det(P) = -1, if even, det(P) = +1.
det( A ) = det( P ) * prod( diag( U ) )
But just to check for invertibility, you only need to check that diag( U ) is all non-zero.
-mark