X-Git-Url: https://scm.cri.ensmp.fr/git/Faustine.git/blobdiff_plain/1059e1cc0c2ecfa237406949aa26155b6a5b9154..66f23d4fabf89ad09adbd4dfc15ac6b5b2b7da83:/interpretor/preprocessor/faust-0.9.47mr3/architecture/math.lib diff --git a/interpretor/preprocessor/faust-0.9.47mr3/architecture/math.lib b/interpretor/preprocessor/faust-0.9.47mr3/architecture/math.lib deleted file mode 100644 index 759bba6..0000000 --- a/interpretor/preprocessor/faust-0.9.47mr3/architecture/math.lib +++ /dev/null @@ -1,184 +0,0 @@ -/************************************************************************ - ************************************************************************ - FAUST library file - Copyright (C) 2003-2011 GRAME, Centre National de Creation Musicale - --------------------------------------------------------------------- - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU Lesser General Public License as - published by the Free Software Foundation; either version 2.1 of the - License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. - ************************************************************************ - ************************************************************************/ - -declare name "Math Library"; -declare author "GRAME"; -declare copyright "GRAME"; -declare version "1.0"; -declare license "LGPL"; - -//-------------------------------------------------------------------------------- -// Mathematic library for Faust - -// Implementation of the math.h file as Faust foreign functions -// -// History -// ---------- -// 28/06/2005 [YO] postfixed functions with 'f' to force float version -// instead of double -// [YO] removed 'modf' because it requires a pointer as argument -//--------------------------------------------------------------------------------- - -// -- Utilities and constants - -SR = min(192000, max(1, fconstant(int fSamplingFreq, ))); -BS = fvariable(int count, ); - -PI = 3.1415926535897932385; - -// -- neg and inv functions - -neg(x) = -x; -inv(x) = 1/x; - -// -- Trigonometric Functions - -//acos = ffunction(float acosf (float), , ""); -//asin = ffunction(float asinf (float), , ""); -//atan = ffunction(float atanf (float), , ""); -//atan2 = ffunction(float atan2f (float, float), , ""); - -//sin = ffunction(float sinf (float), , ""); -//cos = ffunction(float cosf (float), , ""); -//tan = ffunction(float tanf (float), ,""); - -// -- Exponential Functions - -//exp = ffunction(float expf (float), ,""); -//log = ffunction(float logf (float), ,""); -//log10 = ffunction(float log10f (float), ,""); -//pow = ffunction(float powf (float, float), ,""); -//sqrt = ffunction(float sqrtf (float), ,""); -cbrt = ffunction(float cbrtf (float), ,""); -hypot = ffunction(float hypotf (float, float), ,""); -ldexp = ffunction(float ldexpf (float, int), ,""); -scalb = ffunction(float scalbf (float, float), ,""); -log1p = ffunction(float log1pf (float), ,""); -logb = ffunction(float logbf (float), ,""); -ilogb = ffunction(int ilogbf (float), ,""); -expm1 = ffunction(float expm1f (float), ,""); - -// -- Hyperbolic Functions - -acosh = ffunction(float acoshf (float), , ""); -asinh = ffunction(float asinhf (float), , ""); -atanh = ffunction(float atanhf (float), , ""); - -sinh = ffunction(float sinhf (float), , ""); -cosh = ffunction(float coshf (float), , ""); -tanh = ffunction(float tanhf (float), ,""); - -// -- Remainder Functions - -//fmod = ffunction(float fmodf (float, float),,""); -//remainder = ffunction(float remainderf (float, float),,""); - -// -- Nearest Integer Functions - -//floor = ffunction(float floorf (float), ,""); -//ceil = ffunction(float ceilf (float), ,""); -//rint = ffunction(float rintf (float), ,""); - -// -- Special Functions - -erf = ffunction(float erff(float), ,""); -erfc = ffunction(float erfcf(float), ,""); -gamma = ffunction(float gammaf(float), ,""); -J0 = ffunction(float j0f(float), ,""); -J1 = ffunction(float j1f(float), ,""); -Jn = ffunction(float jnf(int, float), ,""); -lgamma = ffunction(float lgammaf(float), ,""); -Y0 = ffunction(float y0f(float), ,""); -Y1 = ffunction(float y1f(float), ,""); -Yn = ffunction(float ynf(int, float), ,""); - - -// -- Miscellaneous Functions - -//fabs = ffunction(float fabsf (float), ,""); -//fmax = ffunction(float max (float, float),,""); -//fmin = ffunction(float min (float, float),,""); - -fabs = abs; -fmax = max; -fmin = min; - -isnan = ffunction(int isnan (float),,""); -nextafter = ffunction(float nextafter(float, float),,""); - -// Pattern matching functions to count and access the elements of a list -// USAGE : count ((10,20,30,40)) -> 4 -// take (3,(10,20,30,40)) -> 30 -// - -count ((xs, xxs)) = 1 + count(xxs); -count (xx) = 1; - -take (1, (xs, xxs)) = xs; -take (1, xs) = xs; -take (nn, (xs, xxs)) = take (nn-1, xxs); - -// linear interpolation between two signals -interpolate(i) = *(1.0-i),*(i) : +; - -// if-then-else implemented with a select2. -if(cond,thn,els) = select2(cond,els,thn); - - -//----------------------------------------------------------------- -// countdown(count,trig) -// start counting down from count, count-1,...,0 when trig > 0 -//----------------------------------------------------------------- -countdown(count, trig) = \(c).(if(trig>0, count, max(0, c-1))) ~_; - -//----------------------------------------------------------------- -// countup(count,trig) -// start counting down from 0, 1, ... count-1, count when trig > 0 -//----------------------------------------------------------------- -countup(count, trig) = \(c).(if(trig>0, 0, min(count, c+1))) ~_; - -/****************************************************************** - * Hadamard matrix function - * Implementation contributed by Remy Muller - *****************************************************************/ - -// bus(n) : n parallel cables -bus(2) = _,_; // avoids a lot of "bus(1)" labels in block diagrams -bus(n) = par(i, n, _); - -// selector(i,n) : select ith cable among n -selector(i,n) = par(j, n, S(i, j)) with { S(i,i) = _; S(i,j) = !; }; - -// interleave(m,n) : interleave m*n cables : x(0), x(m), x(2m), ..., x(1),x(1+m), x(1+2m)... -//interleave(m,n) = bus(m*n) <: par(i, m, par(j, n, selector(i+j*m,m*n))); - -// interleave(row,col) : interleave row*col cables from column order to row order. -// input : x(0), x(1), x(2) ..., x(row*col-1) -// output: x(0+0*row), x(0+1*row), x(0+2*row), ..., x(1+0*row), x(1+1*row), x(1+2*row), ... -interleave(row,col) = bus(row*col) <: par(r, row, par(c, col, selector(r+c*row,row*col))); - -// butterfly(n) : addition then substraction of interleaved signals : -butterfly(n) = bus(n) <: interleave(n/2,2), interleave(n/2,2) : par(i, n/2, +), par(i, n/2, -); - -// hadamard(n) : hadamard matrix function of size n = 2^k -hadamard(2) = butterfly(2); -hadamard(n) = butterfly(n) : (hadamard(n/2) , hadamard(n/2));