Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


ID: 17105, Piecewise Functions and Expression Templates

by Carlo Galotto Email: Anonymous


A framework based on Expression Templates that allows to build any kind of Piecewise Functions using a natural analytical sintax.
Download Details
FTP  download also available
CDN Login Required to Download. (You will be redirected to the login page if you click on the Download Link)
To download this, you must have registered:
A free membership

For C++Builder, Version 5.0  to 5.0 217 downloads
Copyright: No significant restrictions


Size: 21,889 bytes
Updated on Mon, 26 Nov 2001 14:47:53 GMT
Originally uploaded on Sun, 25 Nov 2001 06:05:48 GMT
SHA1 Hash: 92725A92F1B8E3BCE0270BEE82EAA0BEE9570BF3
MD5 Hash: 39FDE96A51EE8C6468DB0FE8856F2151

    Explore the files in this upload

Description
The intent of this framework is to use expression templates to build any kind of piecewise functions in a easy and extendible way. Incapsulating all kinds of functions with its paramaters in a class is not an easy deal if you try using the standard callback functions mechanism.
The complexity grows even more in defining the domain of each piece of function.
This framework is complete enough to allow to write directly the piecewise function using a human algebric format almost as you would do on a piece of paper. Here below some examples of how to use the framework

PieseWiceFn fn1( 1/(x-1), x > 1 ); // 1

PieseWiceFn fn2( -x*x + 3.14*x + 1 ); // 2

PieseWiceFn fn3; // 3
fn3.Add( m*x-c, x >= c/m && x < 2*c/m ); // 3.1
fn3.Add( -m*(x-2*c/m)+c, x >= 2*c/m && x <= 3*c/m ); // 3.2

double y = fn1(1.4); // 4

in //1 the domain of x is every real (double) number greather than 1.
in //2 domain of x is every real number
in //3 and the followings we build a parameterised (m, c) triangle function.
in //4 the function fn3 is evaluated for x equal to 1.4

For more information, see http://digilander.iol.it/galotto

   Latest Comments  View All Add New

Move mouse over comment to see the full text

Could not retrieve comments. Please try again later.

Server Response from: ETNACDC04