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