⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 de_map_module_adp.c

📁 好东西
💻 C
📖 第 1 页 / 共 2 页
字号:
/*
 * MATLAB Compiler: 3.0
 * Date: Fri Mar 24 11:31:36 2006
 * Arguments: "-B" "macro_default" "-O" "all" "-O" "fold_scalar_mxarrays:on"
 * "-O" "fold_non_scalar_mxarrays:on" "-O" "optimize_integer_for_loops:on" "-O"
 * "array_indexing:on" "-O" "optimize_conditionals:on" "-m" "-W" "main" "-L"
 * "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib"
 * "adptive_bitpow_allocate_systems" 
 */
#include "de_map_module_adp.h"
#include "de_16qam.h"
#include "de_64qam.h"
#include "de_bpsk.h"
#include "de_qpsk.h"
#include "libmatlbm.h"
static mxArray * _mxarray0_;
static mxArray * _mxarray1_;
static mxArray * _mxarray2_;
static mxArray * _mxarray3_;
static mxArray * _mxarray4_;

void InitializeModule_de_map_module_adp(void) {
    _mxarray0_ = mclInitializeDouble(2.0);
    _mxarray1_ = mclInitializeDoubleVector(0, 0, (double *)NULL);
    _mxarray2_ = mclInitializeDouble(1.0);
    _mxarray3_ = mclInitializeDouble(4.0);
    _mxarray4_ = mclInitializeDouble(6.0);
}

void TerminateModule_de_map_module_adp(void) {
    mxDestroyArray(_mxarray4_);
    mxDestroyArray(_mxarray3_);
    mxDestroyArray(_mxarray2_);
    mxDestroyArray(_mxarray1_);
    mxDestroyArray(_mxarray0_);
}

static mxArray * Mde_map_module_adp(int nargout_,
                                    mxArray * input,
                                    mxArray * map_flag,
                                    mxArray * groupsize,
                                    mxArray * groupnumber,
                                    mxArray * bit_num_ofdmsig);

_mexLocalFunctionTable _local_function_table_de_map_module_adp
  = { 0, (mexFunctionTableEntry *)NULL };

/*
 * The function "mlfDe_map_module_adp" contains the normal interface for the
 * "de_map_module_adp" M-function from file
 * "c:\matlab6p5\work\adptive_ofdm\adptive_ofdm\de_map_module_adp.m" (lines
 * 1-58). This function processes any input arguments and passes them to the
 * implementation version of the function, appearing above.
 */
mxArray * mlfDe_map_module_adp(mxArray * input,
                               mxArray * map_flag,
                               mxArray * groupsize,
                               mxArray * groupnumber,
                               mxArray * bit_num_ofdmsig) {
    int nargout = 1;
    mxArray * output = NULL;
    mlfEnterNewContext(
      0, 5, input, map_flag, groupsize, groupnumber, bit_num_ofdmsig);
    output
      = Mde_map_module_adp(
          nargout, input, map_flag, groupsize, groupnumber, bit_num_ofdmsig);
    mlfRestorePreviousContext(
      0, 5, input, map_flag, groupsize, groupnumber, bit_num_ofdmsig);
    return mlfReturnValue(output);
}

/*
 * The function "mlxDe_map_module_adp" contains the feval interface for the
 * "de_map_module_adp" M-function from file
 * "c:\matlab6p5\work\adptive_ofdm\adptive_ofdm\de_map_module_adp.m" (lines
 * 1-58). The feval function calls the implementation version of
 * de_map_module_adp through this function. This function processes any input
 * arguments and passes them to the implementation version of the function,
 * appearing above.
 */
void mlxDe_map_module_adp(int nlhs,
                          mxArray * plhs[],
                          int nrhs,
                          mxArray * prhs[]) {
    mxArray * mprhs[5];
    mxArray * mplhs[1];
    int i;
    if (nlhs > 1) {
        mlfError(
          mxCreateString(
            "Run-time Error: File: de_map_module_adp Line: 1 Colu"
            "mn: 1 The function \"de_map_module_adp\" was called "
            "with more than the declared number of outputs (1)."),
          NULL);
    }
    if (nrhs > 5) {
        mlfError(
          mxCreateString(
            "Run-time Error: File: de_map_module_adp Line: 1 Colu"
            "mn: 1 The function \"de_map_module_adp\" was called "
            "with more than the declared number of inputs (5)."),
          NULL);
    }
    for (i = 0; i < 1; ++i) {
        mplhs[i] = NULL;
    }
    for (i = 0; i < 5 && i < nrhs; ++i) {
        mprhs[i] = prhs[i];
    }
    for (; i < 5; ++i) {
        mprhs[i] = NULL;
    }
    mlfEnterNewContext(0, 5, mprhs[0], mprhs[1], mprhs[2], mprhs[3], mprhs[4]);
    mplhs[0]
      = Mde_map_module_adp(
          nlhs, mprhs[0], mprhs[1], mprhs[2], mprhs[3], mprhs[4]);
    mlfRestorePreviousContext(
      0, 5, mprhs[0], mprhs[1], mprhs[2], mprhs[3], mprhs[4]);
    plhs[0] = mplhs[0];
}

/*
 * The function "Mde_map_module_adp" is the implementation version of the
 * "de_map_module_adp" M-function from file
 * "c:\matlab6p5\work\adptive_ofdm\adptive_ofdm\de_map_module_adp.m" (lines
 * 1-58). It contains the actual compiled code for that M-function. It is a
 * static function and must only be called from one of the interface functions,
 * appearing below.
 */
/*
 * function output=de_map_module_adp(input,map_flag,groupsize,groupnumber,bit_num_ofdmsig)
 */
static mxArray * Mde_map_module_adp(int nargout_,
                                    mxArray * input,
                                    mxArray * map_flag,
                                    mxArray * groupsize,
                                    mxArray * groupnumber,
                                    mxArray * bit_num_ofdmsig) {
    mexLocalFunctionTable save_local_function_table_
      = mclSetCurrentLocalFunctionTable(
          &_local_function_table_de_map_module_adp);
    mxArray * output = NULL;
    mxArray * temp = NULL;
    mxArray * jj = NULL;
    mxArray * flag = NULL;
    mxArray * ii = NULL;
    mxArray * n = NULL;
    mxArray * N_ofdm = NULL;
    mclCopyArray(&input);
    mclCopyArray(&map_flag);
    mclCopyArray(&groupsize);
    mclCopyArray(&groupnumber);
    mclCopyArray(&bit_num_ofdmsig);
    /*
     * output=zeros(max(bit_num_ofdmsig),size(input,2));
     */
    mlfAssign(
      &output,
      mlfZeros(
        mlfMax(NULL, mclVa(bit_num_ofdmsig, "bit_num_ofdmsig"), NULL, NULL),
        mlfSize(mclValueVarargout(), mclVa(input, "input"), _mxarray0_),
        NULL));
    /*
     * N_ofdm=size(input,2);
     */
    mlfAssign(
      &N_ofdm, mlfSize(mclValueVarargout(), mclVa(input, "input"), _mxarray0_));
    /*
     * for n=1:N_ofdm
     */
    {
        int v_ = mclForIntStart(1);
        int e_ = mclForIntEnd(mclVv(N_ofdm, "N_ofdm"));
        if (v_ > e_) {
            mlfAssign(&n, _mxarray1_);
        } else {
            /*
             * for ii=1:groupnumber
             * flag=map_flag(ii,n);
             * for jj=1:groupsize
             * % b=ones(1,groupsize);
             * % flga=kron(map_flag',b);
             * 
             * if flag==1
             * temp=(ii-1)*groupsize+jj;
             * output((ii-1)*groupsize+jj,n)=de_bpsk(input(temp,n));
             * elseif flag==2
             * temp=(ii-1)*groupsize+jj;
             * output((((ii-1)*groupsize+jj-1)*flag+1:((ii-1)*groupsize+jj-1)*flag+flag),n)=(de_qpsk(input(temp,n)))';
             * elseif flag==4
             * temp=(ii-1)*groupsize+jj;
             * output((((ii-1)*groupsize+jj-1)*flag+1:((ii-1)*groupsize+jj-1)*flag+flag),n)=(de_16qam(input(temp,n)))';
             * elseif flag==6
             * temp=(ii-1)*groupsize+jj;
             * output((((ii-1)*groupsize+jj-1)*flag+1:((ii-1)*groupsize+jj-1)*flag+flag),n)=(de_64qam(input(temp,n)))';
             * %             elseif flag==0
             * %                 output((((ii-1)*groupsize+jj-1)+1:((ii-1)*groupsize+jj-1)+1),n)=0;
             * else
             * output((((ii-1)*groupsize+jj-1)*flag+1:((ii-1)*groupsize+jj-1)*flag+flag),n)=zeros(flag,1);
             * end
             * end
             * end
             * end
             */
            for (; ; ) {
                int v_0 = mclForIntStart(1);
                int e_0 = mclForIntEnd(mclVa(groupnumber, "groupnumber"));
                if (v_0 > e_0) {
                    mlfAssign(&ii, _mxarray1_);
                } else {
                    for (; ; ) {
                        mlfAssign(
                          &flag,
                          mclIntArrayRef2(
                            mclVa(map_flag, "map_flag"), v_0, v_));
                        {
                            int v_1 = mclForIntStart(1);
                            int e_1
                              = mclForIntEnd(mclVa(groupsize, "groupsize"));
                            if (v_1 > e_1) {
                                mlfAssign(&jj, _mxarray1_);
                            } else {
                                for (; ; ) {
                                    if (mclEqBool(
                                          mclVv(flag, "flag"), _mxarray2_)) {
                                        mlfAssign(
                                          &temp,
                                          mclPlus(
                                            mclMtimes(
                                              mlfScalar(v_0 - 1),
                                              mclVa(groupsize, "groupsize")),
                                            mlfScalar(v_1)));
                                        mclArrayAssign2(
                                          &output,
                                          mlfDe_bpsk(
                                            mclArrayRef2(
                                              mclVa(input, "input"),
                                              mclVv(temp, "temp"),
                                              mlfScalar(v_))),
                                          mclPlus(
                                            mclMtimes(
                                              mlfScalar(v_0 - 1),
                                              mclVa(groupsize, "groupsize")),
                                            mlfScalar(v_1)),
                                          mlfScalar(v_));
                                    } else if (mclEqBool(

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -