Beifengdo commited on
Commit
196cdc6
·
verified ·
1 Parent(s): 05ac0d0

Upload original Matlab程序设计 course files (part 3)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/Random_generate/SPECRND.M +38 -3
  2. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/kruskal/MINTREEK.M +48 -3
  3. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/CandM/mrank.c +133 -3
  4. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/CandM/mrank.exe +0 -0
  5. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/CandM/mrank.h +34 -3
  6. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/CandM/mrank.m +5 -3
  7. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/CandM/mrankp.c +24 -3
  8. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/CandM/pkg.c +54 -3
  9. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/CandM/pkg.exports +4 -3
  10. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/CandM/pkg.h +34 -3
  11. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/CandM/pkg.mlib +15 -3
  12. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/c_mat/matcreat.c +33 -3
  13. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/c_mat/matcreat.dsp +88 -3
  14. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/c_mat/matcreat.dsw +29 -3
  15. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/c_mat/matcreat.ncb +0 -0
  16. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/c_mat/matcreat.opt +0 -0
  17. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/c_mat/matcreat.plg +33 -3
  18. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/c_mat/matcreate.c +7 -3
  19. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/c_mat/mexopts.bat +45 -3
  20. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/code/foo.m +7 -3
  21. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/code/fun.m +4 -3
  22. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/code/gasket.m +10 -3
  23. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/code/sample.m +3 -3
  24. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build/main.c +84 -3
  25. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build/main.h +34 -3
  26. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build/main.m +2 -3
  27. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build/main_main.c +40 -3
  28. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build/mrank.c +133 -3
  29. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build/mrank.h +34 -3
  30. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build/mrank.m +5 -3
  31. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build1/main.c +84 -3
  32. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build1/main.exe +0 -0
  33. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build1/main.h +34 -3
  34. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build1/main.m +2 -3
  35. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build1/main_main.c +40 -3
  36. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build1/mrank.c +139 -3
  37. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build1/mrank.h +34 -3
  38. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build1/mrank.m +6 -3
  39. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/magic.h +33 -3
  40. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/main.c +85 -3
  41. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/main.exe +0 -0
  42. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/main.h +35 -3
  43. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/main.m +2 -3
  44. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/main_main.c +44 -3
  45. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/mrank.c +141 -3
  46. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/mrank.h +35 -3
  47. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/mrank.m +6 -3
  48. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/my_rank.c +148 -3
  49. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/my_rank.h +35 -3
  50. matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/my_rank.m +16 -3
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/Random_generate/SPECRND.M CHANGED
@@ -1,3 +1,38 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:8d9768ac0c4be0dd78b27da821ddd51543ccaa9953207d7bb3d7169a7563ca42
3
- size 1035
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function r=specrnd(x,p,m,n)
2
+ % ���ɸ����ֲ��ɵ������
3
+ % r=specrnd(x,p)����һ�����Էֲ���P(x)=p�������
4
+ % r=specrnd(x,p,m,n)����m*n���������
5
+ % p��Ĭ��ֵΪ�ȸ���
6
+ % ���� �ֲ���
7
+ % �� 7 8 9 10
8
+ % p 0.1 0.2 0.4 0.3
9
+ % ���� specrnd([7 8 9 10],[0.1 0.2 0.4 0.3],10,10)
10
+ % ����100�������
11
+
12
+ % L. J. HU 9-10-1999
13
+
14
+ if nargin<4, n=1;end
15
+ if nargin<3, m=1;end
16
+ if nargin<2|isempty(p), p=1/length(x)*ones(size(x)); end;
17
+
18
+ [mx,nx]=size(x);[mp,np]=size(p);
19
+ sx=min(mx,nx);sp=min(mp,np);
20
+ if (mx~=mp)|(nx~=np),
21
+ error('size must agree');
22
+ end;
23
+ if (sx~=1)&(sx~=1),error('should be vector'); end;
24
+ x=x(:);
25
+ if any(x~=sort(x)), error('x should be acsend'); end;
26
+ if any((p<0)|(p>1)),error('p should be between 0 and 1'); end;
27
+ if abs(sum(p)-1)>1e-3,error('sum of p should be 1'); end;
28
+
29
+ r=zeros(m,n);lx=max(mx,nx);
30
+ s=rand(m,n);
31
+ cp=cumsum(p);
32
+ k=find(s<cp(1));r(k)=x(1);
33
+ k=find(s>=cp(lx-1));r(k)=x(lx);
34
+ for i=2:(lx-1),
35
+ k=find((s>=cp(i-1))&(s<cp(i)));
36
+ r(k)=x(i);
37
+ end
38
+
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/kruskal/MINTREEK.M CHANGED
@@ -1,3 +1,48 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:ac4fe2d894552bfb172e78e835f1ded4f2aa0193094be013902e489d7250be19
3
- size 1824
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function [Wt,Pp]=mintreek(n,W)
2
+ %ͼ������С������Kruskal�㷨 ����ͼ���� M-����
3
+ %��ʽ [Wt,Pp]=mintreek(n,W)��nΪͼ������,WΪͼ�Ĵ�Ȩ�ڽӾ�
4
+ % �󣬲����ɱߵ�������֮���Ȩ��inf��ʾ����ʾ��С�������ı߼�
5
+ % ����, WtΪ��С��������Ȩ,Pp(:,1:2)Ϊ��С�������ߵ�������,
6
+ % Pp(:,3)Ϊ��С�������ı�Ȩ,Pp(:,4)Ϊ��С�������ߵ����;
7
+ %��ͼ,��ɫ����Ϊ��С��������ͼ;
8
+ %����
9
+ % n=6;w=inf*ones(6);
10
+ % w(1,[2,3,4])=[6,1,5];w(2,[3,5])=[5,3];
11
+ % w(3,[4,5,6])=[5,6,4];w(4,6)=2;w(5,6)=6;
12
+ % [a,b]=mintreek(n,w)
13
+
14
+ % By X.D. Ding June 2000
15
+
16
+ tmpa=find(W~=inf);[tmpb,tmpc]=find(W~=inf);
17
+ w=W(tmpa);e=[tmpb,tmpc]; %w��W�з�infԪ�ذ��й��ɵ�����
18
+ %e��ÿһ��Ԫ�ر�ʾһ���ߵ�������������
19
+ [wa,wb]=sort(w);E=[e(wb,:),wa,wb];[nE,mE]=size(E);
20
+ temp=find(E(:,1)-E(:,2));E=E(temp,:);
21
+ P=E(1,:);k=length(E(:,1));
22
+ while (rank(E)>0)
23
+ temp1=max(E(1,2),E(1,1));temp2=min(E(1,2),E(1,1));
24
+ for i=1:k;
25
+ if (E(i,1)==temp1), E(i,1)=temp2; end;
26
+ if (E(i,2)==temp1), E(i,2)=temp2; end;
27
+ end;
28
+ a=find(E(:,1)-E(:,2));E=E(a,:);
29
+ if (rank(E)>0),P=[P;E(1,:)];k=length(E(:,1)); end;
30
+ end;
31
+ Wt=sum(P(:,3));Pp=[e(P(:,4),:),P(:,3:4)];
32
+ for i=1:length(P(:,3)); %��ʾ����vi���ej
33
+ disp([' ','e',num2str(P(i,4)),' ','(v',...
34
+ num2str(P(i,1)),' ','v',num2str(P(i,2)),')']);
35
+ end;
36
+ % �����ǻ�ͼ����
37
+ axis equal; hold on
38
+ [x,y]=cylinder(1,n);xm=min(x(1,:)); ym=min(y(1,:));
39
+ xx=max(x(1,:)); yy=max(y(1,:));
40
+ 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')
41
+ for i=1:n; temp=[' v',int2str(i)];
42
+ text(x(1,i),y(1,i),temp); end;
43
+ for i=1:nE; plot(x(1,e(i,:)),y(1,e(i,:)),'b'); end;
44
+ for i=1:length(P(:,4));
45
+ plot(x(1,Pp(i,1:2)),y(1,Pp(i,1:2)),'r'); end;
46
+ text(-0.35,-1.2,['��С��������ȨΪ',' ',num2str(Wt)]);
47
+ title('��ɫ����Ϊ��С������'); axis('off');hold off
48
+
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/CandM/mrank.c CHANGED
@@ -1,3 +1,133 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:2d0c68d11ca35b9aa13ca6e9ff7726916c5c66c8b4ab097f8f30f1a2ed2e1abf
3
- size 4270
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * MATLAB Compiler: 3.0
3
+ * Date: Sat Sep 04 22:31:38 2004
4
+ * Arguments: "-B" "macro_default" "-O" "all" "-O" "fold_scalar_mxarrays:on"
5
+ * "-O" "fold_non_scalar_mxarrays:on" "-O" "optimize_integer_for_loops:on" "-O"
6
+ * "array_indexing:on" "-O" "optimize_conditionals:on" "-t" "-W" "lib:Pkg" "-T"
7
+ * "link:exe" "-h" "mrank" "mrankp.c" "libmmfile.mlib"
8
+ */
9
+ #include "mrank.h"
10
+ #include "libmatlbm.h"
11
+ #include "libmmfile.h"
12
+ static mxArray * _mxarray0_;
13
+ static mxArray * _mxarray1_;
14
+
15
+ void InitializeModule_mrank(void) {
16
+ _mxarray0_ = mclInitializeDouble(1.0);
17
+ _mxarray1_ = mclInitializeDoubleVector(0, 0, (double *)NULL);
18
+ }
19
+
20
+ void TerminateModule_mrank(void) {
21
+ mxDestroyArray(_mxarray1_);
22
+ mxDestroyArray(_mxarray0_);
23
+ }
24
+
25
+ static mxArray * Mmrank(int nargout_, mxArray * n);
26
+
27
+ _mexLocalFunctionTable _local_function_table_mrank
28
+ = { 0, (mexFunctionTableEntry *)NULL };
29
+
30
+ /*
31
+ * The function "mlfMrank" contains the normal interface for the "mrank"
32
+ * M-function from file "d:\work\candm\mrank.m" (lines 1-6). This function
33
+ * processes any input arguments and passes them to the implementation version
34
+ * of the function, appearing above.
35
+ */
36
+ mxArray * mlfMrank(mxArray * n) {
37
+ int nargout = 1;
38
+ mxArray * r = NULL;
39
+ mlfEnterNewContext(0, 1, n);
40
+ r = Mmrank(nargout, n);
41
+ mlfRestorePreviousContext(0, 1, n);
42
+ return mlfReturnValue(r);
43
+ }
44
+
45
+ /*
46
+ * The function "mlxMrank" contains the feval interface for the "mrank"
47
+ * M-function from file "d:\work\candm\mrank.m" (lines 1-6). The feval function
48
+ * calls the implementation version of mrank through this function. This
49
+ * function processes any input arguments and passes them to the implementation
50
+ * version of the function, appearing above.
51
+ */
52
+ void mlxMrank(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
53
+ mxArray * mprhs[1];
54
+ mxArray * mplhs[1];
55
+ int i;
56
+ if (nlhs > 1) {
57
+ mlfError(
58
+ mxCreateString(
59
+ "Run-time Error: File: mrank Line: 1 Column: 1 The function \"mrank"
60
+ "\" was called with more than the declared number of outputs (1)."),
61
+ NULL);
62
+ }
63
+ if (nrhs > 1) {
64
+ mlfError(
65
+ mxCreateString(
66
+ "Run-time Error: File: mrank Line: 1 Column: 1 The function \"mrank"
67
+ "\" was called with more than the declared number of inputs (1)."),
68
+ NULL);
69
+ }
70
+ for (i = 0; i < 1; ++i) {
71
+ mplhs[i] = NULL;
72
+ }
73
+ for (i = 0; i < 1 && i < nrhs; ++i) {
74
+ mprhs[i] = prhs[i];
75
+ }
76
+ for (; i < 1; ++i) {
77
+ mprhs[i] = NULL;
78
+ }
79
+ mlfEnterNewContext(0, 1, mprhs[0]);
80
+ mplhs[0] = Mmrank(nlhs, mprhs[0]);
81
+ mlfRestorePreviousContext(0, 1, mprhs[0]);
82
+ plhs[0] = mplhs[0];
83
+ }
84
+
85
+ /*
86
+ * The function "Mmrank" is the implementation version of the "mrank"
87
+ * M-function from file "d:\work\candm\mrank.m" (lines 1-6). It contains the
88
+ * actual compiled code for that M-function. It is a static function and must
89
+ * only be called from one of the interface functions, appearing below.
90
+ */
91
+ /*
92
+ * function r=mrank(n)
93
+ */
94
+ static mxArray * Mmrank(int nargout_, mxArray * n) {
95
+ mexLocalFunctionTable save_local_function_table_
96
+ = mclSetCurrentLocalFunctionTable(&_local_function_table_mrank);
97
+ mxArray * r = NULL;
98
+ mxArray * k = NULL;
99
+ mclCopyArray(&n);
100
+ /*
101
+ * r=zeros(n,1);
102
+ */
103
+ mlfAssign(&r, mlfZeros(mclVa(n, "n"), _mxarray0_, NULL));
104
+ /*
105
+ * for k=1:n
106
+ */
107
+ {
108
+ int v_ = mclForIntStart(1);
109
+ int e_ = mclForIntEnd(mclVa(n, "n"));
110
+ if (v_ > e_) {
111
+ mlfAssign(&k, _mxarray1_);
112
+ } else {
113
+ /*
114
+ * r(k)=rank(magic(k));
115
+ * end
116
+ */
117
+ for (; ; ) {
118
+ mclIntArrayAssign1(
119
+ &r, mlfRank(mlfMagic(mlfScalar(v_)), NULL), v_);
120
+ if (v_ == e_) {
121
+ break;
122
+ }
123
+ ++v_;
124
+ }
125
+ mlfAssign(&k, mlfScalar(v_));
126
+ }
127
+ }
128
+ mclValidateOutput(r, 1, nargout_, "r", "mrank");
129
+ mxDestroyArray(k);
130
+ mxDestroyArray(n);
131
+ mclSetCurrentLocalFunctionTable(save_local_function_table_);
132
+ return r;
133
+ }
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/CandM/mrank.exe CHANGED
Binary files "a/matlab\346\225\260\345\255\246\345\273\272\346\250\241\347\256\227\346\263\225/matlab\347\273\217\345\205\270\347\256\227\346\263\225\347\232\204\347\250\213\345\272\217(1)/Arithmetic/work/CandM/mrank.exe" and "b/matlab\346\225\260\345\255\246\345\273\272\346\250\241\347\256\227\346\263\225/matlab\347\273\217\345\205\270\347\256\227\346\263\225\347\232\204\347\250\213\345\272\217(1)/Arithmetic/work/CandM/mrank.exe" differ
 
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/CandM/mrank.h CHANGED
@@ -1,3 +1,34 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:5d6343cab6cfc356e8317debfb58548a3e06e42190da0d4e004cff3653a09aca
3
- size 833
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * MATLAB Compiler: 3.0
3
+ * Date: Sat Sep 04 22:31:38 2004
4
+ * Arguments: "-B" "macro_default" "-O" "all" "-O" "fold_scalar_mxarrays:on"
5
+ * "-O" "fold_non_scalar_mxarrays:on" "-O" "optimize_integer_for_loops:on" "-O"
6
+ * "array_indexing:on" "-O" "optimize_conditionals:on" "-t" "-W" "lib:Pkg" "-T"
7
+ * "link:exe" "-h" "mrank" "mrankp.c" "libmmfile.mlib"
8
+ */
9
+
10
+ #ifndef MLF_V2
11
+ #define MLF_V2 1
12
+ #endif
13
+
14
+ #ifndef __mrank_h
15
+ #define __mrank_h 1
16
+
17
+ #ifdef __cplusplus
18
+ extern "C" {
19
+ #endif
20
+
21
+ #include "libmatlb.h"
22
+
23
+ extern void InitializeModule_mrank(void);
24
+ extern void TerminateModule_mrank(void);
25
+ extern _mexLocalFunctionTable _local_function_table_mrank;
26
+
27
+ extern mxArray * mlfMrank(mxArray * n);
28
+ extern void mlxMrank(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]);
29
+
30
+ #ifdef __cplusplus
31
+ }
32
+ #endif
33
+
34
+ #endif
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/CandM/mrank.m CHANGED
@@ -1,3 +1,5 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:b9b4c8f0f8d32865faf703ce6c62bca1b31a39442183710a4a329b62a92f032d
3
- size 78
 
 
 
1
+ function r=mrank(n)
2
+ r=zeros(n,1);
3
+ for k=1:n
4
+ r(k)=rank(magic(k));
5
+ end
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/CandM/mrankp.c CHANGED
@@ -1,3 +1,24 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:7450ba9236609c1348e7b49af68fcac8e9f07edc1c8ce9f6cb8ea7f5661b908b
3
- size 347
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #include <stdio.h>
2
+ #include <math.h>
3
+ #include "matlab.h"
4
+ extern mxArray*mlfMrank(mxArray*);
5
+ main(int argc,char **argv)
6
+ {
7
+ mxArray *N;
8
+ mxArray *R;
9
+ int n;
10
+ if(argc>=2){
11
+ n=atoi(argv[1]);
12
+ }else {
13
+ n=12;
14
+ }
15
+ PkgInitialize();
16
+ N=mlfScalar(n);
17
+ R=mlfMrank(N);
18
+ mlfPrintMatrix(R);
19
+ mxDestroyArray(N);
20
+ mxDestroyArray(R);
21
+ PkgTerminate();
22
+
23
+
24
+ }
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/CandM/pkg.c CHANGED
@@ -1,3 +1,54 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:a2154c571a09fa9a33a364e6f9e091c56e513a876fc670d1ed014d5c2a03a1ae
3
- size 1900
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * MATLAB Compiler: 3.0
3
+ * Date: Sat Sep 04 22:31:38 2004
4
+ * Arguments: "-B" "macro_default" "-O" "all" "-O" "fold_scalar_mxarrays:on"
5
+ * "-O" "fold_non_scalar_mxarrays:on" "-O" "optimize_integer_for_loops:on" "-O"
6
+ * "array_indexing:on" "-O" "optimize_conditionals:on" "-t" "-W" "lib:Pkg" "-T"
7
+ * "link:exe" "-h" "mrank" "mrankp.c" "libmmfile.mlib"
8
+ */
9
+
10
+ #ifndef MLF_V2
11
+ #define MLF_V2 1
12
+ #endif
13
+
14
+ #include "libmatlb.h"
15
+ #include "Pkg.h"
16
+ #include "mrank.h"
17
+ #include "libmmfile.h"
18
+
19
+ extern _mex_information _lib_info;
20
+
21
+ static mexFunctionTableEntry function_table[1]
22
+ = { { "mrank", mlxMrank, 1, 1, &_local_function_table_mrank } };
23
+
24
+ static _mexInitTermTableEntry init_term_table[2]
25
+ = { { libmmfileInitialize, libmmfileTerminate },
26
+ { InitializeModule_mrank, TerminateModule_mrank } };
27
+
28
+ static int _reference_count = 0;
29
+
30
+ _mex_information _lib_info
31
+ = { 1, 1, function_table, 0, NULL, 0, NULL, 2, init_term_table };
32
+
33
+ /*
34
+ * The function "PkgInitialize" is a Compiler-generated initialization wrapper.
35
+ * It is used to initialize the state of Compiler-generated functions so that
36
+ * those functions can be called from code not generated by the Compiler. The
37
+ * function(s) initialized can be found in the function_table variable,
38
+ * appearing above.
39
+ */
40
+ void PkgInitialize(void) {
41
+ mclLibInit("Pkg", &_reference_count, &_lib_info);
42
+ }
43
+
44
+ /*
45
+ * The function "PkgTerminate" is a Compiler-generated termination wrapper. It
46
+ * is used to clean up the state that was set up by the initialization wrapper
47
+ * function, also found in this file. Call this function after having called
48
+ * the initialization wrapper function and after having finished making all
49
+ * calls to the Compiler-generated function(s) found in the function_table
50
+ * variable, appearing above.
51
+ */
52
+ void PkgTerminate(void) {
53
+ mclLibTerm("Pkg", &_reference_count, &_lib_info);
54
+ }
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/CandM/pkg.exports CHANGED
@@ -1,3 +1,4 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:fff53ac75d45ed48acf4a7ffa34a311fd89eba82a5b4507c2424d5552091fb53
3
- size 49
 
 
1
+ mlfMrank
2
+ mlxMrank
3
+ PkgInitialize
4
+ PkgTerminate
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/CandM/pkg.h CHANGED
@@ -1,3 +1,34 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:21b9bfa9096219fb538da07b58c3bdba37f7420b4f238cb7267d61ecf47c530a
3
- size 830
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * MATLAB Compiler: 3.0
3
+ * Date: Sat Sep 04 22:31:38 2004
4
+ * Arguments: "-B" "macro_default" "-O" "all" "-O" "fold_scalar_mxarrays:on"
5
+ * "-O" "fold_non_scalar_mxarrays:on" "-O" "optimize_integer_for_loops:on" "-O"
6
+ * "array_indexing:on" "-O" "optimize_conditionals:on" "-t" "-W" "lib:Pkg" "-T"
7
+ * "link:exe" "-h" "mrank" "mrankp.c" "libmmfile.mlib"
8
+ */
9
+
10
+ #ifndef MLF_V2
11
+ #define MLF_V2 1
12
+ #endif
13
+
14
+ #ifndef __pkg_h
15
+ #define __pkg_h 1
16
+
17
+ #ifdef __cplusplus
18
+ extern "C" {
19
+ #endif
20
+
21
+ #include "libmatlb.h"
22
+
23
+ extern void InitializeModule_pkg(void);
24
+ extern void TerminateModule_pkg(void);
25
+ extern mxArray * mlfMrank(mxArray * n);
26
+ extern void mlxMrank(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]);
27
+ extern void PkgInitialize(void);
28
+ extern void PkgTerminate(void);
29
+
30
+ #ifdef __cplusplus
31
+ }
32
+ #endif
33
+
34
+ #endif
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/CandM/pkg.mlib CHANGED
@@ -1,3 +1,15 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:241eb767122a42a9e8bcd49bf3fac233dc38fa87b58ef4d9bb6fb8cd1cf17cd1
3
- size 430
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* start of pkg.mlib */
2
+
3
+ target = "C";
4
+ include = "pkg.h";
5
+ timestamp = "Sat Sep 04 22:31:38 2004";
6
+
7
+ mrank { /* M function name */
8
+ nin = 1; /* number of M inputs */
9
+ nout = 1; /* number of M outputs */
10
+ scope = global; /* where function defined */
11
+ cname = mlfMrank; /* mxArray in and out */
12
+ nargout = 0; /* nargout not used */
13
+ }
14
+
15
+ /* end of pkg.mlib */
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/c_mat/matcreat.c CHANGED
@@ -1,3 +1,33 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:1af887de7bc60eeec4fc3d78c994a97eaea1f77136e4bd9223646c594fe1cc38
3
- size 904
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #include <stdio.h>
2
+ #include <string.h>
3
+ #include <stdlib.h>
4
+ #include "mat.h"
5
+ #define BUFSIZE 256
6
+ int main()
7
+ {
8
+ MATFile *pmat;
9
+ mxArray *pa1,*pa2,*pa3;
10
+ double data[9]={1.0,4.0,7.0,2.0,5.0,8.0,3.0,6.0,9.0};
11
+ double data1[4]={1,2,3,4};
12
+ const char *file="mattest.mat";
13
+ char str[BUFSIZE];
14
+ int status;
15
+ pmat=matOpen(file,"w");
16
+
17
+ pa1=mxCreateDoubleMatrix(3,3,mxREAL);
18
+ mxSetName(pa1,"LocalDouble");
19
+ pa2=mxCreateDoubleMatrix(2,2,mxREAL);
20
+ mxSetName(pa2,"GlobalDouble");
21
+ p3=mxCreateString("How to use mat files!");
22
+ mxSetName(pa3,"LocalString");
23
+ memcpy((void *)(mxGetPr(pa1)),(void *)data,sizeof(data));
24
+ memcpy((void *)(mxGetPr(pa2)),(void *)data1,sizeof(data1));
25
+ status=matPutArray(pmat,pa1);
26
+ status=matPutArrayAsGlobal(pmat,pa2);
27
+ status=matPutArray(pmat,pa3);
28
+ mxDestroyArray(pa1);
29
+ mxDestroyArray(pa2);
30
+ mxDestroyArray(pa3);
31
+ matClose(pmat);
32
+ return (EXIT_SUCCESS);
33
+ }
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/c_mat/matcreat.dsp CHANGED
@@ -1,3 +1,88 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:76133c8f4947783fca2c0a9e0a3d301b8232480744c1b05269f9922b43aad801
3
- size 3423
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Microsoft Developer Studio Project File - Name="matcreat" - Package Owner=<4>
2
+ # Microsoft Developer Studio Generated Build File, Format Version 6.00
3
+ # ** DO NOT EDIT **
4
+
5
+ # TARGTYPE "Win32 (x86) Console Application" 0x0103
6
+
7
+ CFG=matcreat - Win32 Debug
8
+ !MESSAGE This is not a valid makefile. To build this project using NMAKE,
9
+ !MESSAGE use the Export Makefile command and run
10
+ !MESSAGE
11
+ !MESSAGE NMAKE /f "matcreat.mak".
12
+ !MESSAGE
13
+ !MESSAGE You can specify a configuration when running NMAKE
14
+ !MESSAGE by defining the macro CFG on the command line. For example:
15
+ !MESSAGE
16
+ !MESSAGE NMAKE /f "matcreat.mak" CFG="matcreat - Win32 Debug"
17
+ !MESSAGE
18
+ !MESSAGE Possible choices for configuration are:
19
+ !MESSAGE
20
+ !MESSAGE "matcreat - Win32 Release" (based on "Win32 (x86) Console Application")
21
+ !MESSAGE "matcreat - Win32 Debug" (based on "Win32 (x86) Console Application")
22
+ !MESSAGE
23
+
24
+ # Begin Project
25
+ # PROP AllowPerConfigDependencies 0
26
+ # PROP Scc_ProjName ""
27
+ # PROP Scc_LocalPath ""
28
+ CPP=cl.exe
29
+ RSC=rc.exe
30
+
31
+ !IF "$(CFG)" == "matcreat - Win32 Release"
32
+
33
+ # PROP BASE Use_MFC 0
34
+ # PROP BASE Use_Debug_Libraries 0
35
+ # PROP BASE Output_Dir "Release"
36
+ # PROP BASE Intermediate_Dir "Release"
37
+ # PROP BASE Target_Dir ""
38
+ # PROP Use_MFC 0
39
+ # PROP Use_Debug_Libraries 0
40
+ # PROP Output_Dir "Release"
41
+ # PROP Intermediate_Dir "Release"
42
+ # PROP Target_Dir ""
43
+ # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
44
+ # ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
45
+ # ADD BASE RSC /l 0x804 /d "NDEBUG"
46
+ # ADD RSC /l 0x804 /d "NDEBUG"
47
+ BSC32=bscmake.exe
48
+ # ADD BASE BSC32 /nologo
49
+ # ADD BSC32 /nologo
50
+ LINK32=link.exe
51
+ # 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
52
+ # 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
53
+
54
+ !ELSEIF "$(CFG)" == "matcreat - Win32 Debug"
55
+
56
+ # PROP BASE Use_MFC 0
57
+ # PROP BASE Use_Debug_Libraries 1
58
+ # PROP BASE Output_Dir "Debug"
59
+ # PROP BASE Intermediate_Dir "Debug"
60
+ # PROP BASE Target_Dir ""
61
+ # PROP Use_MFC 0
62
+ # PROP Use_Debug_Libraries 1
63
+ # PROP Output_Dir "Debug"
64
+ # PROP Intermediate_Dir "Debug"
65
+ # PROP Target_Dir ""
66
+ # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
67
+ # ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
68
+ # ADD BASE RSC /l 0x804 /d "_DEBUG"
69
+ # ADD RSC /l 0x804 /d "_DEBUG"
70
+ BSC32=bscmake.exe
71
+ # ADD BASE BSC32 /nologo
72
+ # ADD BSC32 /nologo
73
+ LINK32=link.exe
74
+ # 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
75
+ # 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
76
+
77
+ !ENDIF
78
+
79
+ # Begin Target
80
+
81
+ # Name "matcreat - Win32 Release"
82
+ # Name "matcreat - Win32 Debug"
83
+ # Begin Source File
84
+
85
+ SOURCE=.\matcreat.c
86
+ # End Source File
87
+ # End Target
88
+ # End Project
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/c_mat/matcreat.dsw CHANGED
@@ -1,3 +1,29 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:312c3953a882593bdf45915818b79049d600fc8b416d2213a68bc7f3c7133294
3
- size 539
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Microsoft Developer Studio Workspace File, Format Version 6.00
2
+ # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
3
+
4
+ ###############################################################################
5
+
6
+ Project: "matcreat"=.\matcreat.dsp - Package Owner=<4>
7
+
8
+ Package=<5>
9
+ {{{
10
+ }}}
11
+
12
+ Package=<4>
13
+ {{{
14
+ }}}
15
+
16
+ ###############################################################################
17
+
18
+ Global:
19
+
20
+ Package=<5>
21
+ {{{
22
+ }}}
23
+
24
+ Package=<3>
25
+ {{{
26
+ }}}
27
+
28
+ ###############################################################################
29
+
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/c_mat/matcreat.ncb CHANGED
Binary files "a/matlab\346\225\260\345\255\246\345\273\272\346\250\241\347\256\227\346\263\225/matlab\347\273\217\345\205\270\347\256\227\346\263\225\347\232\204\347\250\213\345\272\217(1)/Arithmetic/work/c_mat/matcreat.ncb" and "b/matlab\346\225\260\345\255\246\345\273\272\346\250\241\347\256\227\346\263\225/matlab\347\273\217\345\205\270\347\256\227\346\263\225\347\232\204\347\250\213\345\272\217(1)/Arithmetic/work/c_mat/matcreat.ncb" differ
 
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/c_mat/matcreat.opt CHANGED
Binary files "a/matlab\346\225\260\345\255\246\345\273\272\346\250\241\347\256\227\346\263\225/matlab\347\273\217\345\205\270\347\256\227\346\263\225\347\232\204\347\250\213\345\272\217(1)/Arithmetic/work/c_mat/matcreat.opt" and "b/matlab\346\225\260\345\255\246\345\273\272\346\250\241\347\256\227\346\263\225/matlab\347\273\217\345\205\270\347\256\227\346\263\225\347\232\204\347\250\213\345\272\217(1)/Arithmetic/work/c_mat/matcreat.opt" differ
 
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/c_mat/matcreat.plg CHANGED
@@ -1,3 +1,33 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:c5833411c8b3cf952ad3fe54c4aa1793061243f577d822fa5999d6e378046430
3
- size 1229
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <html>
2
+ <body>
3
+ <pre>
4
+ <h1>Build Log</h1>
5
+ <h3>
6
+ --------------------Configuration: matcreat - Win32 Debug--------------------
7
+ </h3>
8
+ <h3>Command Lines</h3>
9
+ Creating temporary file "C:\DOCUME~1\ZXC\LOCALS~1\Temp\RSP1E.tmp" with contents
10
+ [
11
+ /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
12
+ "D:\work\c_mat\matcreat.c"
13
+ ]
14
+ Creating command line "cl.exe @C:\DOCUME~1\ZXC\LOCALS~1\Temp\RSP1E.tmp"
15
+ Creating temporary file "C:\DOCUME~1\ZXC\LOCALS~1\Temp\RSP1F.tmp" with contents
16
+ [
17
+ 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
18
+ .\Debug\matcreat.obj
19
+ ]
20
+ Creating command line "link.exe @C:\DOCUME~1\ZXC\LOCALS~1\Temp\RSP1F.tmp"
21
+ <h3>Output Window</h3>
22
+ Compiling...
23
+ matcreat.c
24
+ d:\work\c_mat\matcreat.c(4) : fatal error C1083: Cannot open include file: 'mat.h': No such file or directory
25
+ Error executing cl.exe.
26
+
27
+
28
+
29
+ <h3>Results</h3>
30
+ matcreat.exe - 1 error(s), 0 warning(s)
31
+ </pre>
32
+ </body>
33
+ </html>
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/c_mat/matcreate.c CHANGED
@@ -1,3 +1,7 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:f2d188870eef7e2613c2288f1d1c4f1576341bd5c7ad8c9d14fb454c712bb6cb
3
- size 284
 
 
 
 
 
1
+ --------------------Configuration: matcreat - Win32 Debug--------------------
2
+ Compiling...
3
+ matcreat.c
4
+ d:\work\c_mat\matcreat.c(4) : fatal error C1083: Cannot open include file: 'mat.h': No such file or directory
5
+ Error executing cl.exe.
6
+
7
+ matcreat.exe - 1 error(s), 0 warning(s)
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/c_mat/mexopts.bat CHANGED
@@ -1,3 +1,45 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:e71c9e05e02be576b40c8e543fc6dadda3709d40d680e70ca8ecd2def6e4689a
3
- size 1738
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ @echo off
2
+ rem MSVC60ENGMATOPTS.BAT
3
+ rem
4
+ rem Compile and link options used for building standalone engine or MAT programs
5
+ rem with Microsoft Visual C++ compiler version 6.0
6
+ rem
7
+ rem $Revision: 1.5 $ $Date: 2000/05/23 18:31:32 $
8
+ rem
9
+ rem ********************************************************************
10
+ rem General parameters
11
+ rem ********************************************************************
12
+ set MATLAB=%MATLAB%
13
+ set MSVCDir=%MSVCDir%
14
+ set MSDevDir=%MSVCDir%\..\Common\msdev98
15
+ set PATH=%MSVCDir%\BIN;%MSDevDir%\bin;%PATH%
16
+ set INCLUDE=%MSVCDir%\INCLUDE;%MSVCDir%\MFC\INCLUDE;%MSVCDir%\ATL\INCLUDE;%INCLUDE%
17
+ set LIB=%MSVCDir%\LIB;%MSVCDir%\MFC\LIB;%LIB%
18
+
19
+ rem ********************************************************************
20
+ rem Compiler parameters
21
+ rem ********************************************************************
22
+ set COMPILER=cl
23
+ set OPTIMFLAGS=-O2 -DNDEBUG
24
+ set DEBUGFLAGS=-Zi -Fd"%OUTDIR%%MEX_NAME%.pdb"
25
+ set COMPFLAGS=-c -Zp8 -G5 -W3 -nologo
26
+ set NAME_OBJECT=/Fo
27
+
28
+ rem ********************************************************************
29
+ rem Linker parameters
30
+ rem ********************************************************************
31
+ set LIBLOC=%MATLAB%\extern\lib\win32\microsoft\msvc60
32
+ set LINKER=link
33
+ set LINKFLAGS= kernel32.lib user32.lib gdi32.lib /LIBPATH:"%LIBLOC%" libmx.lib libmat.lib libeng.lib /nologo
34
+ set LINKOPTIMFLAGS=
35
+ set LINKDEBUGFLAGS=/debug
36
+ set LINK_FILE=
37
+ set LINK_LIB=
38
+ set NAME_OUTPUT="/out:%OUTDIR%%MEX_NAME%.exe"
39
+ set RSP_FILE_INDICATOR=@
40
+
41
+ rem ********************************************************************
42
+ rem Resource compiler parameters
43
+ rem ********************************************************************
44
+ set RC_COMPILER=
45
+ set RC_LINKER=
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/code/foo.m CHANGED
@@ -1,3 +1,7 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:99d6947a6126306ad8ca6d40dfc2a4a069dc64fe56bdf89b89fcdcb2af67d477
3
- size 105
 
 
 
 
 
1
+ function [a,b]=foo(x,y)
2
+ if nargout==0
3
+ elseif nargout==1
4
+ a=x;
5
+ elseif nargout==2
6
+ a=x;b=y;
7
+ end
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/code/fun.m CHANGED
@@ -1,3 +1,4 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:a4afc8c27e1338f4ff15e12f4d505f505119d42623a0f04aef0b6d2adcf80aee
3
- size 68
 
 
1
+ function a=fun(b)
2
+ a(1)=b(1).*b(1);
3
+ a(2)=b(1)+b(2);
4
+ a(3)=b(2)/4;
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/code/gasket.m CHANGED
@@ -1,3 +1,10 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:2faa5abeb836f941e20defc52a9b58cd0609b8130210008b80e80eb1475a838f
3
- size 303
 
 
 
 
 
 
 
 
1
+ function theImage=gasket(numPoints)
2
+ theImage =zeros(1000,1000);
3
+ corners=[866 1;1 500;866 1000];
4
+ startPoint=[866 1];
5
+ theRand=rand(numPoints,1);
6
+ theRand=ceil(theRand*3);
7
+ for i=1:numPoints
8
+ startPoint=floor((corners(theRand(i),:)+startPoint)/2);
9
+ theImage(startPoint(1),startPoint(2))=1;
10
+ end
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/code/sample.m CHANGED
@@ -1,3 +1,3 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:cb969b7d7a89ef788771a1a0d8aaf6d43f163e5f1fc1b56ad01f7b6a615d6947
3
- size 46
 
1
+ function y=sample(varargin)
2
+ varargin{:}
3
+ y=0;
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build/main.c CHANGED
@@ -1,3 +1,84 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:35e013917561a8e49f5fbb115b07c4ca69ddd63fafc4cb597374adfb9aa6c199
3
- size 2831
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * MATLAB Compiler: 3.0
3
+ * Date: Sat Sep 04 21:45:06 2004
4
+ * Arguments: "-B" "macro_default" "-O" "all" "-O" "fold_scalar_mxarrays:on"
5
+ * "-O" "fold_non_scalar_mxarrays:on" "-O" "optimize_integer_for_loops:on" "-O"
6
+ * "array_indexing:on" "-O" "optimize_conditionals:on" "-m" "-W" "main" "-L"
7
+ * "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "-c" "main" "mrank"
8
+ */
9
+ #include "main.h"
10
+ #include "mrank.h"
11
+ static mxArray * _mxarray0_;
12
+
13
+ void InitializeModule_main(void) {
14
+ _mxarray0_ = mclInitializeDouble(5.0);
15
+ }
16
+
17
+ void TerminateModule_main(void) {
18
+ mxDestroyArray(_mxarray0_);
19
+ }
20
+
21
+ static void Mmain(void);
22
+
23
+ _mexLocalFunctionTable _local_function_table_main
24
+ = { 0, (mexFunctionTableEntry *)NULL };
25
+
26
+ /*
27
+ * The function "mlfMain" contains the normal interface for the "main"
28
+ * M-function from file "d:\work\m_build\main.m" (lines 1-2). This function
29
+ * processes any input arguments and passes them to the implementation version
30
+ * of the function, appearing above.
31
+ */
32
+ void mlfMain(void) {
33
+ mlfEnterNewContext(0, 0);
34
+ Mmain();
35
+ mlfRestorePreviousContext(0, 0);
36
+ }
37
+
38
+ /*
39
+ * The function "mlxMain" contains the feval interface for the "main"
40
+ * M-function from file "d:\work\m_build\main.m" (lines 1-2). The feval
41
+ * function calls the implementation version of main through this function.
42
+ * This function processes any input arguments and passes them to the
43
+ * implementation version of the function, appearing above.
44
+ */
45
+ void mlxMain(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
46
+ if (nlhs > 0) {
47
+ mlfError(
48
+ mxCreateString(
49
+ "Run-time Error: File: main Line: 1 Column: 1 The function \"main\""
50
+ " was called with more than the declared number of outputs (0)."),
51
+ NULL);
52
+ }
53
+ if (nrhs > 0) {
54
+ mlfError(
55
+ mxCreateString(
56
+ "Run-time Error: File: main Line: 1 Column: 1 The function \"main"
57
+ "\" was called with more than the declared number of inputs (0)."),
58
+ NULL);
59
+ }
60
+ mlfEnterNewContext(0, 0);
61
+ Mmain();
62
+ mlfRestorePreviousContext(0, 0);
63
+ }
64
+
65
+ /*
66
+ * The function "Mmain" is the implementation version of the "main" M-function
67
+ * from file "d:\work\m_build\main.m" (lines 1-2). It contains the actual
68
+ * compiled code for that M-function. It is a static function and must only be
69
+ * called from one of the interface functions, appearing below.
70
+ */
71
+ /*
72
+ * function main
73
+ */
74
+ static void Mmain(void) {
75
+ mexLocalFunctionTable save_local_function_table_
76
+ = mclSetCurrentLocalFunctionTable(&_local_function_table_main);
77
+ mxArray * r = NULL;
78
+ /*
79
+ * r=mrank(5);
80
+ */
81
+ mlfAssign(&r, mlfMrank(_mxarray0_));
82
+ mxDestroyArray(r);
83
+ mclSetCurrentLocalFunctionTable(save_local_function_table_);
84
+ }
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build/main.h CHANGED
@@ -1,3 +1,34 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:3582c88542c47e6065d37649d6225d7d5fbb8b5ea61669aa37de3c730d5064e6
3
- size 826
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * MATLAB Compiler: 3.0
3
+ * Date: Sat Sep 04 21:45:06 2004
4
+ * Arguments: "-B" "macro_default" "-O" "all" "-O" "fold_scalar_mxarrays:on"
5
+ * "-O" "fold_non_scalar_mxarrays:on" "-O" "optimize_integer_for_loops:on" "-O"
6
+ * "array_indexing:on" "-O" "optimize_conditionals:on" "-m" "-W" "main" "-L"
7
+ * "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "-c" "main" "mrank"
8
+ */
9
+
10
+ #ifndef MLF_V2
11
+ #define MLF_V2 1
12
+ #endif
13
+
14
+ #ifndef __main_h
15
+ #define __main_h 1
16
+
17
+ #ifdef __cplusplus
18
+ extern "C" {
19
+ #endif
20
+
21
+ #include "libmatlb.h"
22
+
23
+ extern void InitializeModule_main(void);
24
+ extern void TerminateModule_main(void);
25
+ extern _mexLocalFunctionTable _local_function_table_main;
26
+
27
+ extern void mlfMain(void);
28
+ extern void mlxMain(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]);
29
+
30
+ #ifdef __cplusplus
31
+ }
32
+ #endif
33
+
34
+ #endif
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build/main.m CHANGED
@@ -1,3 +1,2 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:d1d937473dd4b819fdacd7f5e9968f16e00bcec7bb9ee78382e45cd58b35d022
3
- size 26
 
1
+ function main
2
+ r=mrank(5);
 
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build/main_main.c CHANGED
@@ -1,3 +1,40 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:5cbd6fb2d2fa72fce271e14a3c2949ea297c0f9dbda9bc9ec461f8e3fd313af8
3
- size 1397
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * MATLAB Compiler: 3.0
3
+ * Date: Sat Sep 04 21:45:06 2004
4
+ * Arguments: "-B" "macro_default" "-O" "all" "-O" "fold_scalar_mxarrays:on"
5
+ * "-O" "fold_non_scalar_mxarrays:on" "-O" "optimize_integer_for_loops:on" "-O"
6
+ * "array_indexing:on" "-O" "optimize_conditionals:on" "-m" "-W" "main" "-L"
7
+ * "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "-c" "main" "mrank"
8
+ */
9
+
10
+ #ifndef MLF_V2
11
+ #define MLF_V2 1
12
+ #endif
13
+
14
+ #include "libmatlb.h"
15
+ #include "main.h"
16
+ #include "mrank.h"
17
+ #include "libmmfile.h"
18
+
19
+ extern _mex_information _main_info;
20
+
21
+ static mexFunctionTableEntry function_table[2]
22
+ = { { "main", mlxMain, 0, 0, &_local_function_table_main },
23
+ { "mrank", mlxMrank, 1, 1, &_local_function_table_mrank } };
24
+
25
+ static _mexInitTermTableEntry init_term_table[3]
26
+ = { { libmmfileInitialize, libmmfileTerminate },
27
+ { InitializeModule_main, TerminateModule_main },
28
+ { InitializeModule_mrank, TerminateModule_mrank } };
29
+
30
+ _mex_information _main_info
31
+ = { 1, 2, function_table, 0, NULL, 0, NULL, 3, init_term_table };
32
+
33
+ /*
34
+ * The function "main" is a Compiler-generated main wrapper, suitable for
35
+ * building a stand-alone application. It calls a library function to perform
36
+ * initialization, call the main function, and perform library termination.
37
+ */
38
+ int main(int argc, const char * * argv) {
39
+ return mclMain(argc, argv, mlxMain, 0, &_main_info);
40
+ }
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build/mrank.c CHANGED
@@ -1,3 +1,133 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:1569ba1f54078af17fcd83817c558f2605eedee18fa2cd9b1d84af303669fc98
3
- size 4288
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * MATLAB Compiler: 3.0
3
+ * Date: Sat Sep 04 21:45:06 2004
4
+ * Arguments: "-B" "macro_default" "-O" "all" "-O" "fold_scalar_mxarrays:on"
5
+ * "-O" "fold_non_scalar_mxarrays:on" "-O" "optimize_integer_for_loops:on" "-O"
6
+ * "array_indexing:on" "-O" "optimize_conditionals:on" "-m" "-W" "main" "-L"
7
+ * "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "-c" "main" "mrank"
8
+ */
9
+ #include "mrank.h"
10
+ #include "libmatlbm.h"
11
+ #include "libmmfile.h"
12
+ static mxArray * _mxarray0_;
13
+ static mxArray * _mxarray1_;
14
+
15
+ void InitializeModule_mrank(void) {
16
+ _mxarray0_ = mclInitializeDouble(1.0);
17
+ _mxarray1_ = mclInitializeDoubleVector(0, 0, (double *)NULL);
18
+ }
19
+
20
+ void TerminateModule_mrank(void) {
21
+ mxDestroyArray(_mxarray1_);
22
+ mxDestroyArray(_mxarray0_);
23
+ }
24
+
25
+ static mxArray * Mmrank(int nargout_, mxArray * n);
26
+
27
+ _mexLocalFunctionTable _local_function_table_mrank
28
+ = { 0, (mexFunctionTableEntry *)NULL };
29
+
30
+ /*
31
+ * The function "mlfMrank" contains the normal interface for the "mrank"
32
+ * M-function from file "d:\work\m_build\mrank.m" (lines 1-5). This function
33
+ * processes any input arguments and passes them to the implementation version
34
+ * of the function, appearing above.
35
+ */
36
+ mxArray * mlfMrank(mxArray * n) {
37
+ int nargout = 1;
38
+ mxArray * r = NULL;
39
+ mlfEnterNewContext(0, 1, n);
40
+ r = Mmrank(nargout, n);
41
+ mlfRestorePreviousContext(0, 1, n);
42
+ return mlfReturnValue(r);
43
+ }
44
+
45
+ /*
46
+ * The function "mlxMrank" contains the feval interface for the "mrank"
47
+ * M-function from file "d:\work\m_build\mrank.m" (lines 1-5). The feval
48
+ * function calls the implementation version of mrank through this function.
49
+ * This function processes any input arguments and passes them to the
50
+ * implementation version of the function, appearing above.
51
+ */
52
+ void mlxMrank(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
53
+ mxArray * mprhs[1];
54
+ mxArray * mplhs[1];
55
+ int i;
56
+ if (nlhs > 1) {
57
+ mlfError(
58
+ mxCreateString(
59
+ "Run-time Error: File: mrank Line: 1 Column: 1 The function \"mrank"
60
+ "\" was called with more than the declared number of outputs (1)."),
61
+ NULL);
62
+ }
63
+ if (nrhs > 1) {
64
+ mlfError(
65
+ mxCreateString(
66
+ "Run-time Error: File: mrank Line: 1 Column: 1 The function \"mrank"
67
+ "\" was called with more than the declared number of inputs (1)."),
68
+ NULL);
69
+ }
70
+ for (i = 0; i < 1; ++i) {
71
+ mplhs[i] = NULL;
72
+ }
73
+ for (i = 0; i < 1 && i < nrhs; ++i) {
74
+ mprhs[i] = prhs[i];
75
+ }
76
+ for (; i < 1; ++i) {
77
+ mprhs[i] = NULL;
78
+ }
79
+ mlfEnterNewContext(0, 1, mprhs[0]);
80
+ mplhs[0] = Mmrank(nlhs, mprhs[0]);
81
+ mlfRestorePreviousContext(0, 1, mprhs[0]);
82
+ plhs[0] = mplhs[0];
83
+ }
84
+
85
+ /*
86
+ * The function "Mmrank" is the implementation version of the "mrank"
87
+ * M-function from file "d:\work\m_build\mrank.m" (lines 1-5). It contains the
88
+ * actual compiled code for that M-function. It is a static function and must
89
+ * only be called from one of the interface functions, appearing below.
90
+ */
91
+ /*
92
+ * function r=mrank(n)
93
+ */
94
+ static mxArray * Mmrank(int nargout_, mxArray * n) {
95
+ mexLocalFunctionTable save_local_function_table_
96
+ = mclSetCurrentLocalFunctionTable(&_local_function_table_mrank);
97
+ mxArray * r = NULL;
98
+ mxArray * k = NULL;
99
+ mclCopyArray(&n);
100
+ /*
101
+ * r=zeros(n,1);
102
+ */
103
+ mlfAssign(&r, mlfZeros(mclVa(n, "n"), _mxarray0_, NULL));
104
+ /*
105
+ * for k=1:n
106
+ */
107
+ {
108
+ int v_ = mclForIntStart(1);
109
+ int e_ = mclForIntEnd(mclVa(n, "n"));
110
+ if (v_ > e_) {
111
+ mlfAssign(&k, _mxarray1_);
112
+ } else {
113
+ /*
114
+ * r(k)=rank(magic(k));
115
+ * end
116
+ */
117
+ for (; ; ) {
118
+ mclIntArrayAssign1(
119
+ &r, mlfRank(mlfMagic(mlfScalar(v_)), NULL), v_);
120
+ if (v_ == e_) {
121
+ break;
122
+ }
123
+ ++v_;
124
+ }
125
+ mlfAssign(&k, mlfScalar(v_));
126
+ }
127
+ }
128
+ mclValidateOutput(r, 1, nargout_, "r", "mrank");
129
+ mxDestroyArray(k);
130
+ mxDestroyArray(n);
131
+ mclSetCurrentLocalFunctionTable(save_local_function_table_);
132
+ return r;
133
+ }
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build/mrank.h CHANGED
@@ -1,3 +1,34 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:a1351f3a107ec1c9249a310dc92a34008d45be9bc0526fe29c2a1cbb48444988
3
- size 845
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * MATLAB Compiler: 3.0
3
+ * Date: Sat Sep 04 21:45:06 2004
4
+ * Arguments: "-B" "macro_default" "-O" "all" "-O" "fold_scalar_mxarrays:on"
5
+ * "-O" "fold_non_scalar_mxarrays:on" "-O" "optimize_integer_for_loops:on" "-O"
6
+ * "array_indexing:on" "-O" "optimize_conditionals:on" "-m" "-W" "main" "-L"
7
+ * "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "-c" "main" "mrank"
8
+ */
9
+
10
+ #ifndef MLF_V2
11
+ #define MLF_V2 1
12
+ #endif
13
+
14
+ #ifndef __mrank_h
15
+ #define __mrank_h 1
16
+
17
+ #ifdef __cplusplus
18
+ extern "C" {
19
+ #endif
20
+
21
+ #include "libmatlb.h"
22
+
23
+ extern void InitializeModule_mrank(void);
24
+ extern void TerminateModule_mrank(void);
25
+ extern _mexLocalFunctionTable _local_function_table_mrank;
26
+
27
+ extern mxArray * mlfMrank(mxArray * n);
28
+ extern void mlxMrank(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]);
29
+
30
+ #ifdef __cplusplus
31
+ }
32
+ #endif
33
+
34
+ #endif
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build/mrank.m CHANGED
@@ -1,3 +1,5 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:2a4640b9b0e8dc4835a136db8aebf0efd703307f35b73a4043aa845779386d72
3
- size 76
 
 
 
1
+ function r=mrank(n)
2
+ r=zeros(n,1);
3
+ for k=1:n
4
+ r(k)=rank(magic(k));
5
+ end
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build1/main.c CHANGED
@@ -1,3 +1,84 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:6b6d595cce862bd264dfaab1ea424146411b5a272bdb3c563cf00e359b540fba
3
- size 2829
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * MATLAB Compiler: 3.0
3
+ * Date: Sat Sep 04 21:49:59 2004
4
+ * Arguments: "-B" "macro_default" "-O" "all" "-O" "fold_scalar_mxarrays:on"
5
+ * "-O" "fold_non_scalar_mxarrays:on" "-O" "optimize_integer_for_loops:on" "-O"
6
+ * "array_indexing:on" "-O" "optimize_conditionals:on" "-m" "-W" "main" "-L"
7
+ * "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "main" "mrank"
8
+ */
9
+ #include "main.h"
10
+ #include "mrank.h"
11
+ static mxArray * _mxarray0_;
12
+
13
+ void InitializeModule_main(void) {
14
+ _mxarray0_ = mclInitializeDouble(5.0);
15
+ }
16
+
17
+ void TerminateModule_main(void) {
18
+ mxDestroyArray(_mxarray0_);
19
+ }
20
+
21
+ static void Mmain(void);
22
+
23
+ _mexLocalFunctionTable _local_function_table_main
24
+ = { 0, (mexFunctionTableEntry *)NULL };
25
+
26
+ /*
27
+ * The function "mlfMain" contains the normal interface for the "main"
28
+ * M-function from file "d:\work\m_build1\main.m" (lines 1-2). This function
29
+ * processes any input arguments and passes them to the implementation version
30
+ * of the function, appearing above.
31
+ */
32
+ void mlfMain(void) {
33
+ mlfEnterNewContext(0, 0);
34
+ Mmain();
35
+ mlfRestorePreviousContext(0, 0);
36
+ }
37
+
38
+ /*
39
+ * The function "mlxMain" contains the feval interface for the "main"
40
+ * M-function from file "d:\work\m_build1\main.m" (lines 1-2). The feval
41
+ * function calls the implementation version of main through this function.
42
+ * This function processes any input arguments and passes them to the
43
+ * implementation version of the function, appearing above.
44
+ */
45
+ void mlxMain(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
46
+ if (nlhs > 0) {
47
+ mlfError(
48
+ mxCreateString(
49
+ "Run-time Error: File: main Line: 1 Column: 1 The function \"main\""
50
+ " was called with more than the declared number of outputs (0)."),
51
+ NULL);
52
+ }
53
+ if (nrhs > 0) {
54
+ mlfError(
55
+ mxCreateString(
56
+ "Run-time Error: File: main Line: 1 Column: 1 The function \"main"
57
+ "\" was called with more than the declared number of inputs (0)."),
58
+ NULL);
59
+ }
60
+ mlfEnterNewContext(0, 0);
61
+ Mmain();
62
+ mlfRestorePreviousContext(0, 0);
63
+ }
64
+
65
+ /*
66
+ * The function "Mmain" is the implementation version of the "main" M-function
67
+ * from file "d:\work\m_build1\main.m" (lines 1-2). It contains the actual
68
+ * compiled code for that M-function. It is a static function and must only be
69
+ * called from one of the interface functions, appearing below.
70
+ */
71
+ /*
72
+ * function main
73
+ */
74
+ static void Mmain(void) {
75
+ mexLocalFunctionTable save_local_function_table_
76
+ = mclSetCurrentLocalFunctionTable(&_local_function_table_main);
77
+ mxArray * r = NULL;
78
+ /*
79
+ * r=mrank(5);
80
+ */
81
+ mlfAssign(&r, mlfMrank(_mxarray0_));
82
+ mxDestroyArray(r);
83
+ mclSetCurrentLocalFunctionTable(save_local_function_table_);
84
+ }
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build1/main.exe CHANGED
Binary files "a/matlab\346\225\260\345\255\246\345\273\272\346\250\241\347\256\227\346\263\225/matlab\347\273\217\345\205\270\347\256\227\346\263\225\347\232\204\347\250\213\345\272\217(1)/Arithmetic/work/m_build1/main.exe" and "b/matlab\346\225\260\345\255\246\345\273\272\346\250\241\347\256\227\346\263\225/matlab\347\273\217\345\205\270\347\256\227\346\263\225\347\232\204\347\250\213\345\272\217(1)/Arithmetic/work/m_build1/main.exe" differ
 
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build1/main.h CHANGED
@@ -1,3 +1,34 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:ddd16c21ad190d9efd33e506c5e92542619c5087cd4f53546336b3e1a8268a4c
3
- size 821
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * MATLAB Compiler: 3.0
3
+ * Date: Sat Sep 04 21:49:59 2004
4
+ * Arguments: "-B" "macro_default" "-O" "all" "-O" "fold_scalar_mxarrays:on"
5
+ * "-O" "fold_non_scalar_mxarrays:on" "-O" "optimize_integer_for_loops:on" "-O"
6
+ * "array_indexing:on" "-O" "optimize_conditionals:on" "-m" "-W" "main" "-L"
7
+ * "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "main" "mrank"
8
+ */
9
+
10
+ #ifndef MLF_V2
11
+ #define MLF_V2 1
12
+ #endif
13
+
14
+ #ifndef __main_h
15
+ #define __main_h 1
16
+
17
+ #ifdef __cplusplus
18
+ extern "C" {
19
+ #endif
20
+
21
+ #include "libmatlb.h"
22
+
23
+ extern void InitializeModule_main(void);
24
+ extern void TerminateModule_main(void);
25
+ extern _mexLocalFunctionTable _local_function_table_main;
26
+
27
+ extern void mlfMain(void);
28
+ extern void mlxMain(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]);
29
+
30
+ #ifdef __cplusplus
31
+ }
32
+ #endif
33
+
34
+ #endif
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build1/main.m CHANGED
@@ -1,3 +1,2 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:d1d937473dd4b819fdacd7f5e9968f16e00bcec7bb9ee78382e45cd58b35d022
3
- size 26
 
1
+ function main
2
+ r=mrank(5);
 
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build1/main_main.c CHANGED
@@ -1,3 +1,40 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:981346841f54dc053579a31aa71ff9133c2e52b24a5b413b2554d64cc5168253
3
- size 1392
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * MATLAB Compiler: 3.0
3
+ * Date: Sat Sep 04 21:49:59 2004
4
+ * Arguments: "-B" "macro_default" "-O" "all" "-O" "fold_scalar_mxarrays:on"
5
+ * "-O" "fold_non_scalar_mxarrays:on" "-O" "optimize_integer_for_loops:on" "-O"
6
+ * "array_indexing:on" "-O" "optimize_conditionals:on" "-m" "-W" "main" "-L"
7
+ * "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "main" "mrank"
8
+ */
9
+
10
+ #ifndef MLF_V2
11
+ #define MLF_V2 1
12
+ #endif
13
+
14
+ #include "libmatlb.h"
15
+ #include "main.h"
16
+ #include "mrank.h"
17
+ #include "libmmfile.h"
18
+
19
+ extern _mex_information _main_info;
20
+
21
+ static mexFunctionTableEntry function_table[2]
22
+ = { { "main", mlxMain, 0, 0, &_local_function_table_main },
23
+ { "mrank", mlxMrank, 1, 1, &_local_function_table_mrank } };
24
+
25
+ static _mexInitTermTableEntry init_term_table[3]
26
+ = { { libmmfileInitialize, libmmfileTerminate },
27
+ { InitializeModule_main, TerminateModule_main },
28
+ { InitializeModule_mrank, TerminateModule_mrank } };
29
+
30
+ _mex_information _main_info
31
+ = { 1, 2, function_table, 0, NULL, 0, NULL, 3, init_term_table };
32
+
33
+ /*
34
+ * The function "main" is a Compiler-generated main wrapper, suitable for
35
+ * building a stand-alone application. It calls a library function to perform
36
+ * initialization, call the main function, and perform library termination.
37
+ */
38
+ int main(int argc, const char * * argv) {
39
+ return mclMain(argc, argv, mlxMain, 0, &_main_info);
40
+ }
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build1/mrank.c CHANGED
@@ -1,3 +1,139 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:d9a12dec37a30e2541d26a49aa98d16024cafc2ce7cab557edbf0690f19f6fef
3
- size 4406
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * MATLAB Compiler: 3.0
3
+ * Date: Sat Sep 04 21:49:59 2004
4
+ * Arguments: "-B" "macro_default" "-O" "all" "-O" "fold_scalar_mxarrays:on"
5
+ * "-O" "fold_non_scalar_mxarrays:on" "-O" "optimize_integer_for_loops:on" "-O"
6
+ * "array_indexing:on" "-O" "optimize_conditionals:on" "-m" "-W" "main" "-L"
7
+ * "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "main" "mrank"
8
+ */
9
+ #include "mrank.h"
10
+ #include "libmatlbm.h"
11
+ #include "libmmfile.h"
12
+ static mxArray * _mxarray0_;
13
+ static mxArray * _mxarray1_;
14
+
15
+ void InitializeModule_mrank(void) {
16
+ _mxarray0_ = mclInitializeDouble(1.0);
17
+ _mxarray1_ = mclInitializeDoubleVector(0, 0, (double *)NULL);
18
+ }
19
+
20
+ void TerminateModule_mrank(void) {
21
+ mxDestroyArray(_mxarray1_);
22
+ mxDestroyArray(_mxarray0_);
23
+ }
24
+
25
+ static mxArray * Mmrank(int nargout_, mxArray * n);
26
+
27
+ _mexLocalFunctionTable _local_function_table_mrank
28
+ = { 0, (mexFunctionTableEntry *)NULL };
29
+
30
+ /*
31
+ * The function "mlfMrank" contains the normal interface for the "mrank"
32
+ * M-function from file "d:\work\m_build1\mrank.m" (lines 1-6). This function
33
+ * processes any input arguments and passes them to the implementation version
34
+ * of the function, appearing above.
35
+ */
36
+ mxArray * mlfMrank(mxArray * n) {
37
+ int nargout = 1;
38
+ mxArray * r = NULL;
39
+ mlfEnterNewContext(0, 1, n);
40
+ r = Mmrank(nargout, n);
41
+ mlfRestorePreviousContext(0, 1, n);
42
+ return mlfReturnValue(r);
43
+ }
44
+
45
+ /*
46
+ * The function "mlxMrank" contains the feval interface for the "mrank"
47
+ * M-function from file "d:\work\m_build1\mrank.m" (lines 1-6). The feval
48
+ * function calls the implementation version of mrank through this function.
49
+ * This function processes any input arguments and passes them to the
50
+ * implementation version of the function, appearing above.
51
+ */
52
+ void mlxMrank(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
53
+ mxArray * mprhs[1];
54
+ mxArray * mplhs[1];
55
+ int i;
56
+ if (nlhs > 1) {
57
+ mlfError(
58
+ mxCreateString(
59
+ "Run-time Error: File: mrank Line: 1 Column: 1 The function \"mrank"
60
+ "\" was called with more than the declared number of outputs (1)."),
61
+ NULL);
62
+ }
63
+ if (nrhs > 1) {
64
+ mlfError(
65
+ mxCreateString(
66
+ "Run-time Error: File: mrank Line: 1 Column: 1 The function \"mrank"
67
+ "\" was called with more than the declared number of inputs (1)."),
68
+ NULL);
69
+ }
70
+ for (i = 0; i < 1; ++i) {
71
+ mplhs[i] = NULL;
72
+ }
73
+ for (i = 0; i < 1 && i < nrhs; ++i) {
74
+ mprhs[i] = prhs[i];
75
+ }
76
+ for (; i < 1; ++i) {
77
+ mprhs[i] = NULL;
78
+ }
79
+ mlfEnterNewContext(0, 1, mprhs[0]);
80
+ mplhs[0] = Mmrank(nlhs, mprhs[0]);
81
+ mlfRestorePreviousContext(0, 1, mprhs[0]);
82
+ plhs[0] = mplhs[0];
83
+ }
84
+
85
+ /*
86
+ * The function "Mmrank" is the implementation version of the "mrank"
87
+ * M-function from file "d:\work\m_build1\mrank.m" (lines 1-6). It contains the
88
+ * actual compiled code for that M-function. It is a static function and must
89
+ * only be called from one of the interface functions, appearing below.
90
+ */
91
+ /*
92
+ * function r=mrank(n)
93
+ */
94
+ static mxArray * Mmrank(int nargout_, mxArray * n) {
95
+ mexLocalFunctionTable save_local_function_table_
96
+ = mclSetCurrentLocalFunctionTable(&_local_function_table_mrank);
97
+ mxArray * r = NULL;
98
+ mxArray * ans = NULL;
99
+ mxArray * k = NULL;
100
+ mclCopyArray(&n);
101
+ /*
102
+ * r=zeros(n,1);
103
+ */
104
+ mlfAssign(&r, mlfZeros(mclVa(n, "n"), _mxarray0_, NULL));
105
+ /*
106
+ * for k=1:n
107
+ */
108
+ {
109
+ int v_ = mclForIntStart(1);
110
+ int e_ = mclForIntEnd(mclVa(n, "n"));
111
+ if (v_ > e_) {
112
+ mlfAssign(&k, _mxarray1_);
113
+ } else {
114
+ /*
115
+ * r(k)=rank(magic(k));
116
+ * end
117
+ */
118
+ for (; ; ) {
119
+ mclIntArrayAssign1(
120
+ &r, mlfRank(mlfMagic(mlfScalar(v_)), NULL), v_);
121
+ if (v_ == e_) {
122
+ break;
123
+ }
124
+ ++v_;
125
+ }
126
+ mlfAssign(&k, mlfScalar(v_));
127
+ }
128
+ }
129
+ /*
130
+ * r
131
+ */
132
+ mclPrintArray(mclVv(r, "r"), "r");
133
+ mclValidateOutput(r, 1, nargout_, "r", "mrank");
134
+ mxDestroyArray(k);
135
+ mxDestroyArray(ans);
136
+ mxDestroyArray(n);
137
+ mclSetCurrentLocalFunctionTable(save_local_function_table_);
138
+ return r;
139
+ }
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build1/mrank.h CHANGED
@@ -1,3 +1,34 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:bfb70999a7fb2f4acb07e9ba77824d8a1b140709804beb332ac036b3083233be
3
- size 840
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * MATLAB Compiler: 3.0
3
+ * Date: Sat Sep 04 21:49:59 2004
4
+ * Arguments: "-B" "macro_default" "-O" "all" "-O" "fold_scalar_mxarrays:on"
5
+ * "-O" "fold_non_scalar_mxarrays:on" "-O" "optimize_integer_for_loops:on" "-O"
6
+ * "array_indexing:on" "-O" "optimize_conditionals:on" "-m" "-W" "main" "-L"
7
+ * "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "main" "mrank"
8
+ */
9
+
10
+ #ifndef MLF_V2
11
+ #define MLF_V2 1
12
+ #endif
13
+
14
+ #ifndef __mrank_h
15
+ #define __mrank_h 1
16
+
17
+ #ifdef __cplusplus
18
+ extern "C" {
19
+ #endif
20
+
21
+ #include "libmatlb.h"
22
+
23
+ extern void InitializeModule_mrank(void);
24
+ extern void TerminateModule_mrank(void);
25
+ extern _mexLocalFunctionTable _local_function_table_mrank;
26
+
27
+ extern mxArray * mlfMrank(mxArray * n);
28
+ extern void mlxMrank(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]);
29
+
30
+ #ifdef __cplusplus
31
+ }
32
+ #endif
33
+
34
+ #endif
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build1/mrank.m CHANGED
@@ -1,3 +1,6 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:b9bc273b361e6cddc1f1bb66d46c11d2f1017b5a6e8453b349ad4a44056835e5
3
- size 79
 
 
 
 
1
+ function r=mrank(n)
2
+ r=zeros(n,1);
3
+ for k=1:n
4
+ r(k)=rank(magic(k));
5
+ end
6
+ r
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/magic.h CHANGED
@@ -1,3 +1,33 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:68d744fb07a62ad8c8a3c7a631f945e7e1cdaed68ca8dbd35b5d0bd84fc2d43c
3
- size 765
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * MATLAB Compiler: 3.0
3
+ * Date: Sat Sep 04 21:59:48 2004
4
+ * Arguments: "-B" "macro_default" "-O" "all" "-O" "fold_scalar_mxarrays:on"
5
+ * "-O" "fold_non_scalar_mxarrays:on" "-O" "optimize_integer_for_loops:on" "-O"
6
+ * "array_indexing:on" "-O" "optimize_conditionals:on" "-t" "mrank"
7
+ */
8
+
9
+ #ifndef MLF_V2
10
+ #define MLF_V2 1
11
+ #endif
12
+
13
+ #ifndef __magic_h
14
+ #define __magic_h 1
15
+
16
+ #ifdef __cplusplus
17
+ extern "C" {
18
+ #endif
19
+
20
+ #include "libmatlb.h"
21
+
22
+ extern void InitializeModule_magic(void);
23
+ extern void TerminateModule_magic(void);
24
+ extern _mexLocalFunctionTable _local_function_table_magic;
25
+
26
+ extern mxArray * mlfMagic(mxArray * n);
27
+ extern void mlxMagic(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]);
28
+
29
+ #ifdef __cplusplus
30
+ }
31
+ #endif
32
+
33
+ #endif
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/main.c CHANGED
@@ -1,3 +1,85 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:81c449421388f40f8de3e8ae2fa81e5f91c57f50f86dc849aeab9e5fc8f9e204
3
- size 2849
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * MATLAB Compiler: 3.0
3
+ * Date: Sat Sep 04 22:04:33 2004
4
+ * Arguments: "-B" "macro_default" "-O" "all" "-O" "fold_scalar_mxarrays:on"
5
+ * "-O" "fold_non_scalar_mxarrays:on" "-O" "optimize_integer_for_loops:on" "-O"
6
+ * "array_indexing:on" "-O" "optimize_conditionals:on" "-m" "-W" "main" "-L"
7
+ * "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "main.m" "my_rank.m"
8
+ * "mrank.m"
9
+ */
10
+ #include "main.h"
11
+ #include "mrank.h"
12
+ static mxArray * _mxarray0_;
13
+
14
+ void InitializeModule_main(void) {
15
+ _mxarray0_ = mclInitializeDouble(5.0);
16
+ }
17
+
18
+ void TerminateModule_main(void) {
19
+ mxDestroyArray(_mxarray0_);
20
+ }
21
+
22
+ static void Mmain(void);
23
+
24
+ _mexLocalFunctionTable _local_function_table_main
25
+ = { 0, (mexFunctionTableEntry *)NULL };
26
+
27
+ /*
28
+ * The function "mlfMain" contains the normal interface for the "main"
29
+ * M-function from file "d:\work\m_build2\main.m" (lines 1-2). This function
30
+ * processes any input arguments and passes them to the implementation version
31
+ * of the function, appearing above.
32
+ */
33
+ void mlfMain(void) {
34
+ mlfEnterNewContext(0, 0);
35
+ Mmain();
36
+ mlfRestorePreviousContext(0, 0);
37
+ }
38
+
39
+ /*
40
+ * The function "mlxMain" contains the feval interface for the "main"
41
+ * M-function from file "d:\work\m_build2\main.m" (lines 1-2). The feval
42
+ * function calls the implementation version of main through this function.
43
+ * This function processes any input arguments and passes them to the
44
+ * implementation version of the function, appearing above.
45
+ */
46
+ void mlxMain(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
47
+ if (nlhs > 0) {
48
+ mlfError(
49
+ mxCreateString(
50
+ "Run-time Error: File: main Line: 1 Column: 1 The function \"main\""
51
+ " was called with more than the declared number of outputs (0)."),
52
+ NULL);
53
+ }
54
+ if (nrhs > 0) {
55
+ mlfError(
56
+ mxCreateString(
57
+ "Run-time Error: File: main Line: 1 Column: 1 The function \"main"
58
+ "\" was called with more than the declared number of inputs (0)."),
59
+ NULL);
60
+ }
61
+ mlfEnterNewContext(0, 0);
62
+ Mmain();
63
+ mlfRestorePreviousContext(0, 0);
64
+ }
65
+
66
+ /*
67
+ * The function "Mmain" is the implementation version of the "main" M-function
68
+ * from file "d:\work\m_build2\main.m" (lines 1-2). It contains the actual
69
+ * compiled code for that M-function. It is a static function and must only be
70
+ * called from one of the interface functions, appearing below.
71
+ */
72
+ /*
73
+ * function main
74
+ */
75
+ static void Mmain(void) {
76
+ mexLocalFunctionTable save_local_function_table_
77
+ = mclSetCurrentLocalFunctionTable(&_local_function_table_main);
78
+ mxArray * r = NULL;
79
+ /*
80
+ * r=mrank(5);
81
+ */
82
+ mlfAssign(&r, mlfMrank(_mxarray0_));
83
+ mxDestroyArray(r);
84
+ mclSetCurrentLocalFunctionTable(save_local_function_table_);
85
+ }
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/main.exe CHANGED
Binary files "a/matlab\346\225\260\345\255\246\345\273\272\346\250\241\347\256\227\346\263\225/matlab\347\273\217\345\205\270\347\256\227\346\263\225\347\232\204\347\250\213\345\272\217(1)/Arithmetic/work/m_build2/main.exe" and "b/matlab\346\225\260\345\255\246\345\273\272\346\250\241\347\256\227\346\263\225/matlab\347\273\217\345\205\270\347\256\227\346\263\225\347\232\204\347\250\213\345\272\217(1)/Arithmetic/work/m_build2/main.exe" differ
 
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/main.h CHANGED
@@ -1,3 +1,35 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:4517b2e5ae6d693322258bc95701bc6b5ca578fd537d2048f70705193550e22b
3
- size 841
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * MATLAB Compiler: 3.0
3
+ * Date: Sat Sep 04 22:04:33 2004
4
+ * Arguments: "-B" "macro_default" "-O" "all" "-O" "fold_scalar_mxarrays:on"
5
+ * "-O" "fold_non_scalar_mxarrays:on" "-O" "optimize_integer_for_loops:on" "-O"
6
+ * "array_indexing:on" "-O" "optimize_conditionals:on" "-m" "-W" "main" "-L"
7
+ * "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "main.m" "my_rank.m"
8
+ * "mrank.m"
9
+ */
10
+
11
+ #ifndef MLF_V2
12
+ #define MLF_V2 1
13
+ #endif
14
+
15
+ #ifndef __main_h
16
+ #define __main_h 1
17
+
18
+ #ifdef __cplusplus
19
+ extern "C" {
20
+ #endif
21
+
22
+ #include "libmatlb.h"
23
+
24
+ extern void InitializeModule_main(void);
25
+ extern void TerminateModule_main(void);
26
+ extern _mexLocalFunctionTable _local_function_table_main;
27
+
28
+ extern void mlfMain(void);
29
+ extern void mlxMain(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]);
30
+
31
+ #ifdef __cplusplus
32
+ }
33
+ #endif
34
+
35
+ #endif
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/main.m CHANGED
@@ -1,3 +1,2 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:d1d937473dd4b819fdacd7f5e9968f16e00bcec7bb9ee78382e45cd58b35d022
3
- size 26
 
1
+ function main
2
+ r=mrank(5);
 
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/main_main.c CHANGED
@@ -1,3 +1,44 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:b60e3fe38de08ced27aeeb06101a7f1c3f03c7a859f2f14eeeac0a2bf5cc767a
3
- size 1568
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * MATLAB Compiler: 3.0
3
+ * Date: Sat Sep 04 22:04:33 2004
4
+ * Arguments: "-B" "macro_default" "-O" "all" "-O" "fold_scalar_mxarrays:on"
5
+ * "-O" "fold_non_scalar_mxarrays:on" "-O" "optimize_integer_for_loops:on" "-O"
6
+ * "array_indexing:on" "-O" "optimize_conditionals:on" "-m" "-W" "main" "-L"
7
+ * "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "main.m" "my_rank.m"
8
+ * "mrank.m"
9
+ */
10
+
11
+ #ifndef MLF_V2
12
+ #define MLF_V2 1
13
+ #endif
14
+
15
+ #include "libmatlb.h"
16
+ #include "main.h"
17
+ #include "my_rank.h"
18
+ #include "mrank.h"
19
+ #include "libmmfile.h"
20
+
21
+ extern _mex_information _main_info;
22
+
23
+ static mexFunctionTableEntry function_table[3]
24
+ = { { "main", mlxMain, 0, 0, &_local_function_table_main },
25
+ { "my_rank", mlxMy_rank, 2, 1, &_local_function_table_my_rank },
26
+ { "mrank", mlxMrank, 1, 1, &_local_function_table_mrank } };
27
+
28
+ static _mexInitTermTableEntry init_term_table[4]
29
+ = { { libmmfileInitialize, libmmfileTerminate },
30
+ { InitializeModule_main, TerminateModule_main },
31
+ { InitializeModule_my_rank, TerminateModule_my_rank },
32
+ { InitializeModule_mrank, TerminateModule_mrank } };
33
+
34
+ _mex_information _main_info
35
+ = { 1, 3, function_table, 0, NULL, 0, NULL, 4, init_term_table };
36
+
37
+ /*
38
+ * The function "main" is a Compiler-generated main wrapper, suitable for
39
+ * building a stand-alone application. It calls a library function to perform
40
+ * initialization, call the main function, and perform library termination.
41
+ */
42
+ int main(int argc, const char * * argv) {
43
+ return mclMain(argc, argv, mlxMain, 0, &_main_info);
44
+ }
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/mrank.c CHANGED
@@ -1,3 +1,141 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:5f70c82ae276eaa802d52e893a9c7f77cccfe2171ae226818c2fd73264c19106
3
- size 4454
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * MATLAB Compiler: 3.0
3
+ * Date: Sat Sep 04 22:04:33 2004
4
+ * Arguments: "-B" "macro_default" "-O" "all" "-O" "fold_scalar_mxarrays:on"
5
+ * "-O" "fold_non_scalar_mxarrays:on" "-O" "optimize_integer_for_loops:on" "-O"
6
+ * "array_indexing:on" "-O" "optimize_conditionals:on" "-m" "-W" "main" "-L"
7
+ * "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "main.m" "my_rank.m"
8
+ * "mrank.m"
9
+ */
10
+ #include "mrank.h"
11
+ #include "libmatlbm.h"
12
+ #include "libmmfile.h"
13
+ #include "my_rank.h"
14
+ static mxArray * _mxarray0_;
15
+ static mxArray * _mxarray1_;
16
+
17
+ void InitializeModule_mrank(void) {
18
+ _mxarray0_ = mclInitializeDouble(1.0);
19
+ _mxarray1_ = mclInitializeDoubleVector(0, 0, (double *)NULL);
20
+ }
21
+
22
+ void TerminateModule_mrank(void) {
23
+ mxDestroyArray(_mxarray1_);
24
+ mxDestroyArray(_mxarray0_);
25
+ }
26
+
27
+ static mxArray * Mmrank(int nargout_, mxArray * n);
28
+
29
+ _mexLocalFunctionTable _local_function_table_mrank
30
+ = { 0, (mexFunctionTableEntry *)NULL };
31
+
32
+ /*
33
+ * The function "mlfMrank" contains the normal interface for the "mrank"
34
+ * M-function from file "d:\work\m_build2\mrank.m" (lines 1-6). This function
35
+ * processes any input arguments and passes them to the implementation version
36
+ * of the function, appearing above.
37
+ */
38
+ mxArray * mlfMrank(mxArray * n) {
39
+ int nargout = 1;
40
+ mxArray * r = NULL;
41
+ mlfEnterNewContext(0, 1, n);
42
+ r = Mmrank(nargout, n);
43
+ mlfRestorePreviousContext(0, 1, n);
44
+ return mlfReturnValue(r);
45
+ }
46
+
47
+ /*
48
+ * The function "mlxMrank" contains the feval interface for the "mrank"
49
+ * M-function from file "d:\work\m_build2\mrank.m" (lines 1-6). The feval
50
+ * function calls the implementation version of mrank through this function.
51
+ * This function processes any input arguments and passes them to the
52
+ * implementation version of the function, appearing above.
53
+ */
54
+ void mlxMrank(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
55
+ mxArray * mprhs[1];
56
+ mxArray * mplhs[1];
57
+ int i;
58
+ if (nlhs > 1) {
59
+ mlfError(
60
+ mxCreateString(
61
+ "Run-time Error: File: mrank Line: 1 Column: 1 The function \"mrank"
62
+ "\" was called with more than the declared number of outputs (1)."),
63
+ NULL);
64
+ }
65
+ if (nrhs > 1) {
66
+ mlfError(
67
+ mxCreateString(
68
+ "Run-time Error: File: mrank Line: 1 Column: 1 The function \"mrank"
69
+ "\" was called with more than the declared number of inputs (1)."),
70
+ NULL);
71
+ }
72
+ for (i = 0; i < 1; ++i) {
73
+ mplhs[i] = NULL;
74
+ }
75
+ for (i = 0; i < 1 && i < nrhs; ++i) {
76
+ mprhs[i] = prhs[i];
77
+ }
78
+ for (; i < 1; ++i) {
79
+ mprhs[i] = NULL;
80
+ }
81
+ mlfEnterNewContext(0, 1, mprhs[0]);
82
+ mplhs[0] = Mmrank(nlhs, mprhs[0]);
83
+ mlfRestorePreviousContext(0, 1, mprhs[0]);
84
+ plhs[0] = mplhs[0];
85
+ }
86
+
87
+ /*
88
+ * The function "Mmrank" is the implementation version of the "mrank"
89
+ * M-function from file "d:\work\m_build2\mrank.m" (lines 1-6). It contains the
90
+ * actual compiled code for that M-function. It is a static function and must
91
+ * only be called from one of the interface functions, appearing below.
92
+ */
93
+ /*
94
+ * function r=mrank(n)
95
+ */
96
+ static mxArray * Mmrank(int nargout_, mxArray * n) {
97
+ mexLocalFunctionTable save_local_function_table_
98
+ = mclSetCurrentLocalFunctionTable(&_local_function_table_mrank);
99
+ mxArray * r = NULL;
100
+ mxArray * ans = NULL;
101
+ mxArray * k = NULL;
102
+ mclCopyArray(&n);
103
+ /*
104
+ * r=zeros(n,1);
105
+ */
106
+ mlfAssign(&r, mlfZeros(mclVa(n, "n"), _mxarray0_, NULL));
107
+ /*
108
+ * for k=1:n
109
+ */
110
+ {
111
+ int v_ = mclForIntStart(1);
112
+ int e_ = mclForIntEnd(mclVa(n, "n"));
113
+ if (v_ > e_) {
114
+ mlfAssign(&k, _mxarray1_);
115
+ } else {
116
+ /*
117
+ * r(k)=my_rank(magic(k));
118
+ * end
119
+ */
120
+ for (; ; ) {
121
+ mclIntArrayAssign1(
122
+ &r, mlfMy_rank(mlfMagic(mlfScalar(v_)), NULL), v_);
123
+ if (v_ == e_) {
124
+ break;
125
+ }
126
+ ++v_;
127
+ }
128
+ mlfAssign(&k, mlfScalar(v_));
129
+ }
130
+ }
131
+ /*
132
+ * r
133
+ */
134
+ mclPrintArray(mclVv(r, "r"), "r");
135
+ mclValidateOutput(r, 1, nargout_, "r", "mrank");
136
+ mxDestroyArray(k);
137
+ mxDestroyArray(ans);
138
+ mxDestroyArray(n);
139
+ mclSetCurrentLocalFunctionTable(save_local_function_table_);
140
+ return r;
141
+ }
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/mrank.h CHANGED
@@ -1,3 +1,35 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:81dc7166e2430c9487d57da402939bc525cfd48dcaa377bd719d8d745493817b
3
- size 860
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * MATLAB Compiler: 3.0
3
+ * Date: Sat Sep 04 22:04:33 2004
4
+ * Arguments: "-B" "macro_default" "-O" "all" "-O" "fold_scalar_mxarrays:on"
5
+ * "-O" "fold_non_scalar_mxarrays:on" "-O" "optimize_integer_for_loops:on" "-O"
6
+ * "array_indexing:on" "-O" "optimize_conditionals:on" "-m" "-W" "main" "-L"
7
+ * "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "main.m" "my_rank.m"
8
+ * "mrank.m"
9
+ */
10
+
11
+ #ifndef MLF_V2
12
+ #define MLF_V2 1
13
+ #endif
14
+
15
+ #ifndef __mrank_h
16
+ #define __mrank_h 1
17
+
18
+ #ifdef __cplusplus
19
+ extern "C" {
20
+ #endif
21
+
22
+ #include "libmatlb.h"
23
+
24
+ extern void InitializeModule_mrank(void);
25
+ extern void TerminateModule_mrank(void);
26
+ extern _mexLocalFunctionTable _local_function_table_mrank;
27
+
28
+ extern mxArray * mlfMrank(mxArray * n);
29
+ extern void mlxMrank(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]);
30
+
31
+ #ifdef __cplusplus
32
+ }
33
+ #endif
34
+
35
+ #endif
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/mrank.m CHANGED
@@ -1,3 +1,6 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:7c21249a56e9fc5daab7420ca5315335ac829cdde4bfbdfb1c8ab7d64e1f8933
3
- size 82
 
 
 
 
1
+ function r=mrank(n)
2
+ r=zeros(n,1);
3
+ for k=1:n
4
+ r(k)=my_rank(magic(k));
5
+ end
6
+ r
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/my_rank.c CHANGED
@@ -1,3 +1,148 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:5391f7993c9261097498ebac474835689900a52a5099096cc735a42ce168cef7
3
- size 4949
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * MATLAB Compiler: 3.0
3
+ * Date: Sat Sep 04 22:04:33 2004
4
+ * Arguments: "-B" "macro_default" "-O" "all" "-O" "fold_scalar_mxarrays:on"
5
+ * "-O" "fold_non_scalar_mxarrays:on" "-O" "optimize_integer_for_loops:on" "-O"
6
+ * "array_indexing:on" "-O" "optimize_conditionals:on" "-m" "-W" "main" "-L"
7
+ * "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "main.m" "my_rank.m"
8
+ * "mrank.m"
9
+ */
10
+ #include "my_rank.h"
11
+ #include "libmatlbm.h"
12
+ static mxArray * _mxarray0_;
13
+
14
+ void InitializeModule_my_rank(void) {
15
+ _mxarray0_ = mclInitializeDouble(2.220446049250313e-16);
16
+ }
17
+
18
+ void TerminateModule_my_rank(void) {
19
+ mxDestroyArray(_mxarray0_);
20
+ }
21
+
22
+ static mxArray * Mmy_rank(int nargout_, mxArray * A, mxArray * tol);
23
+
24
+ _mexLocalFunctionTable _local_function_table_my_rank
25
+ = { 0, (mexFunctionTableEntry *)NULL };
26
+
27
+ /*
28
+ * The function "mlfMy_rank" contains the normal interface for the "my_rank"
29
+ * M-function from file "d:\work\m_build2\my_rank.m" (lines 1-16). This
30
+ * function processes any input arguments and passes them to the implementation
31
+ * version of the function, appearing above.
32
+ */
33
+ mxArray * mlfMy_rank(mxArray * A, mxArray * tol) {
34
+ int nargout = 1;
35
+ mxArray * r = NULL;
36
+ mlfEnterNewContext(0, 2, A, tol);
37
+ r = Mmy_rank(nargout, A, tol);
38
+ mlfRestorePreviousContext(0, 2, A, tol);
39
+ return mlfReturnValue(r);
40
+ }
41
+
42
+ /*
43
+ * The function "mlxMy_rank" contains the feval interface for the "my_rank"
44
+ * M-function from file "d:\work\m_build2\my_rank.m" (lines 1-16). The feval
45
+ * function calls the implementation version of my_rank through this function.
46
+ * This function processes any input arguments and passes them to the
47
+ * implementation version of the function, appearing above.
48
+ */
49
+ void mlxMy_rank(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
50
+ mxArray * mprhs[2];
51
+ mxArray * mplhs[1];
52
+ int i;
53
+ if (nlhs > 1) {
54
+ mlfError(
55
+ mxCreateString(
56
+ "Run-time Error: File: my_rank Line: 1 Column: "
57
+ "1 The function \"my_rank\" was called with mor"
58
+ "e than the declared number of outputs (1)."),
59
+ NULL);
60
+ }
61
+ if (nrhs > 2) {
62
+ mlfError(
63
+ mxCreateString(
64
+ "Run-time Error: File: my_rank Line: 1 Column:"
65
+ " 1 The function \"my_rank\" was called with m"
66
+ "ore than the declared number of inputs (2)."),
67
+ NULL);
68
+ }
69
+ for (i = 0; i < 1; ++i) {
70
+ mplhs[i] = NULL;
71
+ }
72
+ for (i = 0; i < 2 && i < nrhs; ++i) {
73
+ mprhs[i] = prhs[i];
74
+ }
75
+ for (; i < 2; ++i) {
76
+ mprhs[i] = NULL;
77
+ }
78
+ mlfEnterNewContext(0, 2, mprhs[0], mprhs[1]);
79
+ mplhs[0] = Mmy_rank(nlhs, mprhs[0], mprhs[1]);
80
+ mlfRestorePreviousContext(0, 2, mprhs[0], mprhs[1]);
81
+ plhs[0] = mplhs[0];
82
+ }
83
+
84
+ /*
85
+ * The function "Mmy_rank" is the implementation version of the "my_rank"
86
+ * M-function from file "d:\work\m_build2\my_rank.m" (lines 1-16). It contains
87
+ * the actual compiled code for that M-function. It is a static function and
88
+ * must only be called from one of the interface functions, appearing below.
89
+ */
90
+ /*
91
+ * function r = my_rank(A,tol)
92
+ */
93
+ static mxArray * Mmy_rank(int nargout_, mxArray * A, mxArray * tol) {
94
+ mexLocalFunctionTable save_local_function_table_
95
+ = mclSetCurrentLocalFunctionTable(&_local_function_table_my_rank);
96
+ int nargin_ = mclNargin(2, A, tol, NULL);
97
+ mxArray * r = NULL;
98
+ mxArray * s = NULL;
99
+ mclCopyArray(&A);
100
+ mclCopyArray(&tol);
101
+ /*
102
+ * %RANK Matrix rank.
103
+ * % RANK(A) provides an estimate of the number of linearly
104
+ * % independent rows or columns of a matrix A.
105
+ * % RANK(A,tol) is the number of singular values of A
106
+ * % that are larger than tol.
107
+ * % RANK(A) uses the default tol = max(size(A)) * norm(A) * eps.
108
+ *
109
+ * % Copyright 1984-2002 The MathWorks, Inc.
110
+ * % $Revision: 5.11 $ $Date: 2002/04/08 23:51:52 $
111
+ *
112
+ * s = svd(A);
113
+ */
114
+ mlfAssign(&s, mlfSvd(NULL, NULL, mclVa(A, "A"), NULL));
115
+ /*
116
+ * if nargin==1
117
+ */
118
+ if (nargin_ == 1) {
119
+ /*
120
+ * tol = max(size(A)') * max(s) * eps;
121
+ */
122
+ mlfAssign(
123
+ &tol,
124
+ mclMtimes(
125
+ mclMtimes(
126
+ mlfMax(
127
+ NULL,
128
+ mlfCtranspose(
129
+ mlfSize(mclValueVarargout(), mclVa(A, "A"), NULL)),
130
+ NULL,
131
+ NULL),
132
+ mlfMax(NULL, mclVv(s, "s"), NULL, NULL)),
133
+ _mxarray0_));
134
+ /*
135
+ * end
136
+ */
137
+ }
138
+ /*
139
+ * r = sum(s > tol);
140
+ */
141
+ mlfAssign(&r, mlfSum(mclGt(mclVv(s, "s"), mclVa(tol, "tol")), NULL));
142
+ mclValidateOutput(r, 1, nargout_, "r", "my_rank");
143
+ mxDestroyArray(s);
144
+ mxDestroyArray(tol);
145
+ mxDestroyArray(A);
146
+ mclSetCurrentLocalFunctionTable(save_local_function_table_);
147
+ return r;
148
+ }
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/my_rank.h CHANGED
@@ -1,3 +1,35 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:dd8bac85dfacfcc9ad33b76e78bc874e5bd87d80274b0bc40b777baf5fe363e5
3
- size 889
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ * MATLAB Compiler: 3.0
3
+ * Date: Sat Sep 04 22:04:33 2004
4
+ * Arguments: "-B" "macro_default" "-O" "all" "-O" "fold_scalar_mxarrays:on"
5
+ * "-O" "fold_non_scalar_mxarrays:on" "-O" "optimize_integer_for_loops:on" "-O"
6
+ * "array_indexing:on" "-O" "optimize_conditionals:on" "-m" "-W" "main" "-L"
7
+ * "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib" "main.m" "my_rank.m"
8
+ * "mrank.m"
9
+ */
10
+
11
+ #ifndef MLF_V2
12
+ #define MLF_V2 1
13
+ #endif
14
+
15
+ #ifndef __my_rank_h
16
+ #define __my_rank_h 1
17
+
18
+ #ifdef __cplusplus
19
+ extern "C" {
20
+ #endif
21
+
22
+ #include "libmatlb.h"
23
+
24
+ extern void InitializeModule_my_rank(void);
25
+ extern void TerminateModule_my_rank(void);
26
+ extern _mexLocalFunctionTable _local_function_table_my_rank;
27
+
28
+ extern mxArray * mlfMy_rank(mxArray * A, mxArray * tol);
29
+ extern void mlxMy_rank(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]);
30
+
31
+ #ifdef __cplusplus
32
+ }
33
+ #endif
34
+
35
+ #endif
matlab数学建模算法/matlab经典算法的程序(1)/Arithmetic/work/m_build2/my_rank.m CHANGED
@@ -1,3 +1,16 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:70accc275d0f3f67f67d4a1768830ead385ffa9a416a96b4595412d2ba09676a
3
- size 503
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ function r = my_rank(A,tol)
2
+ %RANK Matrix rank.
3
+ % RANK(A) provides an estimate of the number of linearly
4
+ % independent rows or columns of a matrix A.
5
+ % RANK(A,tol) is the number of singular values of A
6
+ % that are larger than tol.
7
+ % RANK(A) uses the default tol = max(size(A)) * norm(A) * eps.
8
+
9
+ % Copyright 1984-2002 The MathWorks, Inc.
10
+ % $Revision: 5.11 $ $Date: 2002/04/08 23:51:52 $
11
+
12
+ s = svd(A);
13
+ if nargin==1
14
+ tol = max(size(A)') * max(s) * eps;
15
+ end
16
+ r = sum(s > tol);