#pragma once // ----------------------------------------------------------------------- // basic macros #define math·abs(x) (((x) > 0) ? (x) : (-(x))) #define math·sgn(x) (((x) > 0) ? (+1) : (((x) == 0) ? (0) : (-1) )) // ----------------------------------------------------------------------- // elementary functions double math·acos(double); float math·acosf(float); double math·acosh(double); float math·acoshf(float); double math·asin(double); float math·asinf(float); double math·asinh(double); float math·asinhf(float); double math·atan(double); float math·atanf(float); double math·atan2(double, double); float math·atan2f(float, float); double math·atanh(double); float math·atanhf(float); double math·cbrt(double); float math·cbrtf(float); double math·ceil(double); float math·ceilf(float); double math·cos(double); float math·cosf(float); double math·cosh(double); float math·coshf(float); double math·erf(double); float math·erff(float); double math·erfc(double); float math·erfcf(float); double math·exp(double); float math·expf(float); double math·exp2(double); float math·exp2f(float); double math·expm1(double); float math·expm1f(float); double math·floor(double); float math·floorf(float); int math·ilogb(double); int math·ilogbf(float); double math·lgamma(double); float math·lgammaf(float); long long math·llrint(double); long long math·llrintf(float); long long math·llround(double); long long math·llroundf(float); double math·log(double); float math·logf(float); double math·log10(double); float math·log10f(float); double math·log1p(double); float math·log1pf(float); double math·log2(double); float math·log2f(float); double math·logb(double); float math·logbf(float); long math·lrint(double); long math·lrintf(float); long math·lround(double); long math·lroundf(float); double math·nan(const char *); float math·nanf(const char *); double math·nearbyint(double); float math·nearbyintf(float); double math·pow(double, double); float math·powf(float, float); double math·rint(double); float math·rintf(float); double math·round(double); float math·roundf(float); double math·sin(double); float math·sinf(float); double math·sinh(double); float math·sinhf(float); double math·sqrt(double); float math·sqrtf(float); double math·tan(double); float math·tanf(float); double math·tanh(double); float math·tanhf(float); double math·tgamma(double); float math·tgammaf(float); double math·trunc(double); float math·truncf(float); // ----------------------------------------------------------------------- // linear algebra typedef struct math·Vector { double *d; int len; int inc; } math·Vector; #define iota(x) 1 << (x) enum { mat·trans = iota(1), mat·symm = iota(2), mat·posdef = iota(3), mat·negdef = iota(4), }; typedef struct math·Matrix { double *d; uint state; int dim[2]; int inc; } math·Matrix; // TODO: tensor ala numpy