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

📄 sparsematrix.cpp

📁 MWSparseMaxtrix 稀疏矩阵阵列操作
💻 CPP
字号:
//
// MATLAB Compiler: 3.0
// Date: Fri May 28 15:51:21 2004
// 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:/MATLAB6p5p1/work/book/dataconversion/MWSparseMaxtrix/src" "-v" "-B"
// "cppcom:SparseMatrixText,SparseMatrixText,1.0" "-B"
// "ccom:SparseMatrixText,SparseMatrixText,1.0" "-t" "-W"
// "com:SparseMatrixText,SparseMatrixText,1.0" "-T" "link:lib" "-h"
// "libmmfile.mlib" "-i" "-L" "cpp" "-g" "-G" "-A" "debugline:on" "-O" "none"
// "-O" "fold_scalar_mxarrays:off" "-O" "fold_non_scalar_mxarrays:off" "-O"
// "optimize_integer_for_loops:off" "-O" "array_indexing:off" "-O"
// "optimize_conditionals:off" "-O" "speculate:off" "-i"
// "D:/MATLAB6p5p1/work/book/dataconversion/MWSparseMaxtrix/mfiles/displaymatrix
// .m"
// "D:/MATLAB6p5p1/work/book/dataconversion/MWSparseMaxtrix/mfiles/sparsematrix.
// m" 
//
#include "sparsematrix.hpp"
#include "libmatlbm.hpp"

void InitializeModule_sparsematrix() {
}

void TerminateModule_sparsematrix() {
}

static mwArray Msparsematrix(int nargout_, mwArray x);

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

//
// The function "sparsematrix" contains the normal interface for the
// "sparsematrix" M-function from file
// "d:\matlab6p5p1\work\book\dataconversion\mwsparsemaxtrix\mfiles\sparsematrix.
// m" (lines 1-6). This function processes any input arguments and passes them
// to the implementation version of the function, appearing above.
//
mwArray sparsematrix(mwArray x) {
    int nargout = 1;
    mwArray y = mwArray::UNDEFINED;
    y = Msparsematrix(nargout, x);
    return y;
}

//
// The function "mlxSparsematrix" contains the feval interface for the
// "sparsematrix" M-function from file
// "d:\matlab6p5p1\work\book\dataconversion\mwsparsemaxtrix\mfiles\sparsematrix.
// m" (lines 1-6). The feval function calls the implementation version of
// sparsematrix through this function. This function processes any input
// arguments and passes them to the implementation version of the function,
// appearing above.
//
void mlxSparsematrix(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
    MW_BEGIN_MLX();
    {
        mwArray mprhs[1];
        mwArray mplhs[1];
        int i;
        mclCppUndefineArrays(1, mplhs);
        if (nlhs > 1) {
            error(
              mwVarargin(
                mwArray(
                  "Run-time Error: File: sparsematrix Line: 1 Column:"
                  " 1 The function \"sparsematrix\" was called with m"
                  "ore than the declared number of outputs (1).")));
        }
        if (nrhs > 1) {
            error(
              mwVarargin(
                mwArray(
                  "Run-time Error: File: sparsematrix Line: 1 Column"
                  ": 1 The function \"sparsematrix\" was called with"
                  " more than the declared number of inputs (1).")));
        }
        for (i = 0; i < 1 && i < nrhs; ++i) {
            mprhs[i] = mwArray(prhs[i], 0);
        }
        for (; i < 1; ++i) {
            mprhs[i].MakeDIN();
        }
        mplhs[0] = Msparsematrix(nlhs, mprhs[0]);
        plhs[0] = mplhs[0].FreezeData();
    }
    MW_END_MLX();
}

//
// The function "Msparsematrix" is the implementation version of the
// "sparsematrix" M-function from file
// "d:\matlab6p5p1\work\book\dataconversion\mwsparsemaxtrix\mfiles\sparsematrix.
// m" (lines 1-6). 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 [y]=change2sparse(x)
//
static mwArray Msparsematrix(int nargout_, mwArray x) {
    mclMlineEnterFunction(
      "d:\\matlab6p5p1\\work\\book\\dataconversion"
      "\\mwsparsemaxtrix\\mfiles\\sparsematrix.m",
      "sparsematrix")
    mwLocalFunctionTable save_local_function_table_
      = &_local_function_table_sparsematrix;
    mwArray y = mwArray::UNDEFINED;
    mwArray n = mwArray::UNDEFINED;
    mwArray m = mwArray::UNDEFINED;
    mwArray x1 = mwArray::UNDEFINED;
    mwArray j = mwArray::UNDEFINED;
    mwArray i = mwArray::UNDEFINED;
    //
    // %function [y]=change2sparse(x)
    // [i,j,x1]=find(x);
    //
    mclMline(3);
    i = find(&j, &x1, mwVa(x, "x"));
    //
    // [m,n]=size(x);
    //
    mclMline(4);
    size(mwVarargout(m, n), mwVa(x, "x"));
    //
    // y=sparse(i,j,x1,m,n);
    //
    mclMline(5);
    y
      = sparse(
          mwVv(i, "i"),
          mwVv(j, "j"),
          mwVv(x1, "x1"),
          mwVv(m, "m"),
          mwVv(n, "n"));
    mwValidateOutput(y, 1, nargout_, "y", "sparsematrix");
    mclMlineFunctionReturn()
    return y;
    mclMlineExitFunctionReturn();
}

⌨️ 快捷键说明

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