Subject: Help with very very slow determinant calcuation
From: Nghia Ho
Date: Mon, 8 Aug 2011 07:50:42 -0700 (PDT)
My maxima script can be downloaded here
http://nghiaho.com/uploads/5point.mac
I call it via load("5point.mac"). It will create matrix Cz and Cz2. Cz is the original symbolic matrix and Cz2 is my attempt at simplifying it by grouping the constants and z terms together.
Apologies in advance for large chunk of repetitive code. I've only learnt to use Maxima recently and have not learnt enough of the syntax to make the code nicer. I used another scripting program to generate part of the Maxima script.
The paper I'm trying to implement is from http://users.cecs.anu.edu.au/~hongdong/new5pt_cameraREady_ver_1.pdf (4 pages). I've reached a point where I'm trying to solve:
det(C(z)) = 0, where C(z) is the 10x10 symbolic matrix. The paper says this determinant is also known as "hidden variable resultant", which I'm unfamiliar with. Beyond that it assumes the reader will know how to solve it.
>________________________________
>From: Richard Fateman <fateman at eecs.berkeley.edu>
>To: Nghia Ho <nghiaho12 at yahoo.com>
>Cc: Barton Willis <willisb at unk.edu>; "maxima at math.utexas.edu" <maxima at math.utexas.edu>
>Sent: Monday, 8 August 2011 11:58 PM
>Subject: Re: [Maxima] Help with very very slow determinant calcuation
>
>
>If the matrix entries are all polynomials in a single variable, say z, then you can use modular arithmetic and the "Chinese Remainder Theorem"
>to find the symbolic determinant, if it is a polynomial of modest
????degree.
>
>You compute the determinant several times modulo prime numbers p1,
????p2, ... , pn.
>Then you use the CRT to determine the polynomial of degree n-1 that
????assumes those values.
>
>This can also work with polys in several variables.?? You have
????managed to not describe your problem
>sufficiently to actually discuss it from a symbolic standpoint.?
????From this standpoint what matters is the
>structural complexity of the entries:? how many variables,
????polynomial or rational, degree, perhaps sparsity.
>It might be easier if you just put the matrix on a file and gave
????people a link to it.? Or perhaps just posted
>it if it is small enough.
>RJF
>On 8/7/2011 6:28 AM, Nghia Ho wrote:
>I think you might be right, I'm probably trying to calculate something very impractical mathematically. I was following an algorithm from a computer vision paper and was hoping to keep everything symbolic so I could write a function that calculates the result in "one shot" (albeit some monstrous equation). The 10x10 matrix that they have ends up having mostly numerical values mixed with a single polynomial symbol (z or z^2), which is probably practical to calculate. Of interest is that they note that higher order polynomial terms (> 10) end up canceling each other out, which made me optimistic that it was possible to keep it all symbolic. But I guess the intermediate steps that Maxima has to do will take an extremely long amount of time before it can do any cancellation of terms.
>>
>>
>>
>>
>>>________________________________
>>>From: Barton Willis <willisb at unk.edu>
>>>To: nghiaho12 at yahoo.com
>>>Cc: bernard at marcade.biz; cladelpino at gmail.com; maxima at math.utexas.edu
>>>Sent: Sunday, 7 August 2011 8:18 PM
>>>Subject: Re: [Maxima] Help with very very slow determinant calcuation
>>>
>>>The cost for the function determinant is comparable to
????????????????the cost of a LU factorization. So, no
>>>computing the determinant by means of the LU
????????????????factorization is unlikely to help. Nghia Ho already
>>>tried setting ratmx to true and newdet. And that's about
????????????????all that might speed up the
>>>calculation.
>>>
>>>For symbolic matrices, the standard big oh time
????????????????estimates are misleading. The time for addition,
>>>for example, isn't constant, but the time depends on the
????????????????complexity of the expressions.
>>>
>>>It's likely that if Maxima was able to find the
????????????????determinant of this 10x10 symbolic matrix, the
>>>result would be so huge that it wouldn't be useful. I
????????????????would suggest a different approach.
>>>
>>>--Barton
>>>
>>>-----maxima-bounces at math.utexas.edu wrote: -----
>>>
>>>Can you elaborate more on how factorizing the matrix can
????????????????help? My background isn't in mathematics, I only did
????????????????basic engineering level maths.
>>>
>>>
>>>
>>>
>>
>>
>>_______________________________________________
Maxima mailing list Maxima at math.utexas.edu http://www.math.utexas.edu/mailman/listinfo/maxima
>
>
>