Discussion Groups | Comp.Arch.Embedded | Free Software Anywhere to Calculate Determinant of 4x4 Matrix with Elements in [-2^31, 2^31-1]?

There are 4 messages in this thread.

You are currently looking at messages 1 to 4.

So far in May, you have voted 0 times ou of a total of 20 votes by the community.

Free Software Anywhere to Calculate Determinant of 4x4 Matrix with Elements in [-2^31, 2^31-1]? - David T. Ashley - 2012-07-18 15:37:00

```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
```

Re: Free Software Anywhere to Calculate Determinant of 4x4 Matrix with Elements in [-2^31, 2^31-1]? - Tim Wescott - 2012-07-18 16:45:00

```On Wed, 18 Jul 2012 15:37:50 -0400, David T. Ashley wrote:

> 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

Scilab and Octave, but I couldn't guarantee that they'll do better than
64-bit floating point arithmetic.  So if getting the thing precise down
to +/- 1LSB is important, they wouldn't do.

--
My liberal friends think I'm a conservative kook.
My conservative friends think I'm a liberal kook.
Why am I not happy that they have found common ground?

Tim Wescott, Communications, Control, Circuits & Software
http://www.wescottdesign.com
```

Re: Free Software Anywhere to Calculate Determinant of 4x4 Matrix with Elements in [-2^31, 2^31-1]? - Mel Wilson - 2012-07-18 17:24:00

```David T.  Ashley wrote:

> 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.

python and numpy could do it.  See
<http://stackoverflow.com/questions/462500/can-i-get-the-matrix-determinant-
by-numpy> , for instance.

Mel.

```

Re: Free Software Anywhere to Calculate Determinant of 4x4 Matrix with Elements in [-2^31, 2^31-1]? - 2012-07-19 15:03:00

```On Wednesday, July 18, 2012 2:37:50 PM UTC-5, David T. Ashley wrote:
> I&#39;m unit-testing embedded code that calculates the determinant of 4x4
> matrices with elements that are 32-bit signed integers.
>
> The method I&#39;m using in the embedded code is the standard cofactor
> expansion, so the result is exact.
>
> Per Hadamard&#39;s inequality, I&#39;m using 160-bit signed arithmetic.
>
> Just so I don&#39;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&#39;ll be using the GMP and a C program to generate test vectors, but
> I&#39;d like an &quot;independent&quot; program to double-check the program that I&#39;m
> using to generate the test vectors.
>
> I&#39;ve had good luck with &quot;bc&quot; for some large integer arithmetic test
> cases, but I don&#39;t believe &quot;bc&quot; will do matrix determinants.
>
> Thanks, Dave Ashley

You might try the 'calc' mode in emacs.  I believe it can do what you want.
```