Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » sci.math.* » sci.math.independent

Topic: Free Software Anywhere to Calculate Determinant of 4x4 Matrix with Elements in [-2^31, 2^31-1]?
Replies: 7   Last Post: Jul 22, 2012 12:58 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Dirk Van de moortel

Posts: 41
Registered: 12/6/11
Re: Free Software Anywhere to Calculate Determinant of 4x4 Matrix with Elements in [-2^31, 2^31-1]?
Posted: Jul 20, 2012 2:53 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Dirk Van de moortel <dirkvandemoortel@hotspam.not> wrote in message
juc809$hdb$1@speranza.aioe.org
> David T. Ashley <dashley@gmail.com> wrote in message
> kn3e085gdev6f8m2iv1mrha4m7t66kbkgb@4ax.com

> > I'm unit-testing embedded code that calculates the determinant of
> > 4x4 matrices with elements that are 32-bit signed integers.
> >
> > The method I'm using in the embedded code is the standard cofactor
> > expansion, so the result is exact.
> >
> > Per Hadamard's inequality, I'm using 160-bit signed arithmetic.
> >
> > Just so I don't make the same mistake in my program that generates
> > the unit test vectors as I do in my embedded code, is there any
> > free software out there that will calculate large determinants?
> >
> > I'll be using the GMP and a C program to generate test vectors,
> > but I'd like an "independent" program to double-check the program
> > that I'm using to generate the test vectors.
> >
> > I've had good luck with "bc" for some large integer arithmetic
> > test cases, but I don't believe "bc" will do matrix determinants.
> >
> > Thanks, Dave Ashley

>
> Check PARI at http://pari.math.u-bordeaux.fr/
>
> Dirk Vdm


I tried my version 2.2.9 (December 2004) of PARI GP.
For instance:
a = [ 1,0,0,0 ; 0,2,0,0 ; 0,0,3,0 ; 0,0,0,4 ]
matdet(a)
produces
24
:-)

From the help:
(20:49) gp > ? matdet
matdet(x,{flag=0}): determinant of the matrix x using Gauss-Bareiss.
If (optional) flag is set to 1, use classical gaussian elimination (slightly
better for integer entries)

Dirk Vdm






Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2013. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.