This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Complex functions

Other Parts Discussed in Thread: CCSTUDIO

 

hi

I want do some complex (real + imaginary) computations. such as complex number addition, multiplication, complex exponential etc.

 

I am using c6713 and have added complex header files in my project.

But it is giving errors.

Can you please help me rectify that ?

 

0044.Beamforming_simulator.zip

Regards

Amir

 

 

  • Amir,

    There are several files in your ZIP package.  Please indicate which file(s) are causing compilation errors and provide the error text that you're seeing.  That will help us diagnose what is going wrong.

  • its giving errors in beamforming.c

    when i add complex.h it gives error. when i remove header file. error is gone.

  • Amir,

    Can you provide the specific error text that you are seeing?  This should indicate the type of problem that is occurring and the offending line number(s).

  • HI

    These are errors

     

     

    --------------------------  Beamforming.pjt - Debug  --------------------------

    [Beamforming.c] "C:\CCStudio_v3.1\C6000\cgtools\bin\cl6x" -g -q -o3 -fr"C:/Documents and Settings/Administrator/Desktop/Beamforming_simulator/Debug" -d"CHIP_6713" -mr1 -mv6710 --mem_model:data=far -@"Debug.lkf" "Beamforming.c"

    "complex.h", line 55: error: expected a ";"

    "complex.h", line 56: error: expected a ";"

    "complex.h", line 57: error: expected a ";"

    "complex.h", line 58: error: expected a ";"

    "complex.h", line 59: error: expected a ";"

    "complex.h", line 60: error: expected a ";"

    "complex.h", line 61: error: expected a ";"

    "complex.h", line 62: error: expected a ";"

    "complex.h", line 63: error: expected a ";"

    "complex.h", line 64: error: expected a ";"

    "complex.h", line 65: error: expected a ";"

    "complex.h", line 66: error: expected a ";"

    "complex.h", line 67: error: expected a ";"

    "complex.h", line 68: error: expected a ";"

    "complex.h", line 69: error: expected a ";"

    "complex.h", line 70: error: expected a ";"

    "complex.h", line 71: error: expected a ";"

    "complex.h", line 72: error: expected a ";"

    "complex.h", line 78: error: declaration is incompatible with "double _Complex" (declared at line 55)

    "complex.h", line 78: error: expected a ";"

    "complex.h", line 79: error: expected a ";"

    "complex.h", line 80: error: expected a ";"

    "complex.h", line 81: error: expected a ";"

    "complex.h", line 82: error: expected a ";"

    "complex.h", line 83: error: expected a ";"

    "complex.h", line 84: error: expected a ";"

    "complex.h", line 85: error: expected a ";"

    "complex.h", line 86: error: expected a ";"

    "complex.h", line 87: error: expected a ";"

    "complex.h", line 88: error: expected a ";"

    "complex.h", line 89: error: expected a ";"

    "complex.h", line 90: error: expected a ";"

    "complex.h", line 91: error: expected a ";"

    "complex.h", line 92: error: expected a ";"

    "complex.h", line 93: error: expected a ";"

    "complex.h", line 94: error: expected a ";"

    "complex.h", line 95: error: expected a ";"

    "complex.h", line 101: error: declaration is incompatible with "float _Complex" (declared at line 78)

    "complex.h", line 101: error: expected a ";"

    "complex.h", line 102: error: expected a ";"

    "complex.h", line 103: error: expected a ";"

    "complex.h", line 104: error: expected a ";"

    "complex.h", line 105: error: expected a ";"

    "complex.h", line 106: error: expected a ";"

    "complex.h", line 107: error: expected a ";"

    "complex.h", line 108: error: expected a ";"

    "complex.h", line 109: error: expected a ";"

    "complex.h", line 110: error: expected a ";"

    "complex.h", line 111: error: expected a ";"

    "complex.h", line 112: error: expected a ";"

    "complex.h", line 113: error: expected a ";"

    "complex.h", line 114: error: expected a ";"

    "complex.h", line 115: error: expected a ";"

    "complex.h", line 116: error: expected a ";"

    "complex.h", line 117: error: expected a ";"

    "complex.h", line 118: error: expected a ";"

    56 errors detected in the compilation of "Beamforming.c".

     

    >> Compilation failure

     

     

     

     

    I had previously uploaded project file. you may compile them to get better idea of error.

    Thx in advance

    Regards

  • Amir,

    Thank you for providing the error text; I think I see the problem now.  It looks like this header file is written to use complex value functionality added in the C99 version of the C language.  Unfortunately, the TI compiler does not support C99.  It also does not support the complex value extensions found in GCC.  This means that processing complex numbers in DSP applications usually means managing interleaved data buffers, as in:

    void cplx_mpy(float *x1, float *x2, float *y, int N)
    {
        float x1_real, x1_imag, x2_real, x2_imag;
        int i;

        for (i = 0; i < N; i++)
        {
            // get real, imaginary values
            x1_real = x1[2 * i];
            x1_imag = x1[2 * i + 1];
            x2_real = x2[2 * i];
            x2_imag = x2[2 * i + 1];
       
            // compute real output term
            y[2 * i] = (x1_real * x2_real) - (x1_imag * x2_imag);
           
            // compute imaginary output term
            y[2 * i + 1] = (x1_real * x2_imag) + (x1_imag * x2_real);
        }
    }

    Hope this helps.

  • .

    Hi Joe

    Thank you . That was really helpful

    Does CCS dont support C++.

    I want to use other complex function such as exponential of complex number, square, their sine and cosine etc.

    Is there any library available that can be used with it? i.e. complex functions library like i have added in project "complex.h"

    Best Regards

    Amir

     

  • I am working on DSK-C6713 on noise separating algorithm. I am facing a problem bcoz i don't have real function in ccs5 so please help me how can i calculate square root of a negative number and get its real part.