![]() |
Jun 2 2008, 02:00 PM
Post
#1
|
|
![]() Extremely Active Premium Member ![]() Posts: 271 Joined: 8-January 07 From: Geneva Member No.: 7452 Using LabVIEW Since:1999 LV:8.5.1 ,7.1.1 ,5.1
My Gallery
|
Hi all,
A friend of mine recently dragged me into the Euler Project, anyone here is spending his nights doing it as well ? By the way, LabVIEW is not in the default "language list" -------------------- ____________________________________________________________________________________
It's better to stay out of the rat race because if you win, you're still a rat _____________________________________________________________________________________ Tags
This content has not been tagged yet
|
|
|
|
| Ad |
Jun 2 2008, 02:00 PM
Post
#
|
|
|
Tags
This content has not been tagged yet
|
|
|
|
Jun 2 2008, 03:03 PM
Post
#2
|
|
|
4 more posts to go! NI ![]() Posts: 6 Joined: 16-June 07 From: Austin, TX Member No.: 8734 Using LabVIEW Since:2006 LV:8.5 ,. ,.
|
Hi all, A friend of mine recently dragged me into the Euler Project, anyone here is spending his nights doing it as well ? By the way, LabVIEW is not in the default "language list" I've been a fan of it for a while, and it's good to see someone else doing the problems with LabVIEW. Just out of curiosity, how have you been handling the questions that require (or encourage) using big integers? For example, try to find 1000! in LabVIEW. Chris M Tags
This content has not been tagged yet
|
|
|
|
Jun 2 2008, 03:15 PM
Post
#3
|
|
|
Very Active Member Posts: 239 Joined: 30-December 05 Member No.: 3786 Using LabVIEW Since:1998 LV:8.5 ,8.20 ,7.1
|
-------------------- "Whether they be the musician cats in my band or the real cats of the world, they all got style." -Ray Charles
Tags
This content has not been tagged yet
|
|
|
|
Jun 2 2008, 04:49 PM
Post
#4
|
|
![]() LV R&D Envoy NI ![]() Posts: 1144 Joined: 15-August 06 From: Austin, TX Member No.: 5877 Using LabVIEW Since:2000 LV:8.5.1 ,. ,.
My Gallery
|
For example, try to find 1000! in LabVIEW. Here's how: http://forums.lavag.org/index.php?s=&s...post&p=5194 You might also follow up with this link: http://forums.lavag.org/index.php?s=&s...post&p=5190 -------------------- "A VI outside a class is a gun without a safety. Data outside a class is a target."
--- A message from LabVOOP R&D Tags
This content has not been tagged yet
|
|
|
|
Jun 3 2008, 03:09 PM
Post
#5
|
|
![]() Very Active Member Posts: 66 Joined: 11-October 07 From: Atlanta, GA Member No.: 9577 Using LabVIEW Since:2001 LV:7.1 ,. ,.
|
Wow, that's some beautiful code!
-------------------- Jim
![]() Tags
This content has not been tagged yet
|
|
|
|
Jun 3 2008, 06:02 PM
Post
#6
|
|
![]() Very Active Member Posts: 126 Joined: 29-October 04 From: Vancouver, B.C. Member No.: 932 Using LabVIEW Since:1998 LV:8.5.1 ,7.1.1 ,.
|
LabVIEW is now in the language list.
Jaegen -------------------- "Duck was a neutral party, so he brought the ultimatum to the cows." -- Click, Clack, Moo: Cows That Type
Tags
This content has not been tagged yet
|
|
|
|
Jun 3 2008, 11:55 PM
Post
#7
|
|
![]() Very Active Member Posts: 66 Joined: 11-October 07 From: Atlanta, GA Member No.: 9577 Using LabVIEW Since:2001 LV:7.1 ,. ,.
|
Antoine,
Thank you for introducing me to this fascinating challenge. My wife would not thank you BTW Jaegen, are you farmilliar with a company named ISE in Port Coquitlam? This post has been edited by JiMM: Jun 3 2008, 11:57 PM
Attached File(s)
-------------------- Jim
![]() Tags
This content has not been tagged yet
|
|
|
|
Jun 4 2008, 06:39 AM
Post
#8
|
|
![]() Extremely Active Premium Member ![]() Posts: 271 Joined: 8-January 07 From: Geneva Member No.: 7452 Using LabVIEW Since:1999 LV:8.5.1 ,7.1.1 ,5.1
My Gallery
|
LabVIEW is now in the language list. Jaegen That's cool ! QUOTE Antoine, Thank you for introducing me to this fascinating challenge. My wife would not thank you I hope I'm putting you into trouble I started the Euler projet with the same intent : improving my LabVIEW skills. The first solution I found for problem 3 is quite slow as well, now that I saw the above linked code I will try to get inspired and improve my subVIs because it's easy to draw a solution that WILL find the solution but not untill the end of the universe ! Don't have time right now to have a look at your code, but I will. EDIT : I tested the prime factor VI that won the coding challenge on NI Forums, it takes 2ms to find the solution of prob 3 Cheers -------------------- ____________________________________________________________________________________
It's better to stay out of the rat race because if you win, you're still a rat _____________________________________________________________________________________ Tags
This content has not been tagged yet
|
|
|
|
Jun 4 2008, 08:40 AM
Post
#9
|
|
![]() Extremely Active Premium Member ![]() Posts: 271 Joined: 8-January 07 From: Geneva Member No.: 7452 Using LabVIEW Since:1999 LV:8.5.1 ,7.1.1 ,5.1
My Gallery
|
Antoine, [...] I would love to hear any suggestions as to how to improve it's efficiency. I am not looking for fancy mathematical insights (won't help future projects). I have a solution, it's just slow (~4.5 minutes). What I am interested to learn is how to improve the code using more efficient LabVIEW practices. Thanks for any insights! I can't open you VI What version of LabVIEW did you use ? Can you repost it please ? -------------------- ____________________________________________________________________________________
It's better to stay out of the rat race because if you win, you're still a rat _____________________________________________________________________________________ Tags
This content has not been tagged yet
|
|
|
|
Jun 4 2008, 09:47 PM
Post
#10
|
|
![]() Very Active Member Posts: 66 Joined: 11-October 07 From: Atlanta, GA Member No.: 9577 Using LabVIEW Since:2001 LV:7.1 ,. ,.
|
The first posted version was in LV8. I now have two revised versions. The first (Euler3_Take2.vi) fixes blatent errors in my first attempt - like I eliminated testing of even numbers (DUH!). That dropped execution to ~2.3 minutes. The third version (Euler3_VJT.vi) uses a theory that to test N for primality you only need to check for divisibility by all of the primes up to N/2. Not the route I was really looking for because it relies on number theory rather than programming efficiency, but interesting to try. That one dropped execution time to 1.2 minutes. And used up my lunch hour rather than a night
This post has been edited by JiMM: Jun 4 2008, 09:48 PM
Attached File(s)
-------------------- Jim
![]() Tags
This content has not been tagged yet
|
|
|
|
Jun 4 2008, 10:32 PM
Post
#11
|
|
|
Extremely Active Premium Member ![]() Posts: 426 Joined: 2-February 05 From: Southern California Member No.: 1519 Using LabVIEW Since:2004 LV:8.20 ,7.1.1 ,8.0.1
|
The first posted version was in LV8. I now have two revised versions. The first (Euler3_Take2.vi) fixes blatent errors in my first attempt - like I eliminated testing of even numbers (DUH!). That dropped execution to ~2.3 minutes. The third version (Euler3_VJT.vi) uses a theory that to test N for primality you only need to check for divisibility by all of the primes up to N/2. Not the route I was really looking for because it relies on number theory rather than programming efficiency, but interesting to try. That one dropped execution time to 1.2 minutes. And used up my lunch hour rather than a night Math efficiency is going to be a large part of keeping the speed down. A slow mathematical algorithm will be slow no matter have programmatically efficient you make it. My wife would not thank you I don't know if my wife would appreciate me starting up. It does look fun though. Tags
This content has not been tagged yet
|
|
|
|
Jun 4 2008, 10:58 PM
Post
#12
|
|
![]() Very Active Member Posts: 66 Joined: 11-October 07 From: Atlanta, GA Member No.: 9577 Using LabVIEW Since:2001 LV:7.1 ,. ,.
|
Math efficiency is going to be a large part of keeping the speed down. A slow mathematical algorithm will be slow no matter have programmatically efficient you make it. Oh, there is no doubt that knowing tricks of the mathematical trade will help solve those problems more efficiently. As is seen by the version thatn only looks to the smaller primes for divisibility. But I was not looking to set records. I am meerly looking for insights from better LabVIEW programmers as to how I can optimize my use of arrays, loops etc. Trying to polish my toolbox, and improve my ability to use it I don't know if my wife would appreciate me starting up. It does look fun though. It is interesting to both solve the problem, and then say "how can I do this better?" At work I to often get in the mode of solve the problem and move on. If it works, the boss doesn't care (or notice) if it's elegant, or efficient. This post has been edited by JiMM: Jun 4 2008, 10:59 PM -------------------- Jim
![]() Tags
This content has not been tagged yet
|
|
|
|
Jun 6 2008, 01:51 AM
Post
#13
|
|
![]() Very Active Member Posts: 66 Joined: 11-October 07 From: Atlanta, GA Member No.: 9577 Using LabVIEW Since:2001 LV:7.1 ,. ,.
|
Holy Mackerel! I am stunned by how fast the Coding Chalenge winner did this. Of course it was obvious that clever math tactics would be necessary to minimize time, but .... just WOW. I got less than 1ms with that VI on my PC. AMAZING!
This post has been edited by JiMM: Jun 6 2008, 01:52 AM -------------------- Jim
![]() Tags
This content has not been tagged yet
|
|
|
|
Jun 9 2008, 07:55 AM
Post
#14
|
|
![]() Extremely Active Premium Member ![]() Posts: 271 Joined: 8-January 07 From: Geneva Member No.: 7452 Using LabVIEW Since:1999 LV:8.5.1 ,7.1.1 ,5.1
My Gallery
|
Holy Mackerel! I am stunned by how fast the Coding Chalenge winner did this. Of course it was obvious that clever math tactics would be necessary to minimize time, but .... just WOW. I got less than 1ms with that VI on my PC. AMAZING! I had a quick look at your VI "IsPrime.vi", one thing you can improve is the number of time you run the loop to see if the tested number is prime ; it's no use to test a prime divisor if it is bigger than the square root of the tested number EDIT : My solution takes less than 2 secondes on my old laptop and it is not really different rom yours A few other advices to improve performance : - avoid to use "build array" primitive, - avoid cohersion dots, - inline code. One interesting hit I found, in my solution there is one subVI, if I inline the code to have only one VI, it runs faster ~10% ; I guess this is due to the way LabVIEW passes inputs to callees and outputs to callers.
Attached File(s)
-------------------- ____________________________________________________________________________________
It's better to stay out of the rat race because if you win, you're still a rat _____________________________________________________________________________________ Tags
This content has not been tagged yet
|
|
|
|
Jun 9 2008, 08:59 PM
Post
#15
|
|
![]() Extremely Active Premium Member ![]() Posts: 333 Joined: 19-June 07 From: Everett, WA Member No.: 8758 Using LabVIEW Since:2007 LV:8.5 ,8.2.1 ,.
|