diff options
author | Sandeep Gupta | 2017-06-18 23:55:40 +0530 |
---|---|---|
committer | Sandeep Gupta | 2017-06-18 23:55:40 +0530 |
commit | 277d1edfa17bf3719d90ddbac8e31f6181e952c3 (patch) | |
tree | 0661f1f52af0a0fd654edd4984c30e57037303c6 /macros/CFiles/sci2ccode/RealToComplex.c | |
download | Scilab2C_fossee_old-277d1edfa17bf3719d90ddbac8e31f6181e952c3.tar.gz Scilab2C_fossee_old-277d1edfa17bf3719d90ddbac8e31f6181e952c3.tar.bz2 Scilab2C_fossee_old-277d1edfa17bf3719d90ddbac8e31f6181e952c3.zip |
First commit
Diffstat (limited to 'macros/CFiles/sci2ccode/RealToComplex.c')
-rw-r--r-- | macros/CFiles/sci2ccode/RealToComplex.c | 134 |
1 files changed, 134 insertions, 0 deletions
diff --git a/macros/CFiles/sci2ccode/RealToComplex.c b/macros/CFiles/sci2ccode/RealToComplex.c new file mode 100644 index 0000000..dd7b5ec --- /dev/null +++ b/macros/CFiles/sci2ccode/RealToComplex.c @@ -0,0 +1,134 @@ +/* +** -*- C -*- +** +** +** Made by Raffaele.Nutricato@tiscali.it +** +** Copyright Raffaele Nutricato +*/ + +#include "RealToComplex.h" + +floatComplex s0floatcomplexc0(float in) +{ + floatComplex out; + out = FloatComplex(in,0); + return out; +} + +floatComplex d0floatcomplexc0(double in) +{ + floatComplex out; + out = FloatComplex(in,0); + return out; +} + +floatComplex c0floatcomplexc0(floatComplex in) +{ + return in; +} + +floatComplex z0floatcomplexc0(doubleComplex in) +{ + floatComplex out; + out = FloatComplex((float)zreals(in),(float)zimags(in)); + return out; +} + +void s2floatcomplexc2(float* in, int* inSize, floatComplex* out) +{ + int i = 0; + for (i=0;i<inSize[0]*inSize[1];i++) + { + out[i] = s0floatcomplexc0(in[i]); + } +} + +void d2floatcomplexc2(double* in, int* inSize, floatComplex* out) +{ + int i = 0; + for (i=0;i<inSize[0]*inSize[1];i++) + { + out[i] = d0floatcomplexc0(in[i]); + } +} + +void c2floatcomplexc2(floatComplex* in, int* inSize, floatComplex* out) +{ + int i = 0; + for (i=0;i<inSize[0]*inSize[1];i++) + { + out[i] = c0floatcomplexc0(in[i]); + } +} + +void z2floatcomplexc2(doubleComplex* in, int* inSize, floatComplex* out) +{ + int i = 0; + for (i=0;i<inSize[0]*inSize[1];i++) + { + out[i] = z0floatcomplexc0(in[i]); + } +} + +doubleComplex s0doublecomplexz0(float in) +{ + doubleComplex out; + out = DoubleComplex((double)(in),0); + return out; +} + +doubleComplex d0doublecomplexz0(double in) +{ + doubleComplex out; + out = DoubleComplex(in,0); + return out; +} + +doubleComplex c0doublecomplexz0(floatComplex in) +{ + doubleComplex out; + out = DoubleComplex((double) creals(in),(double) cimags(in)); + return out; +} + +doubleComplex z0doublecomplexz0(doubleComplex in) +{ + return in; +} + +void s2doublecomplexz2(float* in, int* inSize, doubleComplex* out) +{ + int i = 0; + for (i=0;i<inSize[0]*inSize[1];i++) + { + out[i] = s0doublecomplexz0(in[i]); + } +} + +void d2doublecomplexz2(double* in, int* inSize, doubleComplex* out) +{ + int i = 0; + for (i=0;i<inSize[0]*inSize[1];i++) + { + out[i] = d0doublecomplexz0(in[i]); + } +} + +void c2doublecomplexz2(floatComplex* in, int* inSize, doubleComplex* out) +{ + int i = 0; + for (i=0;i<inSize[0]*inSize[1];i++) + { + out[i] = c0doublecomplexz0(in[i]); + } +} + +void z2doublecomplexz2(doubleComplex* in, int* inSize, doubleComplex* out) +{ + int i = 0; + for (i=0;i<inSize[0]*inSize[1];i++) + { + out[i] = z0doublecomplexz0(in[i]); + } +} |