?? cut_cp.c
字號:
/*
* 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 "cut_cp.h"
#include "libmatlbm.h"
static mxArray * _mxarray0_;
static mxArray * _mxarray1_;
void InitializeModule_cut_cp(void) {
_mxarray0_ = mclInitializeDoubleVector(0, 0, (double *)NULL);
_mxarray1_ = mclInitializeDouble(1.0);
}
void TerminateModule_cut_cp(void) {
mxDestroyArray(_mxarray1_);
mxDestroyArray(_mxarray0_);
}
static mxArray * Mcut_cp(int nargout_, mxArray * input, mxArray * cp_length);
_mexLocalFunctionTable _local_function_table_cut_cp
= { 0, (mexFunctionTableEntry *)NULL };
/*
* The function "mlfCut_cp" contains the normal interface for the "cut_cp"
* M-function from file "c:\matlab6p5\work\adptive_ofdm\adptive_ofdm\cut_cp.m"
* (lines 1-8). This function processes any input arguments and passes them to
* the implementation version of the function, appearing above.
*/
mxArray * mlfCut_cp(mxArray * input, mxArray * cp_length) {
int nargout = 1;
mxArray * output = NULL;
mlfEnterNewContext(0, 2, input, cp_length);
output = Mcut_cp(nargout, input, cp_length);
mlfRestorePreviousContext(0, 2, input, cp_length);
return mlfReturnValue(output);
}
/*
* The function "mlxCut_cp" contains the feval interface for the "cut_cp"
* M-function from file "c:\matlab6p5\work\adptive_ofdm\adptive_ofdm\cut_cp.m"
* (lines 1-8). The feval function calls the implementation version of cut_cp
* through this function. This function processes any input arguments and
* passes them to the implementation version of the function, appearing above.
*/
void mlxCut_cp(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
mxArray * mprhs[2];
mxArray * mplhs[1];
int i;
if (nlhs > 1) {
mlfError(
mxCreateString(
"Run-time Error: File: cut_cp Line: 1 Column: "
"1 The function \"cut_cp\" was called with mor"
"e than the declared number of outputs (1)."),
NULL);
}
if (nrhs > 2) {
mlfError(
mxCreateString(
"Run-time Error: File: cut_cp Line: 1 Column: "
"1 The function \"cut_cp\" was called with mor"
"e than the declared number of inputs (2)."),
NULL);
}
for (i = 0; i < 1; ++i) {
mplhs[i] = NULL;
}
for (i = 0; i < 2 && i < nrhs; ++i) {
mprhs[i] = prhs[i];
}
for (; i < 2; ++i) {
mprhs[i] = NULL;
}
mlfEnterNewContext(0, 2, mprhs[0], mprhs[1]);
mplhs[0] = Mcut_cp(nlhs, mprhs[0], mprhs[1]);
mlfRestorePreviousContext(0, 2, mprhs[0], mprhs[1]);
plhs[0] = mplhs[0];
}
/*
* The function "Mcut_cp" is the implementation version of the "cut_cp"
* M-function from file "c:\matlab6p5\work\adptive_ofdm\adptive_ofdm\cut_cp.m"
* (lines 1-8). 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=insert_cp(input,cp_length) %cp_length是循環(huán)前綴的長度
*/
static mxArray * Mcut_cp(int nargout_, mxArray * input, mxArray * cp_length) {
mexLocalFunctionTable save_local_function_table_
= mclSetCurrentLocalFunctionTable(&_local_function_table_cut_cp);
mxArray * output = NULL;
mxArray * j = NULL;
mxArray * n = NULL;
mxArray * m = NULL;
mclCopyArray(&input);
mclCopyArray(&cp_length);
/*
* [m,n]=size(input);
*/
mlfSize(mlfVarargout(&m, &n, NULL), mclVa(input, "input"), NULL);
/*
* output=zeros(m-cp_length,n);
*/
mlfAssign(
&output,
mlfZeros(
mclMinus(mclVv(m, "m"), mclVa(cp_length, "cp_length")),
mclVv(n, "n"),
NULL));
/*
* %以下循環(huán)為各列插入循環(huán)前綴
* for j=1:n
*/
{
int v_ = mclForIntStart(1);
int e_ = mclForIntEnd(mclVv(n, "n"));
if (v_ > e_) {
mlfAssign(&j, _mxarray0_);
} else {
/*
* output(1:(m-cp_length),j)=input((cp_length+1:m),j);
*
* end
*/
for (; ; ) {
mclArrayAssign2(
&output,
mclArrayRef2(
mclVa(input, "input"),
mlfColon(
mclPlus(mclVa(cp_length, "cp_length"), _mxarray1_),
mclVv(m, "m"),
NULL),
mlfScalar(v_)),
mlfColon(
_mxarray1_,
mclMinus(mclVv(m, "m"), mclVa(cp_length, "cp_length")),
NULL),
mlfScalar(v_));
if (v_ == e_) {
break;
}
++v_;
}
mlfAssign(&j, mlfScalar(v_));
}
}
mclValidateOutput(output, 1, nargout_, "output", "cut_cp");
mxDestroyArray(m);
mxDestroyArray(n);
mxDestroyArray(j);
mxDestroyArray(cp_length);
mxDestroyArray(input);
mclSetCurrentLocalFunctionTable(save_local_function_table_);
return output;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -