April 27, 2024, 10:40:05 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Timing Matrix Inversions

Started by danbaron, August 17, 2009, 10:59:36 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

danbaron

August 17, 2009, 10:59:36 PM Last Edit: August 17, 2009, 11:26:32 PM by danbaron

Hi Gang!

Attached, is an EB console program that uses the Gauss-Jordan method to
invert matrices.

For an N x N matrix, you set the value of the program constant, N.

All of the matrices used in the program are static. Each time you change
the value of N, you must re-compile the program.

When the program executes, the N x N matrix is randomly filled with
DOUBLEs, in the range of (-1000, 1000).

Then, the matrix is inverted.

The time to invert the matrix is calculated, and displayed in the
console window.

After the inversion, a check is made to determine if the inversion is
correct.

Let's call the original matrix, "A", and its inversion, "A'".

After the inversion, we have both A and A', i.e., the inversion does not
overwrite A.

In order to check the inversion, we multiply A and A'. Their product
should be the N x N identity matrix, "I".

We then multiply a vector of length N, with all values set equal to 1, by
the I we calculated.

According to the properties of the identity matrix, the multiplication
should not alter the vector, i.e., every value should still equal 1.

The check vector is written to a text file, so that you can verify that
the inversion worked. If all of the vector's values are very close to 1,
then the inversion is good. The elapsed time is also written to the text
file.

There is a lot of text in the code, that explains the Gauss-Jordan
method, and what is generally going on.

Nuf sed.

DTB.
"You can't cheat an honest man. Never give a sucker an even break, or smarten up a chump."  -  W.C. Fields

LarryMc

LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

danbaron


I was going to tell you, that you look like Larry, but I didn't know if I should.

Why don't you grow out your hair?

Shemp   :(  >:(  8)  :)  :D

"You can't cheat an honest man. Never give a sucker an even break, or smarten up a chump."  -  W.C. Fields

LarryMc

My hair only gets all frizzy when Mo slaps me.

Larry

PS we're sort of off topic and its my fault.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

danbaron


I like that picture.

It reminds me of Ricky Nelson.

Ozzie.  :D
"You can't cheat an honest man. Never give a sucker an even break, or smarten up a chump."  -  W.C. Fields

LarryMc

Close to the right time.
I was 17 and a senior in high school.
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library