// Usuall mathematical functions and operations on arrays // R. Ansari, C.Magneville 03/2000 #include "machdefs.h" #include #include "matharr.h" // ---------------------------------------------------- // Application d'une fonction // ---------------------------------------------------- template TArray& MathArray::ApplyFunctionInPlace(TArray & a, Arr_DoubleFunctionOfX f) { T * pe; uint_8 j,k; if (a.AvgStep() > 0) { // regularly spaced elements uint_8 step = a.AvgStep(); uint_8 maxx = a.Size()*step; pe = a.Data(); for(k=0; k TArray& MathArray::ApplyFunctionInPlace(TArray & a, Arr_FloatFunctionOfX f) { T * pe; uint_8 j,k; if (a.AvgStep() > 0) { // regularly spaced elements uint_8 step = a.AvgStep(); uint_8 maxx = a.Size()*step; pe = a.Data(); for(k=0; k TArray MathArray::ApplyFunction(TArray const & a, Arr_DoubleFunctionOfX f) { TArray ra; ra = a; ApplyFunctionInPlace(ra, f); return(ra); } template TArray MathArray::ApplyFunction(TArray const & a, Arr_FloatFunctionOfX f) { TArray ra; ra = a; ApplyFunctionInPlace(ra, f); return(ra); } /////////////////////////////////////////////////////////////// #ifdef __CXX_PRAGMA_TEMPLATES__ #pragma define_template MathArray #pragma define_template MathArray #endif #if defined(ANSI_TEMPLATES) || defined(GNU_TEMPLATES) template class MathArray; template class MathArray; #endif