Radial2Seldon

This functions have been written in the spirit to incorporate additional functions in the library Seldon. This is a preliminary version, feel free to make any suggestion: jantoniomex@gmail.com

All the functions provided work only for dense vectors and matrices, further work to cover a major class of matrices are begin undertaken by the authors of Radial++ and Seldon. The original idea of the implementations for the next functions was taken from Blitz++ and suggested by Vivien Mallet, the author of Seldon.

We provide approximately 40 functions which cover the classical math functions, overloaded arithmetic operators and some additional specialized functions. Clearly, we do not code explicitly all the functions, we use template metaprogramming to define in compilation time the necessary instations of the functions.

How to include in Seldon

Just download Radial++ and copy the folder radial2seldon in your prefered path. Also, in your application include the header “radial2seldon.h” and provide to the compiler the path where the folder radial2seldon is.

Elementary Math Functions

The following functions operate pointwise with vector or matrix: Vector <-- function ( Vector ) Matrix <-- function ( Matrix ) where the classical pointwise functions are:

sin sine
sinh hyperbolic sine
asin inverse sine
cos cosine
cosh hyperbolic cosine
acos inverse cosine
tan tangent
tanh hyperbolic tangent
atan inverse tangent
exp exponential
log natural lograrithm
log10 logarithm base 10
sqrt square root
ceil smallest integer not less than the ceil argument
floor largest integer not greater than the floor argument
fabs absolute value
pow2(x) return x*x
pow3(x) return x*x*x
pow4(x) return x*x*x*x

Note

In your programs, it is possible to define your own pointwise functions, for example to perform the pointwise evaluation: sin(x) + cos(x)*sin(x) over a vector or matrix, we define:

template
T myFunc(T x)
{
return sin(x) + cos(x)*sin(x);
}

SELDON_DEFINE_FUNC(myFunc)

int main(void)
{
Vector x,y;
y = myFunc(x);
.....
}

Overloaded Arithmetic Operators

The following functions are not designed for high performance computing, we did not use expression templates, metaprogramming or delayed evaluations like Blitz++ or Matrix Template Library. Further work to diminish this drawback is begin undertaken. However, the next operators can be used for fast prototyping without sacrify readibility in the programs.

The overloaded binary arithmetic operators for Vector and Matrices are:

Vector <-- Vector +/- Vector
Vector <-- Vector +/- T
Vector <-- T +/- Vector
Vector <-- Vector^T pointwise like “.^” in Octave

Matrix <-- Matrix +/- Matrix
Matrix <-- Matrix +/- T
Matrix <-- T +/- Matrix

Matrix <-- Matrix * Vector
Matrix <-- Matrix * Matrix

where T is a scalar not necessarily of the same data type of the vector or matrix.

Functions

Also, we provide the following useful functions:

pdot similar to '.*' in Octave
linspace generate linearly spaced vectors
logspace generate logarithmically spaced vectors
max get the maximun value
min get the minimun value