I have a big matrix, n! xn !, for which I need to take the qualifier. For each permutation n, we associate
- vector of length 2n (this is easy to calculate)
- polynomial in 2n variables (product of linear factors calculated recursively on n)
The matrix is an evaluation matrix of polynomials in vectors (considered points). Thus, the sigma, tau matrix entry (indexed by permutations) is a polynomial for sigma estimated in the vector for tau.
Example : for n=3 , if the ith polynomial (x1 - 4)(x3 - 5)(x4 - 4)(x6 - 1) , and the j point (2,2,1,3,5,2) , then the (i,j) th element of the matrix will be (2 - 4)(1 - 5)(3 - 4)(2 - 1) = -8 . Here n=3 , so the points are in R^(3!) = R^6 , and the polynomials have 3!=6 variables.
My goal is to determine if the matrix is nonsingular.
My approach right now is this:
point function takes a permutation and prints a vector- the
poly function takes a permutation and produces a polynomial - the
nextPerm function gives the next lexicographic permutation
An abbreviated version of the pseudocode of my code is this:
B := []; P := []; w := [1,2,...,n]; while w <> NULL do B := B append poly(w); P := P append point(w); w := nextPerm(w); od; // BUILD A MATRIX IN MAPLE M := Matrix(n!, (i,j) -> eval(B[i],P[j])); // COMPUTE DETERMINANT IN MAPLE det := LinearAlgebra[Determinant]( M ); // TELL ME IF IT NONSINGULAR if det = 0 then return false; else return true; fi;
I work in Maple using the built-in LinearAlgebra[Determinant] function, but everything else is a custom function using low-level Maple functions (like seq , convert and cat ).
My problem is that it takes too much time and I can endure patience n=7 , but getting n=8 takes a few days. Ideally, I want to be able to get to n=10 .
Does anyone have an idea how I could improve the time? I am open to work in another language, for example. Matlab or C, but would rather find a way to speed it up in Maple.
I understand that it can be difficult to answer without any details, but the code for each function, for example. point and poly are already optimized, so the real question is whether there is a faster way to take the determinant by building the matrix "on the fly" or something like that.
UPDATE: Here are two ideas that I played with that don't work:
I can store polynomials (since they take time to compute, I don’t want to repeat this if I can help) into a vector of length n! , and calculate the points on the fly, and insert these values into the permutation formula for the determinant:

The problem is that this is the size of O(N!) In the size of the matrix, so for my case it will be O((n!)!) . When n=10 , (n!)! = 3,628,800! (n!)! = 3,628,800! that is a way for large ones to even consider doing.
Calculate the determinant using the LU decomposition. Fortunately, the main diagonal of my matrix is non-zero, so this is possible. Since the size of O(N^3) is equal to the size of the matrix, this becomes O((n!)^3) , which is much closer to feasibility. The problem, however, is that it requires me to store the entire matrix, which creates a serious memory load, no matter on time. So that won't work either, at least not without a little smarter. Any ideas?