Mercurial > mxe-octave
annotate src/of-fl-core-1-fixes.patch @ 4039:1c72016826aa
of-fl-core: update patch for --enable-64
* src/of-fl-core-1-fixes.patch: update patch
author | John Donoghue |
---|---|
date | Wed, 30 Sep 2015 14:11:45 -0400 |
parents | b36a7ab4bd2c |
children | b54e00ea56bc |
rev | line source |
---|---|
3854 | 1 diff -ur fl-core/src/Makefile fl-core.new/src/Makefile |
2 --- fl-core/src/Makefile 2011-02-06 14:09:03.000000000 -0500 | |
3 +++ fl-core.new/src/Makefile 2015-03-20 13:45:48.577323118 -0400 | |
4 @@ -1,15 +1,23 @@ | |
3420
207b5f6713d9
Update fl-core for current release patch
John Donoghue <john.donoghue@ieee.org>
parents:
3419
diff
changeset
|
5 OCT = fl_compose.oct |
207b5f6713d9
Update fl-core for current release patch
John Donoghue <john.donoghue@ieee.org>
parents:
3419
diff
changeset
|
6 SRC := $(OCT:.oct=.cc) |
3419
e7e29aeea726
Add octave forge 'fl-core' package
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
7 BASE := $(OCT:.oct=) |
3420
207b5f6713d9
Update fl-core for current release patch
John Donoghue <john.donoghue@ieee.org>
parents:
3419
diff
changeset
|
8 -ifdef COMSPEC |
207b5f6713d9
Update fl-core for current release patch
John Donoghue <john.donoghue@ieee.org>
parents:
3419
diff
changeset
|
9 + |
3854 | 10 +MKOCTFILE ?= mkoctfile |
3860
b36a7ab4bd2c
of-fl-core: use OCTAVE_CONFIG to determine system type
John Donoghue <john.donoghue@ieee.org>
parents:
3854
diff
changeset
|
11 +OCTAVE_CONFIG ?= octave-config |
3854 | 12 + |
3860
b36a7ab4bd2c
of-fl-core: use OCTAVE_CONFIG to determine system type
John Donoghue <john.donoghue@ieee.org>
parents:
3854
diff
changeset
|
13 +ifneq (,$(findstring mingw,$(shell $(OCTAVE_CONFIG) -p CANONICAL_HOST_TYPE))) |
3419
e7e29aeea726
Add octave forge 'fl-core' package
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
14 + ADDPARAM := -lpthread |
e7e29aeea726
Add octave forge 'fl-core' package
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
15 +else |
3420
207b5f6713d9
Update fl-core for current release patch
John Donoghue <john.donoghue@ieee.org>
parents:
3419
diff
changeset
|
16 + ifdef COMSPEC |
3419
e7e29aeea726
Add octave forge 'fl-core' package
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
17 ADDPARAM := -lpthreadVC2 |
3420
207b5f6713d9
Update fl-core for current release patch
John Donoghue <john.donoghue@ieee.org>
parents:
3419
diff
changeset
|
18 + endif |
3419
e7e29aeea726
Add octave forge 'fl-core' package
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
19 endif |
e7e29aeea726
Add octave forge 'fl-core' package
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
20 |
e7e29aeea726
Add octave forge 'fl-core' package
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
21 .phony: all |
3854 | 22 all: $(OCT) |
23 | |
24 %.oct: %.cc | |
25 - mkoctfile -s $< $(ADDPARAM) | |
26 + $(MKOCTFILE) -s $< $(ADDPARAM) | |
27 | |
28 .phony: clean | |
29 clean: | |
4039 | 30 Only in fl-core.orig: fl-core |
31 diff -ur fl-core.orig/src/fl_compose.cc fl-core/src/fl_compose.cc | |
32 --- fl-core.orig/src/fl_compose.cc 2015-03-20 13:43:53.970074780 -0400 | |
33 +++ fl-core/src/fl_compose.cc 2015-09-30 13:51:56.498187582 -0400 | |
34 @@ -63,14 +63,14 @@ | |
35 // Structure for thread arguments. Each thread will perform the computation between the start_index and end_index row. | |
36 struct threadArg | |
37 { | |
38 - int start_index; | |
39 - int end_index; | |
40 + octave_idx_type start_index; | |
41 + octave_idx_type end_index; | |
42 }; | |
43 | |
44 | |
45 // Functions prototype declaration | |
46 -float get_elem(float vec[], int row, int col,int numCols); | |
47 -void set_elem(float vec[], int row, int col, int numCols, float elem); | |
48 +float get_elem(float vec[], octave_idx_type row, octave_idx_type col,octave_idx_type numCols); | |
49 +void set_elem(float vec[], octave_idx_type row, octave_idx_type col, octave_idx_type numCols, float elem); | |
50 int is_valid_function(octave_function *func); | |
51 void *thread_function(void *arg); | |
52 int get_available_cpus(); | |
53 @@ -110,13 +110,13 @@ | |
54 SparseMatrix sparseC; | |
55 | |
56 // Matrices dimensions | |
57 -long int rowsA,rowsB,colsA,colsB,rowsC,colsC; | |
58 +octave_idx_type rowsA,rowsB,colsA,colsB,rowsC,colsC; | |
59 | |
60 // Lock option. 1 = calculation executed only for the diagonal of the matrix | |
61 int lock_option; | |
62 | |
63 // The increment | |
64 -int col_index_increment; | |
65 +octave_idx_type col_index_increment; | |
66 | |
67 // Number of threads that will be created | |
68 int num_threads; | |
69 @@ -357,8 +357,8 @@ | |
70 else | |
71 { | |
72 Matrix outMatrix(rowsC,colsC); | |
73 - for(int i=0;i<rowsC;i++) | |
74 - for(int j=0;j<colsC;j++) | |
75 + for(octave_idx_type i=0;i<rowsC;i++) | |
76 + for(octave_idx_type j=0;j<colsC;j++) | |
77 outMatrix(i,j) = get_elem(c,i,j,colsC); | |
78 | |
79 if(sparse_res) | |
80 @@ -390,15 +390,15 @@ | |
81 // Initialize the first matrix | |
82 Matrix tempMatrix = args(0).matrix_value(); | |
83 a = new float[rowsA*colsA]; | |
84 - for (int i=0; i<rowsA; i++) | |
85 - for(int j=0; j<colsA;j++) | |
86 + for (octave_idx_type i=0; i<rowsA; i++) | |
87 + for(octave_idx_type j=0; j<colsA;j++) | |
88 a[i*colsA+j] = tempMatrix(i,j); | |
89 | |
90 // Initialize the second matrix | |
91 tempMatrix = args(1).matrix_value(); | |
92 b = new float[rowsB*colsB]; | |
93 - for (int i=0; i<rowsB; i++) | |
94 - for(int j=0; j<colsB;j++) | |
95 + for (octave_idx_type i=0; i<rowsB; i++) | |
96 + for(octave_idx_type j=0; j<colsB;j++) | |
97 b[i*colsB+j] = tempMatrix(i,j); | |
98 | |
99 | |
100 @@ -418,7 +418,7 @@ | |
101 } | |
102 | |
103 // Define the number interval of rows for each thread | |
104 - int interval = rowsA / num_threads; | |
105 + octave_idx_type interval = rowsA / num_threads; | |
106 | |
107 int i; | |
108 // Define the threads | |
109 @@ -465,22 +465,22 @@ | |
110 float tnorm_val; | |
111 | |
112 // Initialize the result sparse matrix | |
113 - sparseC = SparseMatrix((int)colsB, (int)rowsA, (int)(colsB*rowsA)); | |
114 + sparseC = SparseMatrix(colsB, rowsA, (colsB*rowsA)); | |
115 | |
116 // Initialize the number of nonzero elements in the sparse matrix c | |
117 int nel = 0; | |
118 sparseC.xcidx(0) = 0; | |
119 | |
120 // Calculate the composition for each element | |
121 - for (int i = 0; i < rowsC; i++) | |
122 + for (octave_idx_type i = 0; i < rowsC; i++) | |
123 { | |
124 - for(int j = 0; j < colsC; j++) | |
125 + for(octave_idx_type j = 0; j < colsC; j++) | |
126 { | |
127 | |
128 // Get the index of the first element of the i-th column of a transpose (i-th row of a) | |
129 // and the index of the first element of the j-th column of b | |
130 - int ka = a.cidx(i); | |
131 - int kb = b.cidx(j); | |
132 + octave_idx_type ka = a.cidx(i); | |
133 + octave_idx_type kb = b.cidx(j); | |
134 snorm_val = 0; | |
135 | |
136 // Check if the values of the matrix are really not 0 (it happens if the column of a or b hasn't any value) | |
137 @@ -549,18 +549,18 @@ | |
138 float tnorm_val; | |
139 | |
140 // Get the row start_index and end_index | |
141 - int start_index = thread_args->start_index; | |
142 - int end_index = thread_args->end_index; | |
143 + octave_idx_type start_index = thread_args->start_index; | |
144 + octave_idx_type end_index = thread_args->end_index; | |
145 | |
146 | |
147 // Calculate the composition for the specified rows (between start_index and end_index) | |
148 - for (int i=start_index; i<end_index; i++) | |
149 + for (octave_idx_type i=start_index; i<end_index; i++) | |
150 { | |
151 - for(int j=lock_option*i; j<colsB; j=j+col_index_increment) | |
152 + for(octave_idx_type j=lock_option*i; j<colsB; j=j+col_index_increment) | |
153 { | |
154 snorm_val = calc_tnorm(get_elem(a,i,0,colsA),get_elem(b,0,j,colsB)); | |
155 | |
156 - for(int k=1; k<colsA; k++) | |
157 + for(octave_idx_type k=1; k<colsA; k++) | |
158 { | |
159 tnorm_val = calc_tnorm(get_elem(a,i,k,colsA),get_elem(b,k,j,colsB)); | |
160 snorm_val = calc_snorm(snorm_val,tnorm_val); | |
161 @@ -767,7 +767,7 @@ | |
162 | |
163 | |
164 /* Get the (i,j)-th element from the vector vec. The column number of the original matrix (numCols) is required */ | |
165 -float get_elem(float vec[], int row, int col,int numCols) | |
166 +float get_elem(float vec[], octave_idx_type row, octave_idx_type col,octave_idx_type numCols) | |
167 { | |
168 return vec[row*numCols+col]; | |
169 } | |
170 @@ -775,7 +775,7 @@ | |
171 | |
172 | |
173 /* Set the (i,j)-th element from the vector vec. The column number of the original matrix (numCols) is required */ | |
174 -void set_elem(float vec[], int row, int col, int numCols, float elem) | |
175 +void set_elem(float vec[], octave_idx_type row, octave_idx_type col, octave_idx_type numCols, float elem) | |
176 { | |
177 vec[row*numCols+col] = elem; | |
178 return; |