cmComplexTypes.h/c : Added cmVOCR_MultVFV() and cmVOCR_DivVFV(). Implemented cmVOCR_Abs().
This commit is contained in:
parent
384dc72cc1
commit
7669faceba
@ -1,42 +1,60 @@
|
|||||||
|
#include "cmPrefix.h"
|
||||||
|
#include "cmGlobal.h"
|
||||||
|
#include "cmFloatTypes.h"
|
||||||
|
#include "cmComplexTypes.h"
|
||||||
|
|
||||||
|
void cmVOCR_MultVVV( cmComplexR_t* y, const cmComplexS_t* x0, const cmComplexR_t* x1, unsigned n )
|
||||||
void cmVOCR_MultVVV( cmComplexR_t* y, const cmComplex_t* x0, const cmComplexR_t* x1, unsigned n )
|
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
for(i=0; i<n; ++i)
|
for(i=0; i<n; ++i)
|
||||||
{
|
{
|
||||||
|
y[i] = x0[i] * x1[i];
|
||||||
|
/*
|
||||||
cmReal_t ab = x0[i].r * x1[i].r;
|
cmReal_t ab = x0[i].r * x1[i].r;
|
||||||
cmReal_t bd = x0[i].i * x1[i].i;
|
cmReal_t bd = x0[i].i * x1[i].i;
|
||||||
cmReal_t bc = x0[i].i * x1[i].r;
|
cmReal_t bc = x0[i].i * x1[i].r;
|
||||||
cmReal_t ad = x0[i].r * x1[i].i;
|
cmReal_t ad = x0[i].r * x1[i].i;
|
||||||
y[i].r = ab - bd;
|
y[i].r = ab - bd;
|
||||||
y[i].i = bc + ad;
|
y[i].i = bc + ad;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cmVOCR_Abs( cmReal_t* y, const cmComplexR_t* x, unsigned n )
|
void cmVOCR_MultVFV( cmComplexR_t* y, const float* x, unsigned n )
|
||||||
{
|
|
||||||
for(i=0; i<n; ++i)
|
|
||||||
y[i] = cmAbsR(x[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
void cmVOCR_MultR_VV( cmComplexR_t* y, const cmReal_t* x, unsigned n )
|
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
for(i=0; i<n; ++i)
|
for(i=0; i<n; ++i)
|
||||||
{
|
{
|
||||||
y[i].r *= x[i];
|
y[i] *= x[i];
|
||||||
y[i].i *= x[i];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void cmVOCR_DivVFV( cmComplexR_t* y, const float* x, unsigned n )
|
||||||
|
{
|
||||||
|
unsigned i;
|
||||||
|
for(i=0; i<n; ++i)
|
||||||
|
{
|
||||||
|
y[i] /= x[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void cmVOCR_Abs( cmSample_t* y, const cmComplexR_t* x, unsigned n )
|
||||||
|
{
|
||||||
|
unsigned i;
|
||||||
|
for(i=0; i<n; ++i)
|
||||||
|
y[i] = (cmSample_t)cmCabsR(x[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void cmVOCR_DivR_VV( cmComplexR_t* y, const cmReal_t* x, unsigned n )
|
void cmVOCR_DivR_VV( cmComplexR_t* y, const cmReal_t* x, unsigned n )
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
for(i=0; i<n; ++i)
|
for(i=0; i<n; ++i)
|
||||||
{
|
{
|
||||||
y[i].r /= x[i];
|
y[i] /= x[i];
|
||||||
y[i].i /= x[i];
|
//y[i].r /= x[i];
|
||||||
|
//y[i].i /= x[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#define cmCrealS crealf
|
#define cmCrealS crealf
|
||||||
#define cmCimagS cimagf
|
#define cmCimagS cimagf
|
||||||
#define cmCargS cargf
|
#define cmCargS cargf
|
||||||
|
#define cmCconjS conjf
|
||||||
|
|
||||||
#define cmFftPlanAllocS fftwf_plan_dft_r2c_1d
|
#define cmFftPlanAllocS fftwf_plan_dft_r2c_1d
|
||||||
#define cmFft1dPlanAllocS fftwf_plan_dft_1d
|
#define cmFft1dPlanAllocS fftwf_plan_dft_1d
|
||||||
@ -29,6 +30,7 @@
|
|||||||
#define cmCrealS creal
|
#define cmCrealS creal
|
||||||
#define cmCimagS cimag
|
#define cmCimagS cimag
|
||||||
#define cmCargS carg
|
#define cmCargS carg
|
||||||
|
#define cmCconjS conj
|
||||||
|
|
||||||
#define cmFftPlanAllocS fftw_plan_dft_r2c_1d
|
#define cmFftPlanAllocS fftw_plan_dft_r2c_1d
|
||||||
#define cmFft1dPlanAllocS fftw_plan_dft_1d
|
#define cmFft1dPlanAllocS fftw_plan_dft_1d
|
||||||
@ -53,6 +55,7 @@
|
|||||||
#define cmCrealR crealf
|
#define cmCrealR crealf
|
||||||
#define cmCimagR cimagf
|
#define cmCimagR cimagf
|
||||||
#define cmCargR cargf
|
#define cmCargR cargf
|
||||||
|
#define cmCconjR conjf
|
||||||
|
|
||||||
#define cmFftPlanAllocR fftwf_plan_dft_r2c_1d
|
#define cmFftPlanAllocR fftwf_plan_dft_r2c_1d
|
||||||
#define cmFft1dPlanAllocR fftwf_plan_dft_1d
|
#define cmFft1dPlanAllocR fftwf_plan_dft_1d
|
||||||
@ -71,6 +74,7 @@
|
|||||||
#define cmCrealR creal
|
#define cmCrealR creal
|
||||||
#define cmCimagR cimag
|
#define cmCimagR cimag
|
||||||
#define cmCargR carg
|
#define cmCargR carg
|
||||||
|
#define cmCconjR conj
|
||||||
|
|
||||||
#define cmFftPlanAllocR fftw_plan_dft_r2c_1d
|
#define cmFftPlanAllocR fftw_plan_dft_r2c_1d
|
||||||
#define cmFft1dPlanAllocR fftw_plan_dft_1d
|
#define cmFft1dPlanAllocR fftw_plan_dft_1d
|
||||||
@ -84,8 +88,10 @@
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void cmVOCR_MultVVV( cmComplexR_t* y, const cmComplexR_t* x0, const cmComplexR_t* x1, unsigned n );
|
void cmVOCR_MultVVV( cmComplexR_t* y, const cmComplexS_t* x0, const cmComplexR_t* x1, unsigned n );
|
||||||
void cmVOCR_Abs( cmReal_t* y, const cmComplexR_t* x, unsigned n );
|
void cmVOCR_MultVFV( cmComplexR_t* y, const float* x, unsigned n );
|
||||||
|
void cmVOCR_DivVFV( cmComplexR_t* y, const float_t* x, unsigned n );
|
||||||
|
void cmVOCR_Abs( cmSample_t* y, const cmComplexR_t* x, unsigned n );
|
||||||
void cmVOCR_MultVS( cmComplexR_t* y, cmReal_t v, unsigned n );
|
void cmVOCR_MultVS( cmComplexR_t* y, cmReal_t v, unsigned n );
|
||||||
void cmVOCR_DivVS( cmComplexR_t* y, cmReal_t v, unsigned n );
|
void cmVOCR_DivVS( cmComplexR_t* y, cmReal_t v, unsigned n );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user