mixlogsummex.cpp
来自「一个关于数据聚类和模式识别的程序,在生物化学,化学中因该都可以用到.希望对大家有」· C++ 代码 · 共 42 行
CPP
42 行
// This is equivalent to mixLogSum.m
// How to compile:
// MATLAB 7.1: mex mixLogSumMex.cpp d:/users/jang/c/lib/dcpr.cpp d:/users/jang/c/lib/utility.cpp -output mixLogSumMex.dll
// Others: mex mixLogSumMex.cpp d:/users/jang/c/lib/dcpr.cpp d:/users/jang/c/lib/utility.cpp
/* Roger Jang, 20070324 */
#include <math.h>
#include "mex.h"
#include "d:\users\jang\c\lib\dcpr\dcpr.h"
/* Input Arguments */
#define INPUT prhs[0]
/* Output Arguments */
#define OUTPUT plhs[0]
void mexFunction(
int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[])
{
double *input, *output;
int i, m, n;
/* Check for proper number of arguments */
if ((nrhs<1) || (nrhs>2))
mexErrMsgTxt("VECDIST requires one or two input arguments.");
else if (nlhs > 1)
mexErrMsgTxt("VECDIST requires one output argument.");
/* Check dimensions */
m = mxGetM(INPUT);
n = mxGetN(INPUT);
/* Create a matrix for the return argument */
OUTPUT = mxCreateDoubleMatrix(1, 1, mxREAL);
/* Assign pointers to the various parameters */
input = mxGetPr(INPUT);
output = mxGetPr(OUTPUT);
/* Do the actual computations */
output[0]=mixLogSum(input, m*n);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?