📄 linearsystemlib.c
字号:
/*
* MATLAB Compiler: 4.0 (R14)
* Date: Sun Aug 08 17:27:41 2004
* Arguments: "-B" "macro_default" "-B" "csharedlib:linearsystemlib" "-W"
* "lib:linearsystemlib" "-T" "link:lib" "mydiag.m" "myextractmatrix.m"
* "myfull.m" "mylu.m" "mymldivide.m" "mymrdivide.m" "mysparse.m" "myspdiags.m"
*/
#include <stdio.h>
#include "linearsystemlib.h"
#ifdef __cplusplus
extern "C" {
#endif
extern const unsigned char __MCC_linearsystemlib_public_data[];
extern const char *__MCC_linearsystemlib_name_data;
extern const char *__MCC_linearsystemlib_root_data;
extern const unsigned char __MCC_linearsystemlib_session_data[];
extern const char *__MCC_linearsystemlib_matlabpath_data[];
extern const int __MCC_linearsystemlib_matlabpath_data_count;
extern const char *__MCC_linearsystemlib_mcr_runtime_options[];
extern const int __MCC_linearsystemlib_mcr_runtime_option_count;
extern const char *__MCC_linearsystemlib_mcr_application_options[];
extern const int __MCC_linearsystemlib_mcr_application_option_count;
#ifdef __cplusplus
}
#endif
static HMCRINSTANCE _mcr_inst = NULL;
#if defined( _MSC_VER) || defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__LCC__)
#include <windows.h>
static char path_to_dll[_MAX_PATH];
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, void *pv)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
char szDllPath[_MAX_PATH];
char szDir[_MAX_DIR];
if (GetModuleFileName(hInstance, szDllPath, _MAX_PATH) > 0)
{
_splitpath(szDllPath, path_to_dll, szDir, NULL, NULL);
strcat(path_to_dll, szDir);
}
else return FALSE;
}
else if (dwReason == DLL_PROCESS_DETACH)
{
}
return TRUE;
}
#endif
static int mclDefaultPrintHandler(const char *s)
{
return fwrite(s, sizeof(char), strlen(s), stdout);
}
static int mclDefaultErrorHandler(const char *s)
{
int written = 0, len = 0;
len = strlen(s);
written = fwrite(s, sizeof(char), len, stderr);
if (len > 0 && s[ len-1 ] != '\n')
written += fwrite("\n", sizeof(char), 1, stderr);
return written;
}
bool linearsystemlibInitializeWithHandlers(
mclOutputHandlerFcn error_handler,
mclOutputHandlerFcn print_handler
)
{
if (_mcr_inst != NULL)
return true;
if (!mclmcrInitialize())
return false;
if (!mclInitializeComponentInstance(&_mcr_inst,
__MCC_linearsystemlib_public_data,
__MCC_linearsystemlib_name_data,
__MCC_linearsystemlib_root_data,
__MCC_linearsystemlib_session_data,
__MCC_linearsystemlib_matlabpath_data,
__MCC_linearsystemlib_matlabpath_data_count,
__MCC_linearsystemlib_mcr_runtime_options,
__MCC_linearsystemlib_mcr_runtime_option_count,
true, NoObjectType, LibTarget,
path_to_dll, error_handler,
print_handler))
return false;
return true;
}
bool linearsystemlibInitialize(void)
{
return linearsystemlibInitializeWithHandlers(mclDefaultErrorHandler,
mclDefaultPrintHandler);
}
void linearsystemlibTerminate(void)
{
if (_mcr_inst != NULL)
mclTerminateInstance(&_mcr_inst);
}
void mlxMydiag(int nlhs, mxArray *plhs[], int nrhs, mxArray *prhs[])
{
mclFeval(_mcr_inst, "mydiag", nlhs, plhs, nrhs, prhs);
}
void mlxMyextractmatrix(int nlhs, mxArray *plhs[], int nrhs, mxArray *prhs[])
{
mclFeval(_mcr_inst, "myextractmatrix", nlhs, plhs, nrhs, prhs);
}
void mlxMyfull(int nlhs, mxArray *plhs[], int nrhs, mxArray *prhs[])
{
mclFeval(_mcr_inst, "myfull", nlhs, plhs, nrhs, prhs);
}
void mlxMylu(int nlhs, mxArray *plhs[], int nrhs, mxArray *prhs[])
{
mclFeval(_mcr_inst, "mylu", nlhs, plhs, nrhs, prhs);
}
void mlxMymldivide(int nlhs, mxArray *plhs[], int nrhs, mxArray *prhs[])
{
mclFeval(_mcr_inst, "mymldivide", nlhs, plhs, nrhs, prhs);
}
void mlxMymrdivide(int nlhs, mxArray *plhs[], int nrhs, mxArray *prhs[])
{
mclFeval(_mcr_inst, "mymrdivide", nlhs, plhs, nrhs, prhs);
}
void mlxMysparse(int nlhs, mxArray *plhs[], int nrhs, mxArray *prhs[])
{
mclFeval(_mcr_inst, "mysparse", nlhs, plhs, nrhs, prhs);
}
void mlxMyspdiags(int nlhs, mxArray *plhs[], int nrhs, mxArray *prhs[])
{
mclFeval(_mcr_inst, "myspdiags", nlhs, plhs, nrhs, prhs);
}
void mlfMydiag(int nargout, mxArray** X, mxArray* v, mxArray* k)
{
mclMlfFeval(_mcr_inst, "mydiag", nargout, 1, 2, X, v, k);
}
void mlfMyextractmatrix(int nargout, mxArray** B, mxArray* A, mxArray* rowa
, mxArray* rowb, mxArray* cola, mxArray* colb)
{
mclMlfFeval(_mcr_inst, "myextractmatrix", nargout,
1, 5, B, A, rowa, rowb, cola, colb);
}
void mlfMyfull(int nargout, mxArray** A, mxArray* S)
{
mclMlfFeval(_mcr_inst, "myfull", nargout, 1, 1, A, S);
}
void mlfMylu(int nargout, mxArray** L, mxArray** U, mxArray** P, mxArray* A)
{
mclMlfFeval(_mcr_inst, "mylu", nargout, 3, 1, L, U, P, A);
}
void mlfMymldivide(int nargout, mxArray** x, mxArray* A, mxArray* b)
{
mclMlfFeval(_mcr_inst, "mymldivide", nargout, 1, 2, x, A, b);
}
void mlfMymrdivide(int nargout, mxArray** x, mxArray* A, mxArray* b)
{
mclMlfFeval(_mcr_inst, "mymrdivide", nargout, 1, 2, x, A, b);
}
void mlfMysparse(int nargout, mxArray** S, mxArray* A)
{
mclMlfFeval(_mcr_inst, "mysparse", nargout, 1, 1, S, A);
}
void mlfMyspdiags(int nargout, mxArray** A, mxArray* B
, mxArray* d, mxArray* m, mxArray* n)
{
mclMlfFeval(_mcr_inst, "myspdiags", nargout, 1, 4, A, B, d, m, n);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -