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

📄 cholesky.cpp

📁 该程序是一个matlab与visual c++ 混合编程的例子
💻 CPP
字号:
//
// MATLAB Compiler: 3.0
// Date: Fri Aug 26 16:33:02 2005
// 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" "-silentsetup" "-d"
// "D:/mymatrix/src" "-B" "cppsglcom:mymatrix,myfactor,1.0" "-B"
// "csglcom:mymatrix,myfactor,1.0" "-B" "sgl" "-m" "-W" "main" "-L" "C" "-t"
// "-T" "link:exe" "-h" "libmmfile.mlib" "-W" "mainhg" "libmwsglm.mlib" "-t"
// "-W" "comhg:mymatrix,myfactor,1.0" "-T" "link:lib" "-h" "libmmfile.mlib"
// "-i" "-L" "cpp" "-i" "D:/matlab1/Cholesky.m" "D:/matlab1/LUDecomp.m"
// "D:/matlab1/QRDecomp.m" 
//
#include "cholesky.hpp"
#include "libmatlbm.hpp"

extern mwArray A;
static mwArray _mxarray0_ = mclInitializeDoubleVector(0, 0, (double *)NULL);

void InitializeModule_cholesky() {
}

void TerminateModule_cholesky() {
}

static mwArray Mcholesky(int nargout_);

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

//
// The function "cholesky" contains the normal interface for the "cholesky"
// M-function from file "d:\matlab1\cholesky.m" (lines 1-9). This function
// processes any input arguments and passes them to the implementation version
// of the function, appearing above.
//
mwArray cholesky() {
    int nargout = 1;
    mwArray L = mwArray::UNDEFINED;
    L = Mcholesky(nargout);
    return L;
}

//
// The function "mlxCholesky" contains the feval interface for the "cholesky"
// M-function from file "d:\matlab1\cholesky.m" (lines 1-9). The feval function
// calls the implementation version of cholesky through this function. This
// function processes any input arguments and passes them to the implementation
// version of the function, appearing above.
//
void mlxCholesky(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
    MW_BEGIN_MLX();
    {
        mwArray mplhs[1];
        mclCppUndefineArrays(1, mplhs);
        if (nlhs > 1) {
            error(
              mwVarargin(
                mwArray(
                  "Run-time Error: File: cholesky Line: 1 Column: "
                  "1 The function \"cholesky\" was called with mor"
                  "e than the declared number of outputs (1).")));
        }
        if (nrhs > 0) {
            error(
              mwVarargin(
                mwArray(
                  "Run-time Error: File: cholesky Line: 1 Column: "
                  "1 The function \"cholesky\" was called with mor"
                  "e than the declared number of inputs (0).")));
        }
        mplhs[0] = Mcholesky(nlhs);
        plhs[0] = mplhs[0].FreezeData();
    }
    MW_END_MLX();
}

//
// The function "Mcholesky" is the implementation version of the "cholesky"
// M-function from file "d:\matlab1\cholesky.m" (lines 1-9). 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[L]=Cholesky()
//
static mwArray Mcholesky(int nargout_) {
    mwLocalFunctionTable save_local_function_table_
      = &_local_function_table_cholesky;
    mwArray L = mwArray::UNDEFINED;
    mwArray ans = mwArray::UNDEFINED;
    //
    // global A;
    // if(isempty(A))
    //
    if (tobool(isempty(mwVv(A, "A")))) {
        //
        // L=[];
        //
        L = _mxarray0_;
        //
        // return;
        //
        goto return_;
    //
    // end
    //
    }
    //
    // L=chol(A);
    //
    L = chol(mwVv(A, "A"));
    //
    // 
    //
    return_:
    mwValidateOutput(L, 1, nargout_, "L", "cholesky");
    return L;
    //
    // 
    //
}

⌨️ 快捷键说明

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