# how to generate parametrically a matrix of positive determinant

This is not about generating a positive-definite matrix, in which necessarily all eigenvalues are positive. I am interested in an algorithm that can generate any matrix with real entries and positive determinant, even if the matrix has sometimes negative eigenvalues (which should occur in pairs,). The algorithm has some free variables.

Update: why and more context

In a paper (2007, James) "Curve aligment by moments," (here) the author says...

In the case of the warping functions, since they are restricted to be increasing, we can, without loss of generality, reparameterize them using $$W(t)=\gamma_{0}+\int_0^t exp(f(s))ds$$

Then he can use any $f(s)$ (defined using splines later on the paper) to generate a $W(t)$ which is strictly increasing in 1-D, a diffeomorphism in $R$. $f(s)$ is used freely in a optimisation problem later. I couldn't find an analog in $R^n$.

-
I am just curious. Why do you need this? – imranfat Jul 7 '13 at 23:43
Do you have any restriction on the distribution of the output? Otherwise, you could start by genereating an arbitrary, random upper triangular matrix $T$ with positive determinant (which should be way simpler), and then generate an arbitrary invertible matrix $P$ (should also be easier) and return $P^{-1}T P$. – Clement C. Jul 7 '13 at 23:51
Generate an arbitrary matrix. If its determinant is negative, negate one column. If its determinant is zero, try again. – Rahul Jul 7 '13 at 23:55
Rahul's method should actually work fairly well because it is generally unlikely that a matrix of random entries will be singular. Alternatively, instead of negating a column, you could switch two columns. You could do the same with rows as well. – Omnomnomnom Jul 8 '13 at 0:42
If it is about doing this randomly, whatever that means, you need to change your title and edit the question. Otherwise, the parameterization $tI_n$ over $(0,+\infty)$ does the job pretty well. – 1015 Jul 8 '13 at 1:57