Tabulated values for a function

A

aaronfude

Hi,

This is not really a C/C++ question. Suppose I have a function double
f(double x) that takes a long time to compute. Is there a tool
available that would take this function and would generate C/C++ code
for this function which operates via tabulated values?
Thanks


Aaron Fude
 
V

Victor Bazarov

This is not really a C/C++ question.

There is no such thing as "a C/C++ question". It's either a C question
or a C++ question.
Suppose I have a function double
f(double x) that takes a long time to compute. Is there a tool
available that would take this function and would generate C/C++ code

There is no such thing as "C/C++ code". It's either C code or it's C++
code.
for this function which operates via tabulated values?

There are several tools on the market that can do something like that.
They are OT here, however. Try alt.sci.math.mathematica.

V
 
E

E. Robert Tisdale

This is not really a C/C++ question.

Try sci.math.num-analysis.
Suppose I have a function double f(double x)
f(double x) that takes a long time to compute.
Is there a tool available that would take this function
and would generate C/C++ code for this function
which operates via tabulated values?

No.


I used Google

http://www.google.com/

to search for

+"interpolation" +"C++"

and I found lots of stuff including

http://www.mathtools.net/C_C__/Fitting_and_Interpolation/
 
T

Thomas Matthews

Hi,

This is not really a C/C++ question. Suppose I have a function double
f(double x) that takes a long time to compute. Is there a tool
available that would take this function and would generate C/C++ code
for this function which operates via tabulated values?
Thanks


Aaron Fude

Many complex functions are implemented as table lookups.
Some use interpolation others are direct lookups. Often
times, this is a trade of speed for memory / code space.

--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.comeaucomputing.com/learn/faq/
Other sites:
http://www.josuttis.com -- C++ STL Library book
http://www.sgi.com/tech/stl -- Standard Template Library
 
A

aaronfude

Thomas said:
Many complex functions are implemented as table lookups.
Some use interpolation others are direct lookups. Often
times, this is a trade of speed for memory / code space.

Hi Thomas,

Thank you for such a useful response. Do you know if "sin" is
implemented as a lookup in libm? In either case, can you point me to a
C/C++ example of a funciton implemented as a lookup with interpolation?
Uh, sorry, C or C++ example. :)

Thank you!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top