473,320 Members | 1,694 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

overhead reduction/Array's

Hello every one, I am new to the forum and have limited C++ knowledge but I have plenty of guts and many questions, I need some help if you can spare the time....

I am working on a project in which calls successively a function to which builds a matrix evaluated at a certain value, lets say: void function(&A,N,M,x), where N and M are the # of row/column specifiers and x the evaluation variable and A being the memory allocated array(my own class definition). Each array index pair represents a different polynomial function of x. I am looking to reduce the overhead of my existing code (which calls this function many times). What I want is to build an array (just once) with each array component having a different polynomial as a function of x, then throughout my code evaluate different array members for different x values, hence keeping me from recalling a function in which builds the whole array over again.

//Re-stating

I could just call (or point to) the array index A(k,p) at a certain value of x(i) (where x(1) != x(2) != x(3)...and so on) instead of having to re-use a function call to build the whole array over in which that whole array is evaluated at x and thereby waisting memory/time due to the fact that at that x(i) I just needed one array component evaluated at that x(i) . I am sure some one who has more knowledge can let me in on how this can be done......

I hope I was clear

Thanks

BW
Oct 17 '06 #1
2 1666
Banfa
9,065 Expert Mod 8TB
I hope I was clear
To be honest no you weren't.

If you are calculating and recalculating an array of data and you want to decrease the overhead of doing this then what you need to do is store the array in some persistent data and calculate the data once at start up (or at least only when ever the controling data changes).

There are a number of ways to do this

1. Global data, that is frowned upon as poor quality though

2. Put it into a relevent existing class

3. Create a new class for it, if fact you could make the class such that it saves the controling data and you call the function to create the array with the controlling data every time as you currently do but it the new controlling data is the same as that already held then it doesn't bother with the array recalculation it just returns.
Oct 17 '06 #2
thanks for your reply..., #3 is what I am currently doing, I am sorry for the foggy question, clear questions come from clear knowledge of the subject.

thank you again
Oct 18 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Richard | last post by:
Hi all, I am looking for some help on understanding the overhead associated with object creation in Java. I am writing an application where I have written a class to encapsulate some text...
0
by: jason | last post by:
Hi - this post overlaps with another post (Tom K was helping) but has a differnt slant and explanation which I feel warrants a new post..... If one has a series of price reduction fields (3) and...
2
by: david | last post by:
Well, as a matter of fact I_HAD_MISSED a basic thing or two, anyway, although Ollie's answer makes perfectly sense when dealing with classes, it doesn't seem to me to apply as well if you have to...
5
by: apm | last post by:
Any and all: Is there an efficient way to pass a large array from .NET to COM? Can references (or pointer) be passed from COM to NET and NET to COM without the object it refers to being copied?...
9
by: Chris | last post by:
Wondering the best way of storing my data. This is data pulled and stored in the database but a lot of data manipulation goes on the client side. I never have to remove items but will sometimes...
19
by: Tom Jastrzebski | last post by:
Hello, I was just testing VB.Net on Framework.Net 2.0 performance when I run into the this problem. This trivial code attached below executed hundreds, if not thousand times faster in VB 6.0...
10
by: dfetrow410 | last post by:
Is there an example of how to store and access an array in a Property Dave
8
by: james | last post by:
Hi, Just looking here: http://msdn2.microsoft.com/en-us/library/9b9dty7d.aspx I can't quite see what I want to do. I want an array of Booleans of length 102, all initially "false". I have this...
272
by: Peter Olcott | last post by:
http://groups.google.com/group/comp.lang.c++/msg/a9092f0f6c9bf13a I think that the operator() member function does not work correctly, does anyone else know how to make a template for making two...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.