Basic4ppc - Windows Mobile Development  

Go Back   Basic4ppc - Windows Mobile Development > Main Category > Questions & Help Needed
Home Register FAQ Members List Search Today's Posts Mark Forums Read

Questions & Help Needed Post any question regarding Basic4ppc.


Eigenvalue and Eigenvector calculation


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-19-2007, 06:14 PM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Switzerland
Posts: 671
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default Eigenvalue and Eigenvector calculation

Hello,
Does somebody have a routine to calculate eigenvalues and eigenvectors of real non symetric matrices ?

I have an old one, with several goto's in, but Basic4ppc does'nt like these goto's.
I have another one but it is not acurate enough.


I need this routine for a program which calculates eigenfrequencies and eigenvectors of mecanical systems.
I added some screenshots of the program. The user draws, directly on the screen, the model composed of reference points, springs and masses, introduces the values of the different elements and makes the calculation.

If there is any interest in this program I can submit to the forum.

Thank's in advance.

Klaus
Switzerland
Attached Images
File Type: jpg FreqModel.jpg (19.1 KB, 26 views)
File Type: jpg FreqResults.jpg (20.9 KB, 22 views)
File Type: jpg FreqData.jpg (17.5 KB, 18 views)
Reply With Quote
  #2 (permalink)  
Old 11-19-2007, 06:19 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,690
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

Quote:
Originally Posted by klaus View Post
I have an old one, with several goto's in, but Basic4ppc does'nt like these goto's
I assume that it is in Basic. Can't you restucture it to run under B4PPC? If not then post the source and someone here might have a go!
Reply With Quote
  #3 (permalink)  
Old 11-19-2007, 07:30 PM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Switzerland
Posts: 671
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

Hello agraham.
You will find the Basic4ppc and VisualBasic source code at
http://http://www.basic4ppc.com/foru...ead.php?t=1164

Best regards and thank you
Klaus
Reply With Quote
  #4 (permalink)  
Old 11-20-2007, 01:27 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,690
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

Here you are Klaus. The program is so appalling that I didn't bother to restructure it as I don't understand the program flow. I have been as minimally invasive as I can and have replaced the three For...Next loops that were causing the trouple with synthesised versions - you can easily see where as I have commented out the original code and put a line of "####################" at each location.

I think that I have not altered the calculation in any way but you must run your own cross-checks to make sure.
Attached Files
File Type: sbp TestEigenFixed.sbp (20.4 KB, 15 views)
Reply With Quote
  #5 (permalink)  
Old 11-21-2007, 10:13 AM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Switzerland
Posts: 671
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

Hello agraham
Thank you very much for your help, I will check the routine with different matrices, higher order ones and perhaps more specific.
I will keep you informed.
Klaus
Reply With Quote
  #6 (permalink)  
Old 11-22-2007, 02:06 PM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Switzerland
Posts: 671
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

Hello agraham

I tested the routine with higher order matrices and it works well, where the other routine I have failes.

Thank you once again for your precious help

Klaus
Reply With Quote
  #7 (permalink)  
Old 01-19-2008, 05:11 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,690
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

Hi Klaus. I saw in the German forum that your Eigenvalue code doesn't work under the optimising compiler. You should have let me know! Having got it to work before I will not let you down. Version attached that does work. One label ( m2100: ) was out of scope so I moved it and "Do .. Loop" at about line 625 is not valid for the new compiler so I replaced it with a "Do While true .. Loop". Changes commented as before. Usual caveats about testing but the example gives the same results compiled as in the IDE.
Attached Files
File Type: sbp TestEigenFixedV6.sbp (20.6 KB, 5 views)
Reply With Quote
  #8 (permalink)  
Old 01-20-2008, 08:47 AM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Switzerland
Posts: 671
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

Hello agraham,
This is really good news, I was afraid that with the Goto restrictions of new compiler it would have been much more difficult to make the Eigenvalue routine run again, so I left it besides. Yes I should have let you know about it.

I introduced your modifications in the whole program and of course it works fine.
Speed incease about 8 times, the calculation of an 18*18 matrix takes 5min, yes 300 sec, with the old compiler and now 37 sec. That's a very big improvement !

Thank you very very much for your help. This shows again the big value of this forum.
I have updated the program.
Natural frequency calculation of mechanical structures

Klaus
Switzerland
Reply With Quote
  #9 (permalink)  
Old 01-20-2008, 11:20 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 1,690
Awards Showcase
Beta Tester Forum Contributer 
Total Awards: 2
Default

Quote:
Originally Posted by klaus View Post
and now 37 sec. That's a very big improvement !
I guess that your program uses a lot of arrays containing numeric data. Try declaring those arrays as doubles, this overrides B4PPCs' weak typing, and see if that shaves a few more seconds off the execution time
Code:
Dim someArray(someSize) As double
Reply With Quote
  #10 (permalink)  
Old 01-21-2008, 07:29 AM
klaus's Avatar
Basic4ppc Expert
 
Join Date: Oct 2007
Location: Switzerland
Posts: 671
Awards Showcase
Beta Tester Competition Winner 
Total Awards: 2
Default

Hello agraham,
Thank you for your advice.
It's done and brings 7 sec more time saving.

Best regards
Klaus
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Easter Day (calculation algorithm) maXim Code Samples & Tips 2 03-19-2008 05:01 PM
Natural frequency calculation of mechanical structures klaus Share Your Creations 4 12-01-2007 02:49 PM
Natural frequency calculation of mechanical structures klaus Share Your Creations 0 11-29-2007 06:09 PM


All times are GMT. The time now is 06:31 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0