10-03-2008 10:44 AM
10-03-2008 11:03 AM - edited 10-03-2008 11:07 AM
ShotSimon wrote:I must be doing something wrong. I went and added another loop to create another parametric parameter ~150,000 x 4 parameters.
Allocating the output array once and doing things "in place" is the right thing to do. Keeping track of the insert point is trivial.
Try this:
10-03-2008 11:09 AM
10-03-2008 11:17 AM
10-03-2008 11:48 AM
ShotSimon wrote:When you get a chance could you explain how you can do things entirely inside the loops?
I am currently on vacation in a hotel room in the middle of nowhere. I'm not sure how much time I'll have in the next few days. 🙂
(I agree, there is way too much duplicate code, still.)
10-05-2008 11:43 AM - edited 10-05-2008 11:44 AM
ShotSimon wrote:When you get a chance could you explain how you can do things entirely inside the loops? That is remove the four initialization loops?
Well, it's quite simple.
Note that these three solutions probably differ somewhat in performance, but it's probably not worth worrying about it unless you need gigantic arrays. Can you guess which one is best? 🙂
10-06-2008 12:58 AM
Oh, btw, you should really change the display format of your controls. It is very annoying to have it display 0 digits of precision, but have the increment set at 0.25. This means that 75% of all presses on the increment/decrement buttons have no visible effect, but still change the data.
(I have not changed this in my versions above.)
10-06-2008 08:54 AM
10-06-2008 09:09 AM
Altenbach,
OK this solution is very good for another reason. If I want to add other parameters, it's simply a matter of increasing the size of the Index and Build Array Functions and adding another Quotient & Remainder Function. This is much easier then adding in FOR loops and such.
I'm still curious how I could make this routine such that if the user added more parameters on the input array it would simple accomidate this and create the corresponding parametric outputs. It seems so close the way it's written.
Sorry I realize I might be driving you nuts, so forgive me in advance -SS
10-06-2008 10:31 AM - edited 10-06-2008 10:39 AM
ShotSimon wrote:I'm still curious how I could make this routine such that if the user added more parameters on the input array it would simple accomidate this and create the corresponding parametric outputs. It seems so close the way it's written.
Anything repetitive can probably be written using an autoindexig FOR loop. 😄
In this particular case the only problem is that we need to reverse the array for the inner loop, but that's probably not such a big deal.
(If you don't reverse, you simply get the solution sorted differently, that might be OK too. Try it!)
Here's a quick draft. Makes sense?
This code is getting more compact with each version... 😉