Upload original Matlab程序设计 course files (part 3)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
Files changed (50)
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/Random_generate/SPECRND.M+38-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/kruskal/MINTREEK.M+48-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/CandM/mrank.c+133-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/CandM/mrank.exe
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/CandM/mrank.h+34-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/CandM/mrank.m+5-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/CandM/mrankp.c+24-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/CandM/pkg.c+54-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/CandM/pkg.exports+4-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/CandM/pkg.h+34-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/CandM/pkg.mlib+15-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/c_mat/matcreat.c+33-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/c_mat/matcreat.dsp+88-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/c_mat/matcreat.dsw+29-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/c_mat/matcreat.ncb
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/c_mat/matcreat.opt
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/c_mat/matcreat.plg+33-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/c_mat/matcreate.c+7-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/c_mat/mexopts.bat+45-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/code/foo.m+7-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/code/fun.m+4-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/code/gasket.m+10-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/code/sample.m+3-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build/main.c+84-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build/main.h+34-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build/main.m+2-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build/main_main.c+40-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build/mrank.c+133-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build/mrank.h+34-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build/mrank.m+5-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build1/main.c+84-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build1/main.exe
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build1/main.h+34-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build1/main.m+2-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build1/main_main.c+40-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build1/mrank.c+139-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build1/mrank.h+34-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build1/mrank.m+6-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/magic.h+33-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/main.c+85-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/main.exe
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/main.h+35-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/main.m+2-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/main_main.c+44-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/mrank.c+141-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/mrank.h+35-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/mrank.m+6-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/my_rank.c+148-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/my_rank.h+35-3
- matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/my_rank.m+16-3
1231234567891011121314151617181920212223242526272829303132333435363738version https://git-lfs.github.com/spec/v1oid sha256:8d9768ac0c4be0dd78b27da821ddd51543ccaa9953207d7bb3d7169a7563ca42size 1035function r=specrnd(x,p,m,n)
% ���ɸ����ֲ��ɵ������
% r=specrnd(x,p)����һ�����Էֲ���P(x)=p�������
% r=specrnd(x,p,m,n)����m*n���������
% p��Ĭ��ֵΪ�ȸ���
% ���� �ֲ���
% �� 7 8 9 10
% p 0.1 0.2 0.4 0.3
% ���� specrnd([7 8 9 10],[0.1 0.2 0.4 0.3],10,10)
% ����100�������
% L. J. HU 9-10-1999
if nargin<4, n=1;end
if nargin<3, m=1;end
if nargin<2|isempty(p), p=1/length(x)*ones(size(x)); end;
[mx,nx]=size(x);[mp,np]=size(p);
sx=min(mx,nx);sp=min(mp,np);
if (mx~=mp)|(nx~=np),
error('size must agree');
end;
if (sx~=1)&(sx~=1),error('should be vector'); end;
x=x(:);
if any(x~=sort(x)), error('x should be acsend'); end;
if any((p<0)|(p>1)),error('p should be between 0 and 1'); end;
if abs(sum(p)-1)>1e-3,error('sum of p should be 1'); end;
r=zeros(m,n);lx=max(mx,nx);
s=rand(m,n);
cp=cumsum(p);
k=find(s<cp(1));r(k)=x(1);
k=find(s>=cp(lx-1));r(k)=x(lx);
for i=2:(lx-1),
k=find((s>=cp(i-1))&(s<cp(i)));
r(k)=x(i);
end
123123456789101112131415161718192021222324252627282930313233343536373839404142434445464748version https://git-lfs.github.com/spec/v1oid sha256:ac4fe2d894552bfb172e78e835f1ded4f2aa0193094be013902e489d7250be19size 1824function [Wt,Pp]=mintreek(n,W)
%ͼ������С������Kruskal�㷨 ����ͼ���� M-����
%��ʽ [Wt,Pp]=mintreek(n,W)��nΪͼ������,WΪͼ�Ĵ�Ȩ�ڽӾ�
% �����ɱߵ�������֮���Ȩ��inf��ʾ����ʾ��С�������ı�
% ����, WtΪ��С��������Ȩ,Pp(:,1:2)Ϊ��С�������ߵ�������,
% Pp(:,3)Ϊ��С�������ı�Ȩ,Pp(:,4)Ϊ��С�������ߵ����;
%��ͼ,��ɫ����Ϊ��С��������ͼ;
%����
% n=6;w=inf*ones(6);
% w(1,[2,3,4])=[6,1,5];w(2,[3,5])=[5,3];
% w(3,[4,5,6])=[5,6,4];w(4,6)=2;w(5,6)=6;
% [a,b]=mintreek(n,w)
% By X.D. Ding June 2000
tmpa=find(W~=inf);[tmpb,tmpc]=find(W~=inf);
w=W(tmpa);e=[tmpb,tmpc]; %w��W�з�infԪ�ذ��й��ɵ�����
%e��ÿһ��Ԫ�ر�ʾһ���ߵ�������������
[wa,wb]=sort(w);E=[e(wb,:),wa,wb];[nE,mE]=size(E);
temp=find(E(:,1)-E(:,2));E=E(temp,:);
P=E(1,:);k=length(E(:,1));
while (rank(E)>0)
temp1=max(E(1,2),E(1,1));temp2=min(E(1,2),E(1,1));
for i=1:k;
if (E(i,1)==temp1), E(i,1)=temp2; end;
if (E(i,2)==temp1), E(i,2)=temp2; end;
end;
a=find(E(:,1)-E(:,2));E=E(a,:);
if (rank(E)>0),P=[P;E(1,:)];k=length(E(:,1)); end;
end;
Wt=sum(P(:,3));Pp=[e(P(:,4),:),P(:,3:4)];
for i=1:length(P(:,3)); %��ʾ����vi���ej
disp([' ','e',num2str(P(i,4)),' ','(v',...
num2str(P(i,1)),' ','v',num2str(P(i,2)),')']);
end;
% �����ǻ�ͼ����
axis equal; hold on
[x,y]=cylinder(1,n);xm=min(x(1,:)); ym=min(y(1,:));
xx=max(x(1,:)); yy=max(y(1,:));
axis([xm-abs(xm)*0.15,xx+abs(xx)*0.15,ym-abs(ym)*0.15, yy+abs(yy)*0.15]); plot(x(1,:),y(1,:),'ko')
for i=1:n; temp=[' v',int2str(i)];
text(x(1,i),y(1,i),temp); end;
for i=1:nE; plot(x(1,e(i,:)),y(1,e(i,:)),'b'); end;
for i=1:length(P(:,4));
plot(x(1,Pp(i,1:2)),y(1,Pp(i,1:2)),'r'); end;
text(-0.35,-1.2,['��С��������ȨΪ',' ',num2str(Wt)]);
title('��ɫ����Ϊ��С������'); axis('off');hold off
123123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133version https://git-lfs.github.com/spec/v1oid sha256:2d0c68d11ca35b9aa13ca6e9ff7726916c5c66c8b4ab097f8f30f1a2ed2e1abfsize 4270/*
* MATLAB Compiler: 3.0
* Date: Sat Sep 04 22:31:38 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" "-t" "-W" "lib:Pkg" "-T"
* "link:exe" "-h" "mrank" "mrankp.c" "libmmfile.mlib"
*/
#include "mrank.h"
#include "libmatlbm.h"
#include "libmmfile.h"
static mxArray * _mxarray0_;
static mxArray * _mxarray1_;
void InitializeModule_mrank(void) {
_mxarray0_ = mclInitializeDouble(1.0);
_mxarray1_ = mclInitializeDoubleVector(0, 0, (double *)NULL);
}
void TerminateModule_mrank(void) {
mxDestroyArray(_mxarray1_);
mxDestroyArray(_mxarray0_);
}
static mxArray * Mmrank(int nargout_, mxArray * n);
_mexLocalFunctionTable _local_function_table_mrank
= { 0, (mexFunctionTableEntry *)NULL };
/*
* The function "mlfMrank" contains the normal interface for the "mrank"
* M-function from file "d:\work\candm\mrank.m" (lines 1-6). This function
* processes any input arguments and passes them to the implementation version
* of the function, appearing above.
*/
mxArray * mlfMrank(mxArray * n) {
int nargout = 1;
mxArray * r = NULL;
mlfEnterNewContext(0, 1, n);
r = Mmrank(nargout, n);
mlfRestorePreviousContext(0, 1, n);
return mlfReturnValue(r);
}
/*
* The function "mlxMrank" contains the feval interface for the "mrank"
* M-function from file "d:\work\candm\mrank.m" (lines 1-6). The feval function
* calls the implementation version of mrank through this function. This
* function processes any input arguments and passes them to the implementation
* version of the function, appearing above.
*/
void mlxMrank(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
mxArray * mprhs[1];
mxArray * mplhs[1];
int i;
if (nlhs > 1) {
mlfError(
mxCreateString(
"Run-time Error: File: mrank Line: 1 Column: 1 The function \"mrank"
"\" was called with more than the declared number of outputs (1)."),
NULL);
}
if (nrhs > 1) {
mlfError(
mxCreateString(
"Run-time Error: File: mrank Line: 1 Column: 1 The function \"mrank"
"\" was called with more than the declared number of inputs (1)."),
NULL);
}
for (i = 0; i < 1; ++i) {
mplhs[i] = NULL;
}
for (i = 0; i < 1 && i < nrhs; ++i) {
mprhs[i] = prhs[i];
}
for (; i < 1; ++i) {
mprhs[i] = NULL;
}
mlfEnterNewContext(0, 1, mprhs[0]);
mplhs[0] = Mmrank(nlhs, mprhs[0]);
mlfRestorePreviousContext(0, 1, mprhs[0]);
plhs[0] = mplhs[0];
}
/*
* The function "Mmrank" is the implementation version of the "mrank"
* M-function from file "d:\work\candm\mrank.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 r=mrank(n)
*/
static mxArray * Mmrank(int nargout_, mxArray * n) {
mexLocalFunctionTable save_local_function_table_
= mclSetCurrentLocalFunctionTable(&_local_function_table_mrank);
mxArray * r = NULL;
mxArray * k = NULL;
mclCopyArray(&n);
/*
* r=zeros(n,1);
*/
mlfAssign(&r, mlfZeros(mclVa(n, "n"), _mxarray0_, NULL));
/*
* for k=1:n
*/
{
int v_ = mclForIntStart(1);
int e_ = mclForIntEnd(mclVa(n, "n"));
if (v_ > e_) {
mlfAssign(&k, _mxarray1_);
} else {
/*
* r(k)=rank(magic(k));
* end
*/
for (; ; ) {
mclIntArrayAssign1(
&r, mlfRank(mlfMagic(mlfScalar(v_)), NULL), v_);
if (v_ == e_) {
break;
}
++v_;
}
mlfAssign(&k, mlfScalar(v_));
}
}
mclValidateOutput(r, 1, nargout_, "r", "mrank");
mxDestroyArray(k);
mxDestroyArray(n);
mclSetCurrentLocalFunctionTable(save_local_function_table_);
return r;
}12312345678910111213141516171819202122232425262728293031323334version https://git-lfs.github.com/spec/v1oid sha256:5d6343cab6cfc356e8317debfb58548a3e06e42190da0d4e004cff3653a09acasize 833/*
* MATLAB Compiler: 3.0
* Date: Sat Sep 04 22:31:38 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" "-t" "-W" "lib:Pkg" "-T"
* "link:exe" "-h" "mrank" "mrankp.c" "libmmfile.mlib"
*/
#ifndef MLF_V2
#define MLF_V2 1
#endif
#ifndef __mrank_h
#define __mrank_h 1
#ifdef __cplusplus
extern "C" {
#endif
#include "libmatlb.h"
extern void InitializeModule_mrank(void);
extern void TerminateModule_mrank(void);
extern _mexLocalFunctionTable _local_function_table_mrank;
extern mxArray * mlfMrank(mxArray * n);
extern void mlxMrank(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]);
#ifdef __cplusplus
}
#endif
#endif12312345version https://git-lfs.github.com/spec/v1oid sha256:b9b4c8f0f8d32865faf703ce6c62bca1b31a39442183710a4a329b62a92f032dsize 78function r=mrank(n)
r=zeros(n,1);
for k=1:n
r(k)=rank(magic(k));
end123123456789101112131415161718192021222324version https://git-lfs.github.com/spec/v1oid sha256:7450ba9236609c1348e7b49af68fcac8e9f07edc1c8ce9f6cb8ea7f5661b908bsize 347#include <stdio.h>
#include <math.h>
#include "matlab.h"
extern mxArray*mlfMrank(mxArray*);
main(int argc,char **argv)
{
mxArray *N;
mxArray *R;
int n;
if(argc>=2){
n=atoi(argv[1]);
}else {
n=12;
}
PkgInitialize();
N=mlfScalar(n);
R=mlfMrank(N);
mlfPrintMatrix(R);
mxDestroyArray(N);
mxDestroyArray(R);
PkgTerminate();
}123123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354version https://git-lfs.github.com/spec/v1oid sha256:a2154c571a09fa9a33a364e6f9e091c56e513a876fc670d1ed014d5c2a03a1aesize 1900/*
* MATLAB Compiler: 3.0
* Date: Sat Sep 04 22:31:38 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" "-t" "-W" "lib:Pkg" "-T"
* "link:exe" "-h" "mrank" "mrankp.c" "libmmfile.mlib"
*/
#ifndef MLF_V2
#define MLF_V2 1
#endif
#include "libmatlb.h"
#include "Pkg.h"
#include "mrank.h"
#include "libmmfile.h"
extern _mex_information _lib_info;
static mexFunctionTableEntry function_table[1]
= { { "mrank", mlxMrank, 1, 1, &_local_function_table_mrank } };
static _mexInitTermTableEntry init_term_table[2]
= { { libmmfileInitialize, libmmfileTerminate },
{ InitializeModule_mrank, TerminateModule_mrank } };
static int _reference_count = 0;
_mex_information _lib_info
= { 1, 1, function_table, 0, NULL, 0, NULL, 2, init_term_table };
/*
* The function "PkgInitialize" is a Compiler-generated initialization wrapper.
* It is used to initialize the state of Compiler-generated functions so that
* those functions can be called from code not generated by the Compiler. The
* function(s) initialized can be found in the function_table variable,
* appearing above.
*/
void PkgInitialize(void) {
mclLibInit("Pkg", &_reference_count, &_lib_info);
}
/*
* The function "PkgTerminate" is a Compiler-generated termination wrapper. It
* is used to clean up the state that was set up by the initialization wrapper
* function, also found in this file. Call this function after having called
* the initialization wrapper function and after having finished making all
* calls to the Compiler-generated function(s) found in the function_table
* variable, appearing above.
*/
void PkgTerminate(void) {
mclLibTerm("Pkg", &_reference_count, &_lib_info);
}1231234version https://git-lfs.github.com/spec/v1oid sha256:fff53ac75d45ed48acf4a7ffa34a311fd89eba82a5b4507c2424d5552091fb53size 49mlfMrank
mlxMrank
PkgInitialize
PkgTerminate12312345678910111213141516171819202122232425262728293031323334version https://git-lfs.github.com/spec/v1oid sha256:21b9bfa9096219fb538da07b58c3bdba37f7420b4f238cb7267d61ecf47c530asize 830/*
* MATLAB Compiler: 3.0
* Date: Sat Sep 04 22:31:38 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" "-t" "-W" "lib:Pkg" "-T"
* "link:exe" "-h" "mrank" "mrankp.c" "libmmfile.mlib"
*/
#ifndef MLF_V2
#define MLF_V2 1
#endif
#ifndef __pkg_h
#define __pkg_h 1
#ifdef __cplusplus
extern "C" {
#endif
#include "libmatlb.h"
extern void InitializeModule_pkg(void);
extern void TerminateModule_pkg(void);
extern mxArray * mlfMrank(mxArray * n);
extern void mlxMrank(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]);
extern void PkgInitialize(void);
extern void PkgTerminate(void);
#ifdef __cplusplus
}
#endif
#endif123123456789101112131415version https://git-lfs.github.com/spec/v1oid sha256:241eb767122a42a9e8bcd49bf3fac233dc38fa87b58ef4d9bb6fb8cd1cf17cd1size 430/* start of pkg.mlib */
target = "C";
include = "pkg.h";
timestamp = "Sat Sep 04 22:31:38 2004";
mrank { /* M function name */
nin = 1; /* number of M inputs */
nout = 1; /* number of M outputs */
scope = global; /* where function defined */
cname = mlfMrank; /* mxArray in and out */
nargout = 0; /* nargout not used */
}
/* end of pkg.mlib */123123456789101112131415161718192021222324252627282930313233version https://git-lfs.github.com/spec/v1oid sha256:1af887de7bc60eeec4fc3d78c994a97eaea1f77136e4bd9223646c594fe1cc38size 904#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "mat.h"
#define BUFSIZE 256
int main()
{
MATFile *pmat;
mxArray *pa1,*pa2,*pa3;
double data[9]={1.0,4.0,7.0,2.0,5.0,8.0,3.0,6.0,9.0};
double data1[4]={1,2,3,4};
const char *file="mattest.mat";
char str[BUFSIZE];
int status;
pmat=matOpen(file,"w");
pa1=mxCreateDoubleMatrix(3,3,mxREAL);
mxSetName(pa1,"LocalDouble");
pa2=mxCreateDoubleMatrix(2,2,mxREAL);
mxSetName(pa2,"GlobalDouble");
p3=mxCreateString("How to use mat files!");
mxSetName(pa3,"LocalString");
memcpy((void *)(mxGetPr(pa1)),(void *)data,sizeof(data));
memcpy((void *)(mxGetPr(pa2)),(void *)data1,sizeof(data1));
status=matPutArray(pmat,pa1);
status=matPutArrayAsGlobal(pmat,pa2);
status=matPutArray(pmat,pa3);
mxDestroyArray(pa1);
mxDestroyArray(pa2);
mxDestroyArray(pa3);
matClose(pmat);
return (EXIT_SUCCESS);
}12312345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788version https://git-lfs.github.com/spec/v1oid sha256:76133c8f4947783fca2c0a9e0a3d301b8232480744c1b05269f9922b43aad801size 3423# Microsoft Developer Studio Project File - Name="matcreat" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=matcreat - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "matcreat.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "matcreat.mak" CFG="matcreat - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "matcreat - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "matcreat - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "matcreat - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x804 /d "NDEBUG"
# ADD RSC /l 0x804 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
!ELSEIF "$(CFG)" == "matcreat - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
# ADD BASE RSC /l 0x804 /d "_DEBUG"
# ADD RSC /l 0x804 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "matcreat - Win32 Release"
# Name "matcreat - Win32 Debug"
# Begin Source File
SOURCE=.\matcreat.c
# End Source File
# End Target
# End Project1231234567891011121314151617181920212223242526272829version https://git-lfs.github.com/spec/v1oid sha256:312c3953a882593bdf45915818b79049d600fc8b416d2213a68bc7f3c7133294size 539Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "matcreat"=.\matcreat.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################
123123456789101112131415161718192021222324252627282930313233version https://git-lfs.github.com/spec/v1oid sha256:c5833411c8b3cf952ad3fe54c4aa1793061243f577d822fa5999d6e378046430size 1229<html>
<body>
<pre>
<h1>Build Log</h1>
<h3>
--------------------Configuration: matcreat - Win32 Debug--------------------
</h3>
<h3>Command Lines</h3>
Creating temporary file "C:\DOCUME~1\ZXC\LOCALS~1\Temp\RSP1E.tmp" with contents
[
/nologo /MLd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Fp"Debug/matcreat.pch" /YX /Fo"Debug/" /Fd"Debug/" /FD /GZ /c
"D:\work\c_mat\matcreat.c"
]
Creating command line "cl.exe @C:\DOCUME~1\ZXC\LOCALS~1\Temp\RSP1E.tmp"
Creating temporary file "C:\DOCUME~1\ZXC\LOCALS~1\Temp\RSP1F.tmp" with contents
[
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:yes /pdb:"Debug/matcreat.pdb" /debug /machine:I386 /out:"Debug/matcreat.exe" /pdbtype:sept
.\Debug\matcreat.obj
]
Creating command line "link.exe @C:\DOCUME~1\ZXC\LOCALS~1\Temp\RSP1F.tmp"
<h3>Output Window</h3>
Compiling...
matcreat.c
d:\work\c_mat\matcreat.c(4) : fatal error C1083: Cannot open include file: 'mat.h': No such file or directory
Error executing cl.exe.
<h3>Results</h3>
matcreat.exe - 1 error(s), 0 warning(s)
</pre>
</body>
</html>1231234567version https://git-lfs.github.com/spec/v1oid sha256:f2d188870eef7e2613c2288f1d1c4f1576341bd5c7ad8c9d14fb454c712bb6cbsize 284--------------------Configuration: matcreat - Win32 Debug--------------------
Compiling...
matcreat.c
d:\work\c_mat\matcreat.c(4) : fatal error C1083: Cannot open include file: 'mat.h': No such file or directory
Error executing cl.exe.
matcreat.exe - 1 error(s), 0 warning(s)123123456789101112131415161718192021222324252627282930313233343536373839404142434445version https://git-lfs.github.com/spec/v1oid sha256:e71c9e05e02be576b40c8e543fc6dadda3709d40d680e70ca8ecd2def6e4689asize 1738@echo off
rem MSVC60ENGMATOPTS.BAT
rem
rem Compile and link options used for building standalone engine or MAT programs
rem with Microsoft Visual C++ compiler version 6.0
rem
rem $Revision: 1.5 $ $Date: 2000/05/23 18:31:32 $
rem
rem ********************************************************************
rem General parameters
rem ********************************************************************
set MATLAB=%MATLAB%
set MSVCDir=%MSVCDir%
set MSDevDir=%MSVCDir%\..\Common\msdev98
set PATH=%MSVCDir%\BIN;%MSDevDir%\bin;%PATH%
set INCLUDE=%MSVCDir%\INCLUDE;%MSVCDir%\MFC\INCLUDE;%MSVCDir%\ATL\INCLUDE;%INCLUDE%
set LIB=%MSVCDir%\LIB;%MSVCDir%\MFC\LIB;%LIB%
rem ********************************************************************
rem Compiler parameters
rem ********************************************************************
set COMPILER=cl
set OPTIMFLAGS=-O2 -DNDEBUG
set DEBUGFLAGS=-Zi -Fd"%OUTDIR%%MEX_NAME%.pdb"
set COMPFLAGS=-c -Zp8 -G5 -W3 -nologo
set NAME_OBJECT=/Fo
rem ********************************************************************
rem Linker parameters
rem ********************************************************************
set LIBLOC=%MATLAB%\extern\lib\win32\microsoft\msvc60
set LINKER=link
set LINKFLAGS= kernel32.lib user32.lib gdi32.lib /LIBPATH:"%LIBLOC%" libmx.lib libmat.lib libeng.lib /nologo
set LINKOPTIMFLAGS=
set LINKDEBUGFLAGS=/debug
set LINK_FILE=
set LINK_LIB=
set NAME_OUTPUT="/out:%OUTDIR%%MEX_NAME%.exe"
set RSP_FILE_INDICATOR=@
rem ********************************************************************
rem Resource compiler parameters
rem ********************************************************************
set RC_COMPILER=
set RC_LINKER=1231234567version https://git-lfs.github.com/spec/v1oid sha256:99d6947a6126306ad8ca6d40dfc2a4a069dc64fe56bdf89b89fcdcb2af67d477size 105function [a,b]=foo(x,y)
if nargout==0
elseif nargout==1
a=x;
elseif nargout==2
a=x;b=y;
end1231234version https://git-lfs.github.com/spec/v1oid sha256:a4afc8c27e1338f4ff15e12f4d505f505119d42623a0f04aef0b6d2adcf80aeesize 68function a=fun(b)
a(1)=b(1).*b(1);
a(2)=b(1)+b(2);
a(3)=b(2)/4;12312345678910version https://git-lfs.github.com/spec/v1oid sha256:2faa5abeb836f941e20defc52a9b58cd0609b8130210008b80e80eb1475a838fsize 303function theImage=gasket(numPoints)
theImage =zeros(1000,1000);
corners=[866 1;1 500;866 1000];
startPoint=[866 1];
theRand=rand(numPoints,1);
theRand=ceil(theRand*3);
for i=1:numPoints
startPoint=floor((corners(theRand(i),:)+startPoint)/2);
theImage(startPoint(1),startPoint(2))=1;
end123123version https://git-lfs.github.com/spec/v1oid sha256:cb969b7d7a89ef788771a1a0d8aaf6d43f163e5f1fc1b56ad01f7b6a615d6947size 46function y=sample(varargin)
varargin{:}
y=0;123123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384version https://git-lfs.github.com/spec/v1oid sha256:35e013917561a8e49f5fbb115b07c4ca69ddd63fafc4cb597374adfb9aa6c199size 2831/*
* MATLAB Compiler: 3.0
* Date: Sat Sep 04 21:45:06 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" "-W" "main" "-L"
* "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "-c" "main" "mrank"
*/
#include "main.h"
#include "mrank.h"
static mxArray * _mxarray0_;
void InitializeModule_main(void) {
_mxarray0_ = mclInitializeDouble(5.0);
}
void TerminateModule_main(void) {
mxDestroyArray(_mxarray0_);
}
static void Mmain(void);
_mexLocalFunctionTable _local_function_table_main
= { 0, (mexFunctionTableEntry *)NULL };
/*
* The function "mlfMain" contains the normal interface for the "main"
* M-function from file "d:\work\m_build\main.m" (lines 1-2). This function
* processes any input arguments and passes them to the implementation version
* of the function, appearing above.
*/
void mlfMain(void) {
mlfEnterNewContext(0, 0);
Mmain();
mlfRestorePreviousContext(0, 0);
}
/*
* The function "mlxMain" contains the feval interface for the "main"
* M-function from file "d:\work\m_build\main.m" (lines 1-2). The feval
* function calls the implementation version of main through this function.
* This function processes any input arguments and passes them to the
* implementation version of the function, appearing above.
*/
void mlxMain(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
if (nlhs > 0) {
mlfError(
mxCreateString(
"Run-time Error: File: main Line: 1 Column: 1 The function \"main\""
" was called with more than the declared number of outputs (0)."),
NULL);
}
if (nrhs > 0) {
mlfError(
mxCreateString(
"Run-time Error: File: main Line: 1 Column: 1 The function \"main"
"\" was called with more than the declared number of inputs (0)."),
NULL);
}
mlfEnterNewContext(0, 0);
Mmain();
mlfRestorePreviousContext(0, 0);
}
/*
* The function "Mmain" is the implementation version of the "main" M-function
* from file "d:\work\m_build\main.m" (lines 1-2). 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 main
*/
static void Mmain(void) {
mexLocalFunctionTable save_local_function_table_
= mclSetCurrentLocalFunctionTable(&_local_function_table_main);
mxArray * r = NULL;
/*
* r=mrank(5);
*/
mlfAssign(&r, mlfMrank(_mxarray0_));
mxDestroyArray(r);
mclSetCurrentLocalFunctionTable(save_local_function_table_);
}12312345678910111213141516171819202122232425262728293031323334version https://git-lfs.github.com/spec/v1oid sha256:3582c88542c47e6065d37649d6225d7d5fbb8b5ea61669aa37de3c730d5064e6size 826/*
* MATLAB Compiler: 3.0
* Date: Sat Sep 04 21:45:06 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" "-W" "main" "-L"
* "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "-c" "main" "mrank"
*/
#ifndef MLF_V2
#define MLF_V2 1
#endif
#ifndef __main_h
#define __main_h 1
#ifdef __cplusplus
extern "C" {
#endif
#include "libmatlb.h"
extern void InitializeModule_main(void);
extern void TerminateModule_main(void);
extern _mexLocalFunctionTable _local_function_table_main;
extern void mlfMain(void);
extern void mlxMain(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]);
#ifdef __cplusplus
}
#endif
#endif12312version https://git-lfs.github.com/spec/v1oid sha256:d1d937473dd4b819fdacd7f5e9968f16e00bcec7bb9ee78382e45cd58b35d022size 26function main
r=mrank(5);12312345678910111213141516171819202122232425262728293031323334353637383940version https://git-lfs.github.com/spec/v1oid sha256:5cbd6fb2d2fa72fce271e14a3c2949ea297c0f9dbda9bc9ec461f8e3fd313af8size 1397/*
* MATLAB Compiler: 3.0
* Date: Sat Sep 04 21:45:06 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" "-W" "main" "-L"
* "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "-c" "main" "mrank"
*/
#ifndef MLF_V2
#define MLF_V2 1
#endif
#include "libmatlb.h"
#include "main.h"
#include "mrank.h"
#include "libmmfile.h"
extern _mex_information _main_info;
static mexFunctionTableEntry function_table[2]
= { { "main", mlxMain, 0, 0, &_local_function_table_main },
{ "mrank", mlxMrank, 1, 1, &_local_function_table_mrank } };
static _mexInitTermTableEntry init_term_table[3]
= { { libmmfileInitialize, libmmfileTerminate },
{ InitializeModule_main, TerminateModule_main },
{ InitializeModule_mrank, TerminateModule_mrank } };
_mex_information _main_info
= { 1, 2, function_table, 0, NULL, 0, NULL, 3, init_term_table };
/*
* The function "main" is a Compiler-generated main wrapper, suitable for
* building a stand-alone application. It calls a library function to perform
* initialization, call the main function, and perform library termination.
*/
int main(int argc, const char * * argv) {
return mclMain(argc, argv, mlxMain, 0, &_main_info);
}123123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133version https://git-lfs.github.com/spec/v1oid sha256:1569ba1f54078af17fcd83817c558f2605eedee18fa2cd9b1d84af303669fc98size 4288/*
* MATLAB Compiler: 3.0
* Date: Sat Sep 04 21:45:06 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" "-W" "main" "-L"
* "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "-c" "main" "mrank"
*/
#include "mrank.h"
#include "libmatlbm.h"
#include "libmmfile.h"
static mxArray * _mxarray0_;
static mxArray * _mxarray1_;
void InitializeModule_mrank(void) {
_mxarray0_ = mclInitializeDouble(1.0);
_mxarray1_ = mclInitializeDoubleVector(0, 0, (double *)NULL);
}
void TerminateModule_mrank(void) {
mxDestroyArray(_mxarray1_);
mxDestroyArray(_mxarray0_);
}
static mxArray * Mmrank(int nargout_, mxArray * n);
_mexLocalFunctionTable _local_function_table_mrank
= { 0, (mexFunctionTableEntry *)NULL };
/*
* The function "mlfMrank" contains the normal interface for the "mrank"
* M-function from file "d:\work\m_build\mrank.m" (lines 1-5). This function
* processes any input arguments and passes them to the implementation version
* of the function, appearing above.
*/
mxArray * mlfMrank(mxArray * n) {
int nargout = 1;
mxArray * r = NULL;
mlfEnterNewContext(0, 1, n);
r = Mmrank(nargout, n);
mlfRestorePreviousContext(0, 1, n);
return mlfReturnValue(r);
}
/*
* The function "mlxMrank" contains the feval interface for the "mrank"
* M-function from file "d:\work\m_build\mrank.m" (lines 1-5). The feval
* function calls the implementation version of mrank through this function.
* This function processes any input arguments and passes them to the
* implementation version of the function, appearing above.
*/
void mlxMrank(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
mxArray * mprhs[1];
mxArray * mplhs[1];
int i;
if (nlhs > 1) {
mlfError(
mxCreateString(
"Run-time Error: File: mrank Line: 1 Column: 1 The function \"mrank"
"\" was called with more than the declared number of outputs (1)."),
NULL);
}
if (nrhs > 1) {
mlfError(
mxCreateString(
"Run-time Error: File: mrank Line: 1 Column: 1 The function \"mrank"
"\" was called with more than the declared number of inputs (1)."),
NULL);
}
for (i = 0; i < 1; ++i) {
mplhs[i] = NULL;
}
for (i = 0; i < 1 && i < nrhs; ++i) {
mprhs[i] = prhs[i];
}
for (; i < 1; ++i) {
mprhs[i] = NULL;
}
mlfEnterNewContext(0, 1, mprhs[0]);
mplhs[0] = Mmrank(nlhs, mprhs[0]);
mlfRestorePreviousContext(0, 1, mprhs[0]);
plhs[0] = mplhs[0];
}
/*
* The function "Mmrank" is the implementation version of the "mrank"
* M-function from file "d:\work\m_build\mrank.m" (lines 1-5). 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 r=mrank(n)
*/
static mxArray * Mmrank(int nargout_, mxArray * n) {
mexLocalFunctionTable save_local_function_table_
= mclSetCurrentLocalFunctionTable(&_local_function_table_mrank);
mxArray * r = NULL;
mxArray * k = NULL;
mclCopyArray(&n);
/*
* r=zeros(n,1);
*/
mlfAssign(&r, mlfZeros(mclVa(n, "n"), _mxarray0_, NULL));
/*
* for k=1:n
*/
{
int v_ = mclForIntStart(1);
int e_ = mclForIntEnd(mclVa(n, "n"));
if (v_ > e_) {
mlfAssign(&k, _mxarray1_);
} else {
/*
* r(k)=rank(magic(k));
* end
*/
for (; ; ) {
mclIntArrayAssign1(
&r, mlfRank(mlfMagic(mlfScalar(v_)), NULL), v_);
if (v_ == e_) {
break;
}
++v_;
}
mlfAssign(&k, mlfScalar(v_));
}
}
mclValidateOutput(r, 1, nargout_, "r", "mrank");
mxDestroyArray(k);
mxDestroyArray(n);
mclSetCurrentLocalFunctionTable(save_local_function_table_);
return r;
}12312345678910111213141516171819202122232425262728293031323334version https://git-lfs.github.com/spec/v1oid sha256:a1351f3a107ec1c9249a310dc92a34008d45be9bc0526fe29c2a1cbb48444988size 845/*
* MATLAB Compiler: 3.0
* Date: Sat Sep 04 21:45:06 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" "-W" "main" "-L"
* "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "-c" "main" "mrank"
*/
#ifndef MLF_V2
#define MLF_V2 1
#endif
#ifndef __mrank_h
#define __mrank_h 1
#ifdef __cplusplus
extern "C" {
#endif
#include "libmatlb.h"
extern void InitializeModule_mrank(void);
extern void TerminateModule_mrank(void);
extern _mexLocalFunctionTable _local_function_table_mrank;
extern mxArray * mlfMrank(mxArray * n);
extern void mlxMrank(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]);
#ifdef __cplusplus
}
#endif
#endif12312345version https://git-lfs.github.com/spec/v1oid sha256:2a4640b9b0e8dc4835a136db8aebf0efd703307f35b73a4043aa845779386d72size 76function r=mrank(n)
r=zeros(n,1);
for k=1:n
r(k)=rank(magic(k));
end123123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384version https://git-lfs.github.com/spec/v1oid sha256:6b6d595cce862bd264dfaab1ea424146411b5a272bdb3c563cf00e359b540fbasize 2829/*
* MATLAB Compiler: 3.0
* Date: Sat Sep 04 21:49:59 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" "-W" "main" "-L"
* "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "main" "mrank"
*/
#include "main.h"
#include "mrank.h"
static mxArray * _mxarray0_;
void InitializeModule_main(void) {
_mxarray0_ = mclInitializeDouble(5.0);
}
void TerminateModule_main(void) {
mxDestroyArray(_mxarray0_);
}
static void Mmain(void);
_mexLocalFunctionTable _local_function_table_main
= { 0, (mexFunctionTableEntry *)NULL };
/*
* The function "mlfMain" contains the normal interface for the "main"
* M-function from file "d:\work\m_build1\main.m" (lines 1-2). This function
* processes any input arguments and passes them to the implementation version
* of the function, appearing above.
*/
void mlfMain(void) {
mlfEnterNewContext(0, 0);
Mmain();
mlfRestorePreviousContext(0, 0);
}
/*
* The function "mlxMain" contains the feval interface for the "main"
* M-function from file "d:\work\m_build1\main.m" (lines 1-2). The feval
* function calls the implementation version of main through this function.
* This function processes any input arguments and passes them to the
* implementation version of the function, appearing above.
*/
void mlxMain(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
if (nlhs > 0) {
mlfError(
mxCreateString(
"Run-time Error: File: main Line: 1 Column: 1 The function \"main\""
" was called with more than the declared number of outputs (0)."),
NULL);
}
if (nrhs > 0) {
mlfError(
mxCreateString(
"Run-time Error: File: main Line: 1 Column: 1 The function \"main"
"\" was called with more than the declared number of inputs (0)."),
NULL);
}
mlfEnterNewContext(0, 0);
Mmain();
mlfRestorePreviousContext(0, 0);
}
/*
* The function "Mmain" is the implementation version of the "main" M-function
* from file "d:\work\m_build1\main.m" (lines 1-2). 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 main
*/
static void Mmain(void) {
mexLocalFunctionTable save_local_function_table_
= mclSetCurrentLocalFunctionTable(&_local_function_table_main);
mxArray * r = NULL;
/*
* r=mrank(5);
*/
mlfAssign(&r, mlfMrank(_mxarray0_));
mxDestroyArray(r);
mclSetCurrentLocalFunctionTable(save_local_function_table_);
}12312345678910111213141516171819202122232425262728293031323334version https://git-lfs.github.com/spec/v1oid sha256:ddd16c21ad190d9efd33e506c5e92542619c5087cd4f53546336b3e1a8268a4csize 821/*
* MATLAB Compiler: 3.0
* Date: Sat Sep 04 21:49:59 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" "-W" "main" "-L"
* "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "main" "mrank"
*/
#ifndef MLF_V2
#define MLF_V2 1
#endif
#ifndef __main_h
#define __main_h 1
#ifdef __cplusplus
extern "C" {
#endif
#include "libmatlb.h"
extern void InitializeModule_main(void);
extern void TerminateModule_main(void);
extern _mexLocalFunctionTable _local_function_table_main;
extern void mlfMain(void);
extern void mlxMain(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]);
#ifdef __cplusplus
}
#endif
#endif12312version https://git-lfs.github.com/spec/v1oid sha256:d1d937473dd4b819fdacd7f5e9968f16e00bcec7bb9ee78382e45cd58b35d022size 26function main
r=mrank(5);12312345678910111213141516171819202122232425262728293031323334353637383940version https://git-lfs.github.com/spec/v1oid sha256:981346841f54dc053579a31aa71ff9133c2e52b24a5b413b2554d64cc5168253size 1392/*
* MATLAB Compiler: 3.0
* Date: Sat Sep 04 21:49:59 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" "-W" "main" "-L"
* "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "main" "mrank"
*/
#ifndef MLF_V2
#define MLF_V2 1
#endif
#include "libmatlb.h"
#include "main.h"
#include "mrank.h"
#include "libmmfile.h"
extern _mex_information _main_info;
static mexFunctionTableEntry function_table[2]
= { { "main", mlxMain, 0, 0, &_local_function_table_main },
{ "mrank", mlxMrank, 1, 1, &_local_function_table_mrank } };
static _mexInitTermTableEntry init_term_table[3]
= { { libmmfileInitialize, libmmfileTerminate },
{ InitializeModule_main, TerminateModule_main },
{ InitializeModule_mrank, TerminateModule_mrank } };
_mex_information _main_info
= { 1, 2, function_table, 0, NULL, 0, NULL, 3, init_term_table };
/*
* The function "main" is a Compiler-generated main wrapper, suitable for
* building a stand-alone application. It calls a library function to perform
* initialization, call the main function, and perform library termination.
*/
int main(int argc, const char * * argv) {
return mclMain(argc, argv, mlxMain, 0, &_main_info);
}123123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139version https://git-lfs.github.com/spec/v1oid sha256:d9a12dec37a30e2541d26a49aa98d16024cafc2ce7cab557edbf0690f19f6fefsize 4406/*
* MATLAB Compiler: 3.0
* Date: Sat Sep 04 21:49:59 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" "-W" "main" "-L"
* "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "main" "mrank"
*/
#include "mrank.h"
#include "libmatlbm.h"
#include "libmmfile.h"
static mxArray * _mxarray0_;
static mxArray * _mxarray1_;
void InitializeModule_mrank(void) {
_mxarray0_ = mclInitializeDouble(1.0);
_mxarray1_ = mclInitializeDoubleVector(0, 0, (double *)NULL);
}
void TerminateModule_mrank(void) {
mxDestroyArray(_mxarray1_);
mxDestroyArray(_mxarray0_);
}
static mxArray * Mmrank(int nargout_, mxArray * n);
_mexLocalFunctionTable _local_function_table_mrank
= { 0, (mexFunctionTableEntry *)NULL };
/*
* The function "mlfMrank" contains the normal interface for the "mrank"
* M-function from file "d:\work\m_build1\mrank.m" (lines 1-6). This function
* processes any input arguments and passes them to the implementation version
* of the function, appearing above.
*/
mxArray * mlfMrank(mxArray * n) {
int nargout = 1;
mxArray * r = NULL;
mlfEnterNewContext(0, 1, n);
r = Mmrank(nargout, n);
mlfRestorePreviousContext(0, 1, n);
return mlfReturnValue(r);
}
/*
* The function "mlxMrank" contains the feval interface for the "mrank"
* M-function from file "d:\work\m_build1\mrank.m" (lines 1-6). The feval
* function calls the implementation version of mrank through this function.
* This function processes any input arguments and passes them to the
* implementation version of the function, appearing above.
*/
void mlxMrank(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
mxArray * mprhs[1];
mxArray * mplhs[1];
int i;
if (nlhs > 1) {
mlfError(
mxCreateString(
"Run-time Error: File: mrank Line: 1 Column: 1 The function \"mrank"
"\" was called with more than the declared number of outputs (1)."),
NULL);
}
if (nrhs > 1) {
mlfError(
mxCreateString(
"Run-time Error: File: mrank Line: 1 Column: 1 The function \"mrank"
"\" was called with more than the declared number of inputs (1)."),
NULL);
}
for (i = 0; i < 1; ++i) {
mplhs[i] = NULL;
}
for (i = 0; i < 1 && i < nrhs; ++i) {
mprhs[i] = prhs[i];
}
for (; i < 1; ++i) {
mprhs[i] = NULL;
}
mlfEnterNewContext(0, 1, mprhs[0]);
mplhs[0] = Mmrank(nlhs, mprhs[0]);
mlfRestorePreviousContext(0, 1, mprhs[0]);
plhs[0] = mplhs[0];
}
/*
* The function "Mmrank" is the implementation version of the "mrank"
* M-function from file "d:\work\m_build1\mrank.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 r=mrank(n)
*/
static mxArray * Mmrank(int nargout_, mxArray * n) {
mexLocalFunctionTable save_local_function_table_
= mclSetCurrentLocalFunctionTable(&_local_function_table_mrank);
mxArray * r = NULL;
mxArray * ans = NULL;
mxArray * k = NULL;
mclCopyArray(&n);
/*
* r=zeros(n,1);
*/
mlfAssign(&r, mlfZeros(mclVa(n, "n"), _mxarray0_, NULL));
/*
* for k=1:n
*/
{
int v_ = mclForIntStart(1);
int e_ = mclForIntEnd(mclVa(n, "n"));
if (v_ > e_) {
mlfAssign(&k, _mxarray1_);
} else {
/*
* r(k)=rank(magic(k));
* end
*/
for (; ; ) {
mclIntArrayAssign1(
&r, mlfRank(mlfMagic(mlfScalar(v_)), NULL), v_);
if (v_ == e_) {
break;
}
++v_;
}
mlfAssign(&k, mlfScalar(v_));
}
}
/*
* r
*/
mclPrintArray(mclVv(r, "r"), "r");
mclValidateOutput(r, 1, nargout_, "r", "mrank");
mxDestroyArray(k);
mxDestroyArray(ans);
mxDestroyArray(n);
mclSetCurrentLocalFunctionTable(save_local_function_table_);
return r;
}12312345678910111213141516171819202122232425262728293031323334version https://git-lfs.github.com/spec/v1oid sha256:bfb70999a7fb2f4acb07e9ba77824d8a1b140709804beb332ac036b3083233besize 840/*
* MATLAB Compiler: 3.0
* Date: Sat Sep 04 21:49:59 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" "-W" "main" "-L"
* "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "main" "mrank"
*/
#ifndef MLF_V2
#define MLF_V2 1
#endif
#ifndef __mrank_h
#define __mrank_h 1
#ifdef __cplusplus
extern "C" {
#endif
#include "libmatlb.h"
extern void InitializeModule_mrank(void);
extern void TerminateModule_mrank(void);
extern _mexLocalFunctionTable _local_function_table_mrank;
extern mxArray * mlfMrank(mxArray * n);
extern void mlxMrank(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]);
#ifdef __cplusplus
}
#endif
#endif123123456version https://git-lfs.github.com/spec/v1oid sha256:b9bc273b361e6cddc1f1bb66d46c11d2f1017b5a6e8453b349ad4a44056835e5size 79function r=mrank(n)
r=zeros(n,1);
for k=1:n
r(k)=rank(magic(k));
end
r123123456789101112131415161718192021222324252627282930313233version https://git-lfs.github.com/spec/v1oid sha256:68d744fb07a62ad8c8a3c7a631f945e7e1cdaed68ca8dbd35b5d0bd84fc2d43csize 765/*
* MATLAB Compiler: 3.0
* Date: Sat Sep 04 21:59:48 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" "-t" "mrank"
*/
#ifndef MLF_V2
#define MLF_V2 1
#endif
#ifndef __magic_h
#define __magic_h 1
#ifdef __cplusplus
extern "C" {
#endif
#include "libmatlb.h"
extern void InitializeModule_magic(void);
extern void TerminateModule_magic(void);
extern _mexLocalFunctionTable _local_function_table_magic;
extern mxArray * mlfMagic(mxArray * n);
extern void mlxMagic(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]);
#ifdef __cplusplus
}
#endif
#endif12312345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485version https://git-lfs.github.com/spec/v1oid sha256:81c449421388f40f8de3e8ae2fa81e5f91c57f50f86dc849aeab9e5fc8f9e204size 2849/*
* MATLAB Compiler: 3.0
* Date: Sat Sep 04 22:04:33 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" "-W" "main" "-L"
* "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "main.m" "my_rank.m"
* "mrank.m"
*/
#include "main.h"
#include "mrank.h"
static mxArray * _mxarray0_;
void InitializeModule_main(void) {
_mxarray0_ = mclInitializeDouble(5.0);
}
void TerminateModule_main(void) {
mxDestroyArray(_mxarray0_);
}
static void Mmain(void);
_mexLocalFunctionTable _local_function_table_main
= { 0, (mexFunctionTableEntry *)NULL };
/*
* The function "mlfMain" contains the normal interface for the "main"
* M-function from file "d:\work\m_build2\main.m" (lines 1-2). This function
* processes any input arguments and passes them to the implementation version
* of the function, appearing above.
*/
void mlfMain(void) {
mlfEnterNewContext(0, 0);
Mmain();
mlfRestorePreviousContext(0, 0);
}
/*
* The function "mlxMain" contains the feval interface for the "main"
* M-function from file "d:\work\m_build2\main.m" (lines 1-2). The feval
* function calls the implementation version of main through this function.
* This function processes any input arguments and passes them to the
* implementation version of the function, appearing above.
*/
void mlxMain(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
if (nlhs > 0) {
mlfError(
mxCreateString(
"Run-time Error: File: main Line: 1 Column: 1 The function \"main\""
" was called with more than the declared number of outputs (0)."),
NULL);
}
if (nrhs > 0) {
mlfError(
mxCreateString(
"Run-time Error: File: main Line: 1 Column: 1 The function \"main"
"\" was called with more than the declared number of inputs (0)."),
NULL);
}
mlfEnterNewContext(0, 0);
Mmain();
mlfRestorePreviousContext(0, 0);
}
/*
* The function "Mmain" is the implementation version of the "main" M-function
* from file "d:\work\m_build2\main.m" (lines 1-2). 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 main
*/
static void Mmain(void) {
mexLocalFunctionTable save_local_function_table_
= mclSetCurrentLocalFunctionTable(&_local_function_table_main);
mxArray * r = NULL;
/*
* r=mrank(5);
*/
mlfAssign(&r, mlfMrank(_mxarray0_));
mxDestroyArray(r);
mclSetCurrentLocalFunctionTable(save_local_function_table_);
}1231234567891011121314151617181920212223242526272829303132333435version https://git-lfs.github.com/spec/v1oid sha256:4517b2e5ae6d693322258bc95701bc6b5ca578fd537d2048f70705193550e22bsize 841/*
* MATLAB Compiler: 3.0
* Date: Sat Sep 04 22:04:33 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" "-W" "main" "-L"
* "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "main.m" "my_rank.m"
* "mrank.m"
*/
#ifndef MLF_V2
#define MLF_V2 1
#endif
#ifndef __main_h
#define __main_h 1
#ifdef __cplusplus
extern "C" {
#endif
#include "libmatlb.h"
extern void InitializeModule_main(void);
extern void TerminateModule_main(void);
extern _mexLocalFunctionTable _local_function_table_main;
extern void mlfMain(void);
extern void mlxMain(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]);
#ifdef __cplusplus
}
#endif
#endif12312version https://git-lfs.github.com/spec/v1oid sha256:d1d937473dd4b819fdacd7f5e9968f16e00bcec7bb9ee78382e45cd58b35d022size 26function main
r=mrank(5);1231234567891011121314151617181920212223242526272829303132333435363738394041424344version https://git-lfs.github.com/spec/v1oid sha256:b60e3fe38de08ced27aeeb06101a7f1c3f03c7a859f2f14eeeac0a2bf5cc767asize 1568/*
* MATLAB Compiler: 3.0
* Date: Sat Sep 04 22:04:33 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" "-W" "main" "-L"
* "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "main.m" "my_rank.m"
* "mrank.m"
*/
#ifndef MLF_V2
#define MLF_V2 1
#endif
#include "libmatlb.h"
#include "main.h"
#include "my_rank.h"
#include "mrank.h"
#include "libmmfile.h"
extern _mex_information _main_info;
static mexFunctionTableEntry function_table[3]
= { { "main", mlxMain, 0, 0, &_local_function_table_main },
{ "my_rank", mlxMy_rank, 2, 1, &_local_function_table_my_rank },
{ "mrank", mlxMrank, 1, 1, &_local_function_table_mrank } };
static _mexInitTermTableEntry init_term_table[4]
= { { libmmfileInitialize, libmmfileTerminate },
{ InitializeModule_main, TerminateModule_main },
{ InitializeModule_my_rank, TerminateModule_my_rank },
{ InitializeModule_mrank, TerminateModule_mrank } };
_mex_information _main_info
= { 1, 3, function_table, 0, NULL, 0, NULL, 4, init_term_table };
/*
* The function "main" is a Compiler-generated main wrapper, suitable for
* building a stand-alone application. It calls a library function to perform
* initialization, call the main function, and perform library termination.
*/
int main(int argc, const char * * argv) {
return mclMain(argc, argv, mlxMain, 0, &_main_info);
}123123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141version https://git-lfs.github.com/spec/v1oid sha256:5f70c82ae276eaa802d52e893a9c7f77cccfe2171ae226818c2fd73264c19106size 4454/*
* MATLAB Compiler: 3.0
* Date: Sat Sep 04 22:04:33 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" "-W" "main" "-L"
* "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "main.m" "my_rank.m"
* "mrank.m"
*/
#include "mrank.h"
#include "libmatlbm.h"
#include "libmmfile.h"
#include "my_rank.h"
static mxArray * _mxarray0_;
static mxArray * _mxarray1_;
void InitializeModule_mrank(void) {
_mxarray0_ = mclInitializeDouble(1.0);
_mxarray1_ = mclInitializeDoubleVector(0, 0, (double *)NULL);
}
void TerminateModule_mrank(void) {
mxDestroyArray(_mxarray1_);
mxDestroyArray(_mxarray0_);
}
static mxArray * Mmrank(int nargout_, mxArray * n);
_mexLocalFunctionTable _local_function_table_mrank
= { 0, (mexFunctionTableEntry *)NULL };
/*
* The function "mlfMrank" contains the normal interface for the "mrank"
* M-function from file "d:\work\m_build2\mrank.m" (lines 1-6). This function
* processes any input arguments and passes them to the implementation version
* of the function, appearing above.
*/
mxArray * mlfMrank(mxArray * n) {
int nargout = 1;
mxArray * r = NULL;
mlfEnterNewContext(0, 1, n);
r = Mmrank(nargout, n);
mlfRestorePreviousContext(0, 1, n);
return mlfReturnValue(r);
}
/*
* The function "mlxMrank" contains the feval interface for the "mrank"
* M-function from file "d:\work\m_build2\mrank.m" (lines 1-6). The feval
* function calls the implementation version of mrank through this function.
* This function processes any input arguments and passes them to the
* implementation version of the function, appearing above.
*/
void mlxMrank(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
mxArray * mprhs[1];
mxArray * mplhs[1];
int i;
if (nlhs > 1) {
mlfError(
mxCreateString(
"Run-time Error: File: mrank Line: 1 Column: 1 The function \"mrank"
"\" was called with more than the declared number of outputs (1)."),
NULL);
}
if (nrhs > 1) {
mlfError(
mxCreateString(
"Run-time Error: File: mrank Line: 1 Column: 1 The function \"mrank"
"\" was called with more than the declared number of inputs (1)."),
NULL);
}
for (i = 0; i < 1; ++i) {
mplhs[i] = NULL;
}
for (i = 0; i < 1 && i < nrhs; ++i) {
mprhs[i] = prhs[i];
}
for (; i < 1; ++i) {
mprhs[i] = NULL;
}
mlfEnterNewContext(0, 1, mprhs[0]);
mplhs[0] = Mmrank(nlhs, mprhs[0]);
mlfRestorePreviousContext(0, 1, mprhs[0]);
plhs[0] = mplhs[0];
}
/*
* The function "Mmrank" is the implementation version of the "mrank"
* M-function from file "d:\work\m_build2\mrank.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 r=mrank(n)
*/
static mxArray * Mmrank(int nargout_, mxArray * n) {
mexLocalFunctionTable save_local_function_table_
= mclSetCurrentLocalFunctionTable(&_local_function_table_mrank);
mxArray * r = NULL;
mxArray * ans = NULL;
mxArray * k = NULL;
mclCopyArray(&n);
/*
* r=zeros(n,1);
*/
mlfAssign(&r, mlfZeros(mclVa(n, "n"), _mxarray0_, NULL));
/*
* for k=1:n
*/
{
int v_ = mclForIntStart(1);
int e_ = mclForIntEnd(mclVa(n, "n"));
if (v_ > e_) {
mlfAssign(&k, _mxarray1_);
} else {
/*
* r(k)=my_rank(magic(k));
* end
*/
for (; ; ) {
mclIntArrayAssign1(
&r, mlfMy_rank(mlfMagic(mlfScalar(v_)), NULL), v_);
if (v_ == e_) {
break;
}
++v_;
}
mlfAssign(&k, mlfScalar(v_));
}
}
/*
* r
*/
mclPrintArray(mclVv(r, "r"), "r");
mclValidateOutput(r, 1, nargout_, "r", "mrank");
mxDestroyArray(k);
mxDestroyArray(ans);
mxDestroyArray(n);
mclSetCurrentLocalFunctionTable(save_local_function_table_);
return r;
}1231234567891011121314151617181920212223242526272829303132333435version https://git-lfs.github.com/spec/v1oid sha256:81dc7166e2430c9487d57da402939bc525cfd48dcaa377bd719d8d745493817bsize 860/*
* MATLAB Compiler: 3.0
* Date: Sat Sep 04 22:04:33 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" "-W" "main" "-L"
* "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "main.m" "my_rank.m"
* "mrank.m"
*/
#ifndef MLF_V2
#define MLF_V2 1
#endif
#ifndef __mrank_h
#define __mrank_h 1
#ifdef __cplusplus
extern "C" {
#endif
#include "libmatlb.h"
extern void InitializeModule_mrank(void);
extern void TerminateModule_mrank(void);
extern _mexLocalFunctionTable _local_function_table_mrank;
extern mxArray * mlfMrank(mxArray * n);
extern void mlxMrank(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]);
#ifdef __cplusplus
}
#endif
#endif123123456version https://git-lfs.github.com/spec/v1oid sha256:7c21249a56e9fc5daab7420ca5315335ac829cdde4bfbdfb1c8ab7d64e1f8933size 82function r=mrank(n)
r=zeros(n,1);
for k=1:n
r(k)=my_rank(magic(k));
end
r123123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148version https://git-lfs.github.com/spec/v1oid sha256:5391f7993c9261097498ebac474835689900a52a5099096cc735a42ce168cef7size 4949/*
* MATLAB Compiler: 3.0
* Date: Sat Sep 04 22:04:33 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" "-W" "main" "-L"
* "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "main.m" "my_rank.m"
* "mrank.m"
*/
#include "my_rank.h"
#include "libmatlbm.h"
static mxArray * _mxarray0_;
void InitializeModule_my_rank(void) {
_mxarray0_ = mclInitializeDouble(2.220446049250313e-16);
}
void TerminateModule_my_rank(void) {
mxDestroyArray(_mxarray0_);
}
static mxArray * Mmy_rank(int nargout_, mxArray * A, mxArray * tol);
_mexLocalFunctionTable _local_function_table_my_rank
= { 0, (mexFunctionTableEntry *)NULL };
/*
* The function "mlfMy_rank" contains the normal interface for the "my_rank"
* M-function from file "d:\work\m_build2\my_rank.m" (lines 1-16). This
* function processes any input arguments and passes them to the implementation
* version of the function, appearing above.
*/
mxArray * mlfMy_rank(mxArray * A, mxArray * tol) {
int nargout = 1;
mxArray * r = NULL;
mlfEnterNewContext(0, 2, A, tol);
r = Mmy_rank(nargout, A, tol);
mlfRestorePreviousContext(0, 2, A, tol);
return mlfReturnValue(r);
}
/*
* The function "mlxMy_rank" contains the feval interface for the "my_rank"
* M-function from file "d:\work\m_build2\my_rank.m" (lines 1-16). The feval
* function calls the implementation version of my_rank through this function.
* This function processes any input arguments and passes them to the
* implementation version of the function, appearing above.
*/
void mlxMy_rank(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: my_rank Line: 1 Column: "
"1 The function \"my_rank\" was called with mor"
"e than the declared number of outputs (1)."),
NULL);
}
if (nrhs > 2) {
mlfError(
mxCreateString(
"Run-time Error: File: my_rank Line: 1 Column:"
" 1 The function \"my_rank\" was called with m"
"ore 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] = Mmy_rank(nlhs, mprhs[0], mprhs[1]);
mlfRestorePreviousContext(0, 2, mprhs[0], mprhs[1]);
plhs[0] = mplhs[0];
}
/*
* The function "Mmy_rank" is the implementation version of the "my_rank"
* M-function from file "d:\work\m_build2\my_rank.m" (lines 1-16). 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 r = my_rank(A,tol)
*/
static mxArray * Mmy_rank(int nargout_, mxArray * A, mxArray * tol) {
mexLocalFunctionTable save_local_function_table_
= mclSetCurrentLocalFunctionTable(&_local_function_table_my_rank);
int nargin_ = mclNargin(2, A, tol, NULL);
mxArray * r = NULL;
mxArray * s = NULL;
mclCopyArray(&A);
mclCopyArray(&tol);
/*
* %RANK Matrix rank.
* % RANK(A) provides an estimate of the number of linearly
* % independent rows or columns of a matrix A.
* % RANK(A,tol) is the number of singular values of A
* % that are larger than tol.
* % RANK(A) uses the default tol = max(size(A)) * norm(A) * eps.
*
* % Copyright 1984-2002 The MathWorks, Inc.
* % $Revision: 5.11 $ $Date: 2002/04/08 23:51:52 $
*
* s = svd(A);
*/
mlfAssign(&s, mlfSvd(NULL, NULL, mclVa(A, "A"), NULL));
/*
* if nargin==1
*/
if (nargin_ == 1) {
/*
* tol = max(size(A)') * max(s) * eps;
*/
mlfAssign(
&tol,
mclMtimes(
mclMtimes(
mlfMax(
NULL,
mlfCtranspose(
mlfSize(mclValueVarargout(), mclVa(A, "A"), NULL)),
NULL,
NULL),
mlfMax(NULL, mclVv(s, "s"), NULL, NULL)),
_mxarray0_));
/*
* end
*/
}
/*
* r = sum(s > tol);
*/
mlfAssign(&r, mlfSum(mclGt(mclVv(s, "s"), mclVa(tol, "tol")), NULL));
mclValidateOutput(r, 1, nargout_, "r", "my_rank");
mxDestroyArray(s);
mxDestroyArray(tol);
mxDestroyArray(A);
mclSetCurrentLocalFunctionTable(save_local_function_table_);
return r;
}1231234567891011121314151617181920212223242526272829303132333435version https://git-lfs.github.com/spec/v1oid sha256:dd8bac85dfacfcc9ad33b76e78bc874e5bd87d80274b0bc40b777baf5fe363e5size 889/*
* MATLAB Compiler: 3.0
* Date: Sat Sep 04 22:04:33 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" "-W" "main" "-L"
* "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "main.m" "my_rank.m"
* "mrank.m"
*/
#ifndef MLF_V2
#define MLF_V2 1
#endif
#ifndef __my_rank_h
#define __my_rank_h 1
#ifdef __cplusplus
extern "C" {
#endif
#include "libmatlb.h"
extern void InitializeModule_my_rank(void);
extern void TerminateModule_my_rank(void);
extern _mexLocalFunctionTable _local_function_table_my_rank;
extern mxArray * mlfMy_rank(mxArray * A, mxArray * tol);
extern void mlxMy_rank(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]);
#ifdef __cplusplus
}
#endif
#endif12312345678910111213141516version https://git-lfs.github.com/spec/v1oid sha256:70accc275d0f3f67f67d4a1768830ead385ffa9a416a96b4595412d2ba09676asize 503function r = my_rank(A,tol)
%RANK Matrix rank.
% RANK(A) provides an estimate of the number of linearly
% independent rows or columns of a matrix A.
% RANK(A,tol) is the number of singular values of A
% that are larger than tol.
% RANK(A) uses the default tol = max(size(A)) * norm(A) * eps.
% Copyright 1984-2002 The MathWorks, Inc.
% $Revision: 5.11 $ $Date: 2002/04/08 23:51:52 $
s = svd(A);
if nargin==1
tol = max(size(A)') * max(s) * eps;
end
r = sum(s > tol);matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/Random_generate/SPECRND.M+38-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/kruskal/MINTREEK.M+48-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/CandM/mrank.c+133-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/CandM/mrank.exe
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/CandM/mrank.h+34-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/CandM/mrank.m+5-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/CandM/mrankp.c+24-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/CandM/pkg.c+54-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/CandM/pkg.exports+4-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/CandM/pkg.h+34-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/CandM/pkg.mlib+15-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/c_mat/matcreat.c+33-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/c_mat/matcreat.dsp+88-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/c_mat/matcreat.dsw+29-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/c_mat/matcreat.ncb
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/c_mat/matcreat.opt
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/c_mat/matcreat.plg+33-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/c_mat/matcreate.c+7-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/c_mat/mexopts.bat+45-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/code/foo.m+7-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/code/fun.m+4-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/code/gasket.m+10-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/code/sample.m+3-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build/main.c+84-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build/main.h+34-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build/main.m+2-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build/main_main.c+40-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build/mrank.c+133-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build/mrank.h+34-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build/mrank.m+5-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build1/main.c+84-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build1/main.exe
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build1/main.h+34-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build1/main.m+2-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build1/main_main.c+40-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build1/mrank.c+139-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build1/mrank.h+34-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build1/mrank.m+6-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/magic.h+33-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/main.c+85-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/main.exe
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/main.h+35-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/main.m+2-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/main_main.c+44-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/mrank.c+141-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/mrank.h+35-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/mrank.m+6-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/my_rank.c+148-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/my_rank.h+35-3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/my_rank.m+16-3