1 |
commit: 253b91dbf1c6ca1a07935f7627b04ae4c7f26baf |
2 |
Author: Alessandro Barbieri <lssndrbarbieri <AT> gmail <DOT> com> |
3 |
AuthorDate: Mon Sep 6 23:39:07 2021 +0000 |
4 |
Commit: Haelwenn Monnier <contact <AT> hacktivis <DOT> me> |
5 |
CommitDate: Mon Sep 6 23:42:44 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=253b91db |
7 |
|
8 |
sci-libs/meschach: apply mbdyn patch |
9 |
|
10 |
Signed-off-by: Alessandro Barbieri <lssndrbarbieri <AT> gmail.com> |
11 |
|
12 |
sci-libs/meschach/files/makefile.patch | 116 --- |
13 |
sci-libs/meschach/files/meschach-2-mbdyn.diff | 906 ++++++++++++++++++++++++ |
14 |
sci-libs/meschach/files/meschach-makefile.patch | 156 ++++ |
15 |
sci-libs/meschach/meschach-1.2b.ebuild | 5 +- |
16 |
4 files changed, 1065 insertions(+), 118 deletions(-) |
17 |
|
18 |
diff --git a/sci-libs/meschach/files/makefile.patch b/sci-libs/meschach/files/makefile.patch |
19 |
deleted file mode 100644 |
20 |
index 9c2fb918d..000000000 |
21 |
--- a/sci-libs/meschach/files/makefile.patch |
22 |
+++ /dev/null |
23 |
@@ -1,116 +0,0 @@ |
24 |
---- a/makefile.in 2021-04-11 20:54:38.081969329 +0200 |
25 |
-+++ b/makefile.in 2021-04-11 21:42:48.789853703 +0200 |
26 |
-@@ -18,8 +18,7 @@ |
27 |
- LIBS = @LIBS@ |
28 |
- RANLIB = @RANLIB@ |
29 |
- |
30 |
-- |
31 |
--CFLAGS = -O3 -fPIC |
32 |
-+CFLAGS += -fPIC |
33 |
- |
34 |
- |
35 |
- .c.o: |
36 |
-@@ -80,45 +79,45 @@ |
37 |
- |
38 |
- $(LIST1): $(HBASE) |
39 |
- part1: $(LIST1) |
40 |
-- ar ru libmeschach.a $(LIST1) |
41 |
-+ $(AR) ru libmeschach.a $(LIST1) |
42 |
- $(RANLIB) libmeschach.a |
43 |
- # $(CC) -shared -o libmeschach.so $(LIST1) |
44 |
- |
45 |
- $(LIST2): $(HBASE) matrix2.h |
46 |
- part2: $(LIST2) |
47 |
-- ar ru libmeschach.a $(LIST2) |
48 |
-+ $(AR) ru libmeschach.a $(LIST2) |
49 |
- $(RANLIB) libmeschach.a |
50 |
- # $(CC) -shared -o libmeschach.so $(LIST2) |
51 |
- |
52 |
- $(LIST3): $(HBASE) sparse.h sparse2.h |
53 |
- part3: $(LIST3) |
54 |
-- ar ru libmeschach.a $(LIST3) |
55 |
-+ $(AR) ru libmeschach.a $(LIST3) |
56 |
- $(RANLIB) libmeschach.a |
57 |
- # $(CC) -shared -o libmeschach.so $(LIST3) |
58 |
- |
59 |
- $(ZLIST1): $(HBASDE) zmatrix.h |
60 |
- zpart1: $(ZLIST1) |
61 |
-- ar ru libmeschach.a $(ZLIST1) |
62 |
-+ $(AR) ru libmeschach.a $(ZLIST1) |
63 |
- $(RANLIB) libmeschach.a |
64 |
- # $(CC) -shared -o libmeschach.so $(ZLIST1) |
65 |
- |
66 |
- $(ZLIST2): $(HBASE) zmatrix.h zmatrix2.h |
67 |
- zpart2: $(ZLIST2) |
68 |
-- ar ru libmeschach.a $(ZLIST2) |
69 |
-+ $(AR) ru libmeschach.a $(ZLIST2) |
70 |
- $(RANLIB) libmeschach.a |
71 |
- # $(CC) -shared -o libmeschach.so $(ZLIST2) |
72 |
- |
73 |
- $(OLDLIST): $(HBASE) sparse.h sparse2.h |
74 |
- oldpart: $(OLDLIST) |
75 |
-- ar ru libmeschach.a $(OLDLIST) |
76 |
-+ $(AR) ru libmeschach.a $(OLDLIST) |
77 |
- $(RANLIB) libmeschach.a |
78 |
- # $(CC) -shared -o libmeschach.so $(OLDLIST) |
79 |
- |
80 |
- shared: $(ALL_LISTS) |
81 |
-- $(CC) -shared -o libmeschach.so $(ALL_LISTS) -lc -lm -Wl,-soname -Wl,libmeschach.so.$(vers) |
82 |
-+ $(CC) $(LDFLAGS) -shared -o libmeschach.so $(ALL_LISTS) -lc -lm -Wl,-soname -Wl,libmeschach.so.$(vers) |
83 |
- |
84 |
- static: $(ALL_LISTS) |
85 |
-- ar ru libmeschach.a $(ALL_LISTS) |
86 |
-+ $(AR) ru libmeschach.a $(ALL_LISTS) |
87 |
- $(RANLIB) libmeschach.a |
88 |
- |
89 |
- |
90 |
-@@ -200,31 +199,31 @@ |
91 |
- alltorture: torture sptort ztorture memtort itertort mfuntort iotort |
92 |
- |
93 |
- torture:torture.o libmeschach.a |
94 |
-- $(CC) $(CFLAGS) $(DEFS) -o torture torture.o \ |
95 |
-- libmeschach.a $(LIBS) |
96 |
-+ $(CC) $(CFLAGS) $(LDFLAGS) $(DEFS) -fPIE -o torture torture.o \ |
97 |
-+ -lmeschach -L. $(LIBS) |
98 |
- sptort:sptort.o libmeschach.a |
99 |
-- $(CC) $(CFLAGS) $(DEFS) -o sptort sptort.o \ |
100 |
-- libmeschach.a $(LIBS) |
101 |
-+ $(CC) $(CFLAGS) $(LDFLAGS) $(DEFS) -fPIE -o sptort sptort.o \ |
102 |
-+ -lmeschach -L. $(LIBS) |
103 |
- memtort: memtort.o libmeschach.a |
104 |
-- $(CC) $(CFLAGS) $(DEFS) -o memtort memtort.o \ |
105 |
-- libmeschach.a $(LIBS) |
106 |
-+ $(CC) $(CFLAGS) $(LDFLAGS) $(DEFS) -fPIE -o memtort memtort.o \ |
107 |
-+ -lmeschach -L. $(LIBS) |
108 |
- ztorture:ztorture.o libmeschach.a |
109 |
-- $(CC) $(CFLAGS) $(DEFS) -o ztorture ztorture.o \ |
110 |
-- libmeschach.a $(LIBS) |
111 |
-+ $(CC) $(CFLAGS) $(LDFLAGS) $(DEFS) -fPIE -o ztorture ztorture.o \ |
112 |
-+ -lmeschach -L. $(LIBS) |
113 |
- itertort: itertort.o libmeschach.a |
114 |
-- $(CC) $(CFLAGS) $(DEFS) -o itertort itertort.o \ |
115 |
-- libmeschach.a $(LIBS) |
116 |
-+ $(CC) $(CFLAGS) $(LDFLAGS) $(DEFS) -fPIE -o itertort itertort.o \ |
117 |
-+ -lmeschach -L. $(LIBS) |
118 |
- |
119 |
- iotort: iotort.o libmeschach.a |
120 |
-- $(CC) $(CFLAGS) $(DEFS) -o iotort iotort.o \ |
121 |
-- libmeschach.a $(LIBS) |
122 |
-+ $(CC) $(CFLAGS) $(LDFLAGS) $(DEFS) -fPIE -o iotort iotort.o \ |
123 |
-+ -lmeschach -L. $(LIBS) |
124 |
- mfuntort: mfuntort.o libmeschach.a |
125 |
-- $(CC) $(CFLAGS) $(DEFS) -o mfuntort mfuntort.o \ |
126 |
-- libmeschach.a $(LIBS) |
127 |
-+ $(CC) $(CFLAGS) $(LDFLAGS) $(DEFS) -fPIE -o mfuntort mfuntort.o \ |
128 |
-+ -lmeschach -L. $(LIBS) |
129 |
- tstmove: tstmove.o libmeschach.a |
130 |
-- $(CC) $(CFLAGS) $(DEFS) -o tstmove tstmove.o \ |
131 |
-- libmeschach.a $(LIBS) |
132 |
-+ $(CC) $(CFLAGS) $(LDFLAGS) $(DEFS) -fPIE -o tstmove tstmove.o \ |
133 |
-+ -lmeschach -L. $(LIBS) |
134 |
- tstpxvec: tstpxvec.o libmeschach.a |
135 |
-- $(CC) $(CFLAGS) $(DEFS) -o tstpxvec tstpxvec.o \ |
136 |
-- libmeschach.a $(LIBS) |
137 |
-+ $(CC) $(CFLAGS) $(LDFLAGS) $(DEFS) -fPIE -o tstpxvec tstpxvec.o \ |
138 |
-+ -lmeschach -L. $(LIBS) |
139 |
- |
140 |
|
141 |
diff --git a/sci-libs/meschach/files/meschach-2-mbdyn.diff b/sci-libs/meschach/files/meschach-2-mbdyn.diff |
142 |
new file mode 100644 |
143 |
index 000000000..89db78f73 |
144 |
--- /dev/null |
145 |
+++ b/sci-libs/meschach/files/meschach-2-mbdyn.diff |
146 |
@@ -0,0 +1,906 @@ |
147 |
+--- a/CHANGELOG |
148 |
++++ b/CHANGELOG |
149 |
+@@ -0,0 +1,10 @@ |
150 |
++* 2000-04-13 Pierangelo Masarati <masarati@×××××××××××.it> |
151 |
++ - fixed HUGE_VAL configure |
152 |
++ - prefixed REAL, DOUBLE and FLOAT with MESCHACH_ to avoid conflicts |
153 |
++ |
154 |
++* 2000-??-?? Pierangelo Masarati <masarati@×××××××××××.it> |
155 |
++ - changed the struct pair in sparse.h to avoid conflicts with C++ stl |
156 |
++ - added some helpers for adding and subtracting coefs from sparse matrices |
157 |
++ - WARNING: in C++ the macro `catch' conflicts with the exception handling |
158 |
++ keyword; I temporarily fixed the problem by #undef-ining it after including |
159 |
++ meschach headers. |
160 |
+--- a/init.c |
161 |
++++ b/init.c |
162 |
+@@ -59,7 +59,7 @@ |
163 |
+ if ( ix == IVNULL ) |
164 |
+ error(E_NULL,"iv_zero"); |
165 |
+ |
166 |
+- for ( i = 0; i < ix->dim; i++ ) |
167 |
++ for ( i = ix->dim; i-- > 0; ) |
168 |
+ ix->ive[i] = 0; |
169 |
+ |
170 |
+ return ix; |
171 |
+@@ -77,7 +77,7 @@ |
172 |
+ error(E_NULL,"m_zero"); |
173 |
+ |
174 |
+ A_m = A->m; A_n = A->n; A_me = A->me; |
175 |
+- for ( i = 0; i < A_m; i++ ) |
176 |
++ for ( i = A_m; i-- > 0; ) |
177 |
+ __zero__(A_me[i],A_n); |
178 |
+ /* for ( j = 0; j < A_n; j++ ) |
179 |
+ A_me[i][j] = 0.0; */ |
180 |
+@@ -97,7 +97,7 @@ |
181 |
+ |
182 |
+ m_zero(A); |
183 |
+ size = min(A->m,A->n); |
184 |
+- for ( i = 0; i < size; i++ ) |
185 |
++ for ( i = size; i-- > 0; ) |
186 |
+ A->me[i][i] = 1.0; |
187 |
+ |
188 |
+ return A; |
189 |
+@@ -114,7 +114,7 @@ |
190 |
+ error(E_NULL,"px_ident"); |
191 |
+ |
192 |
+ px_size = px->size; px_pe = px->pe; |
193 |
+- for ( i = 0; i < px_size; i++ ) |
194 |
++ for ( i = px_size; i-- > 0; ) |
195 |
+ px_pe[i] = i; |
196 |
+ |
197 |
+ return px; |
198 |
+@@ -178,7 +178,7 @@ |
199 |
+ if ( ! started ) |
200 |
+ smrand(3127); |
201 |
+ |
202 |
+- for ( i = 0; i < len; i++ ) |
203 |
++ for ( i = len; i-- > 0; ) |
204 |
+ { |
205 |
+ inext = (inext >= 54) ? 0 : inext+1; |
206 |
+ inextp = (inextp >= 54) ? 0 : inextp+1; |
207 |
+@@ -260,12 +260,28 @@ |
208 |
+ if ( ! x ) |
209 |
+ error(E_NULL,"v_ones"); |
210 |
+ |
211 |
+- for ( i = 0; i < x->dim; i++ ) |
212 |
++ for ( i = x->dim; i-- > 0; ) |
213 |
+ x->ve[i] = 1.0; |
214 |
+ |
215 |
+ return x; |
216 |
+ } |
217 |
+ |
218 |
++/* v_init -- fills x with d's */ |
219 |
++VEC *v_init(x, d) |
220 |
++VEC *x; |
221 |
++Real d; |
222 |
++{ |
223 |
++ int i; |
224 |
++ |
225 |
++ if ( ! x ) |
226 |
++ error(E_NULL,"v_ones"); |
227 |
++ |
228 |
++ for ( i = x->dim; i-- > 0; ) |
229 |
++ x->ve[i] = d; |
230 |
++ |
231 |
++ return x; |
232 |
++} |
233 |
++ |
234 |
+ /* m_ones -- fills matrix with one's */ |
235 |
+ MAT *m_ones(A) |
236 |
+ MAT *A; |
237 |
+@@ -275,8 +291,8 @@ |
238 |
+ if ( ! A ) |
239 |
+ error(E_NULL,"m_ones"); |
240 |
+ |
241 |
+- for ( i = 0; i < A->m; i++ ) |
242 |
+- for ( j = 0; j < A->n; j++ ) |
243 |
++ for ( i = A->m; i-- > 0; ) |
244 |
++ for ( j = A->n; j-- > 0; ) |
245 |
+ A->me[i][j] = 1.0; |
246 |
+ |
247 |
+ return A; |
248 |
+@@ -291,7 +307,7 @@ |
249 |
+ if ( ! x ) |
250 |
+ error(E_NULL,"v_count"); |
251 |
+ |
252 |
+- for ( i = 0; i < x->dim; i++ ) |
253 |
++ for ( i = x->dim; i-- > 0; ) |
254 |
+ x->ve[i] = (Real)i; |
255 |
+ |
256 |
+ return x; |
257 |
+--- a/itertort.c |
258 |
++++ b/itertort.c |
259 |
+@@ -41,10 +41,10 @@ |
260 |
+ |
261 |
+ /* for iterative methods */ |
262 |
+ |
263 |
+-#if REAL == DOUBLE |
264 |
++#if MESCHACH_REAL == MESCHACH_DOUBLE |
265 |
+ #define EPS 1e-7 |
266 |
+ #define KK 20 |
267 |
+-#elif REAL == FLOAT |
268 |
++#elif MESCHACH_REAL == MESCHACH_FLOAT |
269 |
+ #define EPS 1e-5 |
270 |
+ #define KK 8 |
271 |
+ #endif |
272 |
+--- a/machine.h.in |
273 |
++++ b/machine.h.in |
274 |
+@@ -16,14 +16,15 @@ |
275 |
+ #undef MALLOCDECL |
276 |
+ #undef NOT_SEGMENTED |
277 |
+ #undef HAVE_MEMORY_H |
278 |
+-#undef HAVE_COMPLEX_H |
279 |
++/* #undef HAVE_COMPLEX_H */ |
280 |
+ #undef HAVE_MALLOC_H |
281 |
++#undef HAVE_HUGE_VAL_H |
282 |
+ #undef STDC_HEADERS |
283 |
+ #undef HAVE_BCOPY |
284 |
+ #undef HAVE_BZERO |
285 |
+ #undef CHAR0ISDBL0 |
286 |
+ #undef WORDS_BIGENDIAN |
287 |
+-#undef U_INT_DEF |
288 |
++/* #undef U_INT_DEF */ |
289 |
+ #undef VARARGS |
290 |
+ #undef HAVE_PROTOTYPES |
291 |
+ #undef HAVE_PROTOTYPES_IN_STRUCT |
292 |
+@@ -53,7 +54,7 @@ |
293 |
+ #endif /* HAVE_PROTOTYPES_IN_STRUCT */ |
294 |
+ |
295 |
+ /* for basic or larger versions */ |
296 |
+-#undef COMPLEX |
297 |
++#undef MESCHACH_COMPLEX |
298 |
+ #undef SPARSE |
299 |
+ |
300 |
+ /* for loop unrolling */ |
301 |
+@@ -131,9 +132,9 @@ |
302 |
+ |
303 |
+ /* you can choose single, double or long double (if available) precision */ |
304 |
+ |
305 |
+-#define FLOAT 1 |
306 |
+-#define DOUBLE 2 |
307 |
+-#define LONG_DOUBLE 3 |
308 |
++#define MESCHACH_FLOAT 1 |
309 |
++#define MESCHACH_DOUBLE 2 |
310 |
++#define MESCHACH_LONG_DOUBLE 3 |
311 |
+ |
312 |
+ #undef REAL_FLT |
313 |
+ #undef REAL_DBL |
314 |
+@@ -149,27 +150,27 @@ |
315 |
+ #ifdef REAL_FLT |
316 |
+ #define Real float |
317 |
+ #define LongReal float |
318 |
+-#define REAL FLOAT |
319 |
+-#define LONGREAL FLOAT |
320 |
++#define MESCHACH_REAL MESCHACH_FLOAT |
321 |
++#define MESCHACH_LONGREAL MESCHACH_FLOAT |
322 |
+ #endif |
323 |
+ |
324 |
+ /* double precision */ |
325 |
+ #ifdef REAL_DBL |
326 |
+ #define Real double |
327 |
+ #define LongReal double |
328 |
+-#define REAL DOUBLE |
329 |
+-#define LONGREAL DOUBLE |
330 |
++#define MESCHACH_REAL MESCHACH_DOUBLE |
331 |
++#define MESCHACH_LONGREAL MESCHACH_DOUBLE |
332 |
+ #endif |
333 |
+ |
334 |
+ |
335 |
+ /* machine epsilon or unit roundoff error */ |
336 |
+ /* This is correct on most IEEE Real precision systems */ |
337 |
+ #ifdef DBL_EPSILON |
338 |
+-#if REAL == DOUBLE |
339 |
++#if MESCHACH_REAL == MESCHACH_DOUBLE |
340 |
+ #define MACHEPS DBL_EPSILON |
341 |
+-#elif REAL == FLOAT |
342 |
++#elif MESCHACH_REAL == MESCHACH_FLOAT |
343 |
+ #define MACHEPS FLT_EPSILON |
344 |
+-#elif REAL == LONGDOUBLE |
345 |
++#elif MESCHACH_REAL == MESCHACH_LONGDOUBLE |
346 |
+ #define MACHEPS LDBL_EPSILON |
347 |
+ #endif |
348 |
+ #endif |
349 |
+@@ -178,11 +179,11 @@ |
350 |
+ #undef D_MACHEPS |
351 |
+ |
352 |
+ #ifndef MACHEPS |
353 |
+-#if REAL == DOUBLE |
354 |
++#if MESCHACH_REAL == MESCHACH_DOUBLE |
355 |
+ #define MACHEPS D_MACHEPS |
356 |
+-#elif REAL == FLOAT |
357 |
++#elif MESCHACH_REAL == MESCHACH_FLOAT |
358 |
+ #define MACHEPS F_MACHEPS |
359 |
+-#elif REAL == LONGDOUBLE |
360 |
++#elif MESCHACH_REAL == MESCHACH_LONGDOUBLE |
361 |
+ #define MACHEPS D_MACHEPS |
362 |
+ #endif |
363 |
+ #endif |
364 |
+@@ -208,12 +209,16 @@ |
365 |
+ #endif |
366 |
+ |
367 |
+ /* for non-ANSI systems */ |
368 |
++#ifndef HAVE_HUGE_VAL_H |
369 |
+ #ifndef HUGE_VAL |
370 |
+ #define HUGE_VAL HUGE |
371 |
+ #else |
372 |
+ #ifndef HUGE |
373 |
+ #define HUGE HUGE_VAL |
374 |
+ #endif |
375 |
++#endif |
376 |
++#else |
377 |
++#define HUGE HUGE_VAL |
378 |
+ #endif |
379 |
+ |
380 |
+ |
381 |
+--- a/matlab.h |
382 |
++++ b/matlab.h |
383 |
+@@ -66,9 +66,9 @@ |
384 |
+ |
385 |
+ #define ORDER ROW_ORDER |
386 |
+ |
387 |
+-#if REAL == DOUBLE |
388 |
++#if MESCHACH_REAL == MESCHACH_DOUBLE |
389 |
+ #define PRECISION DOUBLE_PREC |
390 |
+-#elif REAL == FLOAT |
391 |
++#elif MESCHACH_REAL == MESCHACH_FLOAT |
392 |
+ #define PRECISION SINGLE_PREC |
393 |
+ #endif |
394 |
+ |
395 |
+@@ -90,7 +90,7 @@ |
396 |
+ #endif |
397 |
+ |
398 |
+ /* complex variant */ |
399 |
+-#ifdef COMPLEX |
400 |
++#ifdef MESCHACH_COMPLEX |
401 |
+ #include "zmatrix.h" |
402 |
+ |
403 |
+ #ifdef ANSI_C |
404 |
+--- a/matrix.h |
405 |
++++ b/matrix.h |
406 |
+@@ -384,11 +384,17 @@ |
407 |
+ /* Initialisation routines -- to be zero, ones, random or identity */ |
408 |
+ #ifndef ANSI_C |
409 |
+ extern VEC *v_zero(), *v_rand(), *v_ones(); |
410 |
++/* ANDO 01-13-99 */ |
411 |
++extern VEC *v_init(); |
412 |
++/* ODNA 01-13-99 */ |
413 |
+ extern MAT *m_zero(), *m_ident(), *m_rand(), *m_ones(); |
414 |
+ extern PERM *px_ident(); |
415 |
+ extern IVEC *iv_zero(); |
416 |
+ #else |
417 |
+ extern VEC *v_zero(VEC *), *v_rand(VEC *), *v_ones(VEC *); |
418 |
++/* ANDO 01-13-99 */ |
419 |
++extern VEC *v_init(VEC*, Real); |
420 |
++/* ODNA 01-13-99 */ |
421 |
+ extern MAT *m_zero(MAT *), *m_ident(MAT *), *m_rand(MAT *), |
422 |
+ *m_ones(MAT *); |
423 |
+ extern PERM *px_ident(PERM *); |
424 |
+--- a/matrixio.c |
425 |
++++ b/matrixio.c |
426 |
+@@ -124,9 +124,9 @@ |
427 |
+ { j--; dynamic = FALSE; goto redo2; } |
428 |
+ if ( (*line == 'f' || *line == 'F') && j < n-1 ) |
429 |
+ { j++; dynamic = FALSE; goto redo2; } |
430 |
+-#if REAL == DOUBLE |
431 |
++#if MESCHACH_REAL == MESCHACH_DOUBLE |
432 |
+ } while ( *line=='\0' || sscanf(line,"%lf",&mat->me[i][j])<1 ); |
433 |
+-#elif REAL == FLOAT |
434 |
++#elif MESCHACH_REAL == MESCHACH_FLOAT |
435 |
+ } while ( *line=='\0' || sscanf(line,"%f",&mat->me[i][j])<1 ); |
436 |
+ #endif |
437 |
+ fprintf(stderr,"Continue: "); |
438 |
+@@ -168,9 +168,9 @@ |
439 |
+ if ( fscanf(fp," row %u:",&dummy) < 1 ) |
440 |
+ error(E_FORMAT,"bm_finput"); |
441 |
+ for ( j=0; j<n; j++ ) |
442 |
+-#if REAL == DOUBLE |
443 |
++#if MESCHACH_REAL == MESCHACH_DOUBLE |
444 |
+ if ((io_code=fscanf(fp,"%lf",&mat->me[i][j])) < 1 ) |
445 |
+-#elif REAL == FLOAT |
446 |
++#elif MESCHACH_REAL == MESCHACH_FLOAT |
447 |
+ if ((io_code=fscanf(fp,"%f",&mat->me[i][j])) < 1 ) |
448 |
+ #endif |
449 |
+ error(io_code==EOF ? 7 : 6,"bm_finput"); |
450 |
+@@ -337,9 +337,9 @@ |
451 |
+ { i--; dynamic = FALSE; goto redo; } |
452 |
+ if ( (*line == 'f' || *line == 'F') && i < dim-1 ) |
453 |
+ { i++; dynamic = FALSE; goto redo; } |
454 |
+-#if REAL == DOUBLE |
455 |
++#if MESCHACH_REAL == MESCHACH_DOUBLE |
456 |
+ } while ( *line=='\0' || sscanf(line,"%lf",&vec->ve[i]) < 1 ); |
457 |
+-#elif REAL == FLOAT |
458 |
++#elif MESCHACH_REAL == MESCHACH_FLOAT |
459 |
+ } while ( *line=='\0' || sscanf(line,"%f",&vec->ve[i]) < 1 ); |
460 |
+ #endif |
461 |
+ |
462 |
+@@ -367,9 +367,9 @@ |
463 |
+ /* get entries */ |
464 |
+ skipjunk(fp); |
465 |
+ for ( i=0; i<dim; i++ ) |
466 |
+-#if REAL == DOUBLE |
467 |
++#if MESCHACH_REAL == MESCHACH_DOUBLE |
468 |
+ if ((io_code=fscanf(fp,"%lf",&vec->ve[i])) < 1 ) |
469 |
+-#elif REAL == FLOAT |
470 |
++#elif MESCHACH_REAL == MESCHACH_FLOAT |
471 |
+ if ((io_code=fscanf(fp,"%f",&vec->ve[i])) < 1 ) |
472 |
+ #endif |
473 |
+ error(io_code==EOF ? 7 : 6,"bfin_vec"); |
474 |
+--- a/meminfo.c |
475 |
++++ b/meminfo.c |
476 |
+@@ -34,7 +34,7 @@ |
477 |
+ #include <stdio.h> |
478 |
+ #include "matrix.h" |
479 |
+ #include "meminfo.h" |
480 |
+-#ifdef COMPLEX |
481 |
++#ifdef MESCHACH_COMPLEX |
482 |
+ #include "zmatrix.h" |
483 |
+ #endif |
484 |
+ #ifdef SPARSE |
485 |
+@@ -60,7 +60,7 @@ |
486 |
+ "SPROW", |
487 |
+ "SPMAT" |
488 |
+ #endif |
489 |
+-#ifdef COMPLEX |
490 |
++#ifdef MESCHACH_COMPLEX |
491 |
+ ,"ZVEC", |
492 |
+ "ZMAT" |
493 |
+ #endif |
494 |
+@@ -86,7 +86,7 @@ |
495 |
+ sprow_free, |
496 |
+ sp_free |
497 |
+ #endif |
498 |
+-#ifdef COMPLEX |
499 |
++#ifdef MESCHACH_COMPLEX |
500 |
+ ,zv_free, |
501 |
+ zm_free |
502 |
+ #endif |
503 |
+--- a/meminfo.h |
504 |
++++ b/meminfo.h |
505 |
+@@ -58,7 +58,7 @@ |
506 |
+ #define TYPE_SPMAT 7 |
507 |
+ #endif |
508 |
+ |
509 |
+-#ifdef COMPLEX |
510 |
++#ifdef MESCHACH_COMPLEX |
511 |
+ #ifdef SPARSE |
512 |
+ #define TYPE_ZVEC 8 |
513 |
+ #define TYPE_ZMAT 9 |
514 |
+--- a/memtort.c |
515 |
++++ b/memtort.c |
516 |
+@@ -318,7 +318,7 @@ |
517 |
+ } |
518 |
+ #endif |
519 |
+ |
520 |
+-#ifdef COMPLEX |
521 |
++#ifdef MESCHACH_COMPLEX |
522 |
+ void stat_test4(par) |
523 |
+ int par; |
524 |
+ { |
525 |
+@@ -355,7 +355,7 @@ |
526 |
+ IVEC *ix = IVNULL, *iy = IVNULL, *iz = IVNULL; |
527 |
+ int m,n,i,j,deg,k; |
528 |
+ Real s1,s2; |
529 |
+-#ifdef COMPLEX |
530 |
++#ifdef MESCHACH_COMPLEX |
531 |
+ ZVEC *zx = ZVNULL, *zy = ZVNULL, *zz = ZVNULL; |
532 |
+ ZMAT *zA = ZMNULL, *zB = ZMNULL, *zC = ZMNULL; |
533 |
+ complex ONE; |
534 |
+@@ -580,7 +580,7 @@ |
535 |
+ #endif /* SPARSE */ |
536 |
+ |
537 |
+ |
538 |
+-#ifdef COMPLEX |
539 |
++#ifdef MESCHACH_COMPLEX |
540 |
+ /* complex stuff */ |
541 |
+ |
542 |
+ ONE = zmake(1.0,0.0); |
543 |
+@@ -629,7 +629,7 @@ |
544 |
+ errmesg("ZMAT resize"); |
545 |
+ |
546 |
+ zm_free_vars(&zA,&zB,&zC,NULL); |
547 |
+-#endif /* COMPLEX */ |
548 |
++#endif /* MESCHACH_COMPLEX */ |
549 |
+ |
550 |
+ #endif /* if defined(ANSI_C) || defined(VARARGS) */ |
551 |
+ |
552 |
+@@ -647,7 +647,7 @@ |
553 |
+ mem_stat_mark(1); |
554 |
+ for (i=0; i < 100; i++) { |
555 |
+ stat_test1(i); |
556 |
+-#ifdef COMPLEX |
557 |
++#ifdef MESCHACH_COMPLEX |
558 |
+ stat_test4(i); |
559 |
+ #endif |
560 |
+ } |
561 |
+@@ -671,7 +671,7 @@ |
562 |
+ |
563 |
+ for (i=0; i < 100; i++) { |
564 |
+ stat_test1(i); |
565 |
+-#ifdef COMPLEX |
566 |
++#ifdef MESCHACH_COMPLEX |
567 |
+ stat_test4(i); |
568 |
+ #endif |
569 |
+ } |
570 |
+@@ -727,9 +727,9 @@ |
571 |
+ |
572 |
+ mem_info(); |
573 |
+ |
574 |
+-#if REAL == FLOAT |
575 |
++#if MESCHACH_REAL == MESCHACH_FLOAT |
576 |
+ printf("# SINGLE PRECISION was used\n"); |
577 |
+-#elif REAL == DOUBLE |
578 |
++#elif MESCHACH_REAL == MESCHACH_DOUBLE |
579 |
+ printf("# DOUBLE PRECISION was used\n"); |
580 |
+ #endif |
581 |
+ |
582 |
+@@ -744,9 +744,9 @@ |
583 |
+ #ifdef ANSI_OR_VAR |
584 |
+ |
585 |
+ printf("# you should get: \n"); |
586 |
+-#if (REAL == FLOAT) |
587 |
++#if (MESCHACH_REAL == MESCHACH_FLOAT) |
588 |
+ printf("# type VEC: 276 bytes allocated, 3 variables allocated\n"); |
589 |
+-#elif (REAL == DOUBLE) |
590 |
++#elif (MESCHACH_REAL == MESCHACH_DOUBLE) |
591 |
+ printf("# type VEC: 516 bytes allocated, 3 variables allocated\n"); |
592 |
+ #endif |
593 |
+ printf("# and other types are zeros\n"); |
594 |
+--- a/otherio.c |
595 |
++++ b/otherio.c |
596 |
+@@ -130,9 +130,9 @@ |
597 |
+ if ( ! isatty(fileno(fp)) ) |
598 |
+ { |
599 |
+ skipjunk(fp); |
600 |
+-#if REAL == DOUBLE |
601 |
++#if MESCHACH_REAL == MESCHACH_DOUBLE |
602 |
+ if ( (retcode=fscanf(fp,"%lf",&x)) == EOF ) |
603 |
+-#elif REAL == FLOAT |
604 |
++#elif MESCHACH_REAL == MESCHACH_FLOAT |
605 |
+ if ( (retcode=fscanf(fp,"%f",&x)) == EOF ) |
606 |
+ #endif |
607 |
+ error(E_INPUT,"fin_double"); |
608 |
+@@ -148,9 +148,9 @@ |
609 |
+ fprintf(stderr,"%s: ",s); |
610 |
+ if ( fgets(scratch,MAXLINE,stdin)==NULL ) |
611 |
+ error(E_INPUT,"fin_double"); |
612 |
+-#if REAL == DOUBLE |
613 |
++#if MESCHACH_REAL == MESCHACH_DOUBLE |
614 |
+ retcode = sscanf(scratch,"%lf",&x); |
615 |
+-#elif REAL == FLOAT |
616 |
++#elif MESCHACH_REAL == MESCHACH_FLOAT |
617 |
+ retcode = sscanf(scratch,"%f",&x); |
618 |
+ #endif |
619 |
+ if ( ( retcode==1 && low > high ) || |
620 |
+--- a/rk4.dat |
621 |
++++ b/rk4.dat |
622 |
+@@ -1,12 +0,0 @@ |
623 |
+-# No. of a problem |
624 |
+-1 |
625 |
+-# Initial time |
626 |
+-0 |
627 |
+-# Final time |
628 |
+-1 |
629 |
+-# Solution is x(t) = (cos(t),-sin(t)) |
630 |
+-# x(0) = |
631 |
+-Vector: dim: 2 |
632 |
+-1 0 |
633 |
+-# Step size |
634 |
+-0.1 |
635 |
+--- a/sparse.c |
636 |
++++ b/sparse.c |
637 |
+@@ -61,25 +61,33 @@ |
638 |
+ return r->elt[idx].val; |
639 |
+ } |
640 |
+ |
641 |
++void _set(d, s) double* d; double s; { *d = s; } |
642 |
++void _inc(d, s) double* d; double s; { *d += s; } |
643 |
++void _dec(d, s) double* d; double s; { *d -= s; } |
644 |
++ |
645 |
+ /* sp_set_val -- sets the (i,j) entry of the sparse matrix A */ |
646 |
+-double sp_set_val(A,i,j,val) |
647 |
++double sp_set_val_(A,i,j,val,f) |
648 |
+ SPMAT *A; |
649 |
+ int i, j; |
650 |
+ double val; |
651 |
++void (*f)(double*, double); |
652 |
+ { |
653 |
+ SPROW *r; |
654 |
+ int idx, idx2, new_len; |
655 |
+ |
656 |
+ if ( A == SMNULL ) |
657 |
+- error(E_NULL,"sp_set_val"); |
658 |
++ error(E_NULL,"sp_set_val_"); |
659 |
+ if ( i < 0 || i >= A->m || j < 0 || j >= A->n ) |
660 |
+- error(E_SIZES,"sp_set_val"); |
661 |
++ error(E_SIZES,"sp_set_val_"); |
662 |
+ |
663 |
+ r = A->row+i; |
664 |
+ idx = sprow_idx(r,j); |
665 |
+- /* printf("sp_set_val: idx = %d\n",idx); */ |
666 |
++ /* printf("sp_set_val_: idx = %d\n",idx); */ |
667 |
+ if ( idx >= 0 ) |
668 |
+- { r->elt[idx].val = val; return val; } |
669 |
++ { |
670 |
++ (*f)(&(r->elt[idx].val), val); |
671 |
++ return r->elt[idx].val; |
672 |
++ } |
673 |
+ /* else */ if ( idx < -1 ) |
674 |
+ { |
675 |
+ /* Note: this destroys the column & diag access paths */ |
676 |
+@@ -97,7 +105,7 @@ |
677 |
+ |
678 |
+ r->elt = RENEW(r->elt,new_len,row_elt); |
679 |
+ if ( ! r->elt ) /* can't allocate */ |
680 |
+- error(E_MEM,"sp_set_val"); |
681 |
++ error(E_MEM,"sp_set_val_"); |
682 |
+ r->maxlen = 2*r->maxlen+1; |
683 |
+ } |
684 |
+ for ( idx2 = r->len-1; idx2 >= idx; idx2-- ) |
685 |
+@@ -110,12 +118,40 @@ |
686 |
+ ************************************************************/ |
687 |
+ r->len++; |
688 |
+ r->elt[idx].col = j; |
689 |
++ |
690 |
++ /* sbagliato |
691 |
++ (*f)(&(r->elt[idx].val), val); |
692 |
++ */ |
693 |
+ return r->elt[idx].val = val; |
694 |
+ } |
695 |
+ /* else -- idx == -1, error in index/matrix! */ |
696 |
+ return 0.0; |
697 |
+ } |
698 |
+ |
699 |
++double sp_set_val(A,i,j,val) |
700 |
++SPMAT *A; |
701 |
++int i, j; |
702 |
++double val; |
703 |
++{ |
704 |
++ return sp_set_val_(A, i, j, val, _set); |
705 |
++} |
706 |
++ |
707 |
++double sp_inc_val(A,i,j,val) |
708 |
++SPMAT *A; |
709 |
++int i, j; |
710 |
++double val; |
711 |
++{ |
712 |
++ return sp_set_val_(A, i, j, val, _inc); |
713 |
++} |
714 |
++ |
715 |
++double sp_dec_val(A,i,j,val) |
716 |
++SPMAT *A; |
717 |
++int i, j; |
718 |
++double val; |
719 |
++{ |
720 |
++ return sp_set_val_(A, i, j, val, _dec); |
721 |
++} |
722 |
++ |
723 |
+ /* sp_mv_mlt -- sparse matrix/dense vector multiply |
724 |
+ -- result is in out, which is returned unless out==NULL on entry |
725 |
+ -- if out==NULL on entry then the result vector is created */ |
726 |
+@@ -612,16 +648,17 @@ |
727 |
+ { |
728 |
+ int i; |
729 |
+ |
730 |
+- if ( ! A ) |
731 |
+- error(E_NULL,"sp_smlt"); |
732 |
+- if ( ! B ) |
733 |
+- B = sp_get(A->m,A->n,5); |
734 |
+- else |
735 |
+- if ( A->m != B->m || A->n != B->n ) |
736 |
+- error(E_SIZES,"sp_smlt"); |
737 |
++ if (!A) { |
738 |
++ error(E_NULL, "sp_smlt"); |
739 |
++ } |
740 |
++ if (!B) { |
741 |
++ B = sp_get(A->m, A->n, 5); |
742 |
++ } else if (A->m != B->m || A->n != B->n) { |
743 |
++ error(E_SIZES, "sp_smlt"); |
744 |
++ } |
745 |
+ |
746 |
+- for (i=0; i < A->m; i++) { |
747 |
+- sprow_smlt(&(A->row[i]),alpha,0,&(B->row[i]),TYPE_SPMAT); |
748 |
++ for (i = A->m; i-- > 0; ) { |
749 |
++ sprow_smlt(&(A->row[i]), alpha, 0, &(B->row[i]), TYPE_SPMAT); |
750 |
+ } |
751 |
+ return B; |
752 |
+ } |
753 |
+@@ -635,15 +672,16 @@ |
754 |
+ int i, idx, len; |
755 |
+ row_elt *elt; |
756 |
+ |
757 |
+- if ( ! A ) |
758 |
+- error(E_NULL,"sp_zero"); |
759 |
++ if ( ! A ) { |
760 |
++ error(E_NULL,"sp_zero"); |
761 |
++ } |
762 |
+ |
763 |
+- for ( i = 0; i < A->m; i++ ) |
764 |
+- { |
765 |
++ for ( i = A->m; i-- > 0; ) { |
766 |
+ elt = A->row[i].elt; |
767 |
+ len = A->row[i].len; |
768 |
+- for ( idx = 0; idx < len; idx++ ) |
769 |
+- (*elt++).val = 0.0; |
770 |
++ for ( idx = len; idx-- > 0; ) { |
771 |
++ (*elt++).val = 0.; |
772 |
++ } |
773 |
+ } |
774 |
+ |
775 |
+ return A; |
776 |
+--- a/sparse.h |
777 |
++++ b/sparse.h |
778 |
+@@ -63,11 +63,12 @@ |
779 |
+ This starts the chain down the columns using the nxt_row and nxt_idx |
780 |
+ fields of each entry in each row. */ |
781 |
+ |
782 |
+-typedef struct pair { int pos; Real val; } pair; |
783 |
++typedef struct meschach_pair { int pos; Real val; } meschach_pair; |
784 |
+ |
785 |
+ typedef struct SPVEC { |
786 |
+ int dim, max_dim; |
787 |
+- pair *elt; /* elt[max_dim] */ |
788 |
++ struct { int pos; Real val; } *elt; |
789 |
++ /* meschach_pair *elt; */ /* elt[max_dim] */ |
790 |
+ } SPVEC; |
791 |
+ |
792 |
+ #define SMNULL ((SPMAT*)NULL) |
793 |
+@@ -98,6 +99,9 @@ |
794 |
+ extern SPMAT *sp_get(), *sp_copy(), *sp_copy2(), |
795 |
+ *sp_zero(), *sp_resize(), *sp_compact(); |
796 |
+ extern double sp_get_val(), sp_set_val(); |
797 |
++/* ANDO 01-10-99 */ |
798 |
++extern double sp_inc_val(), sp_dec_val(); |
799 |
++/* ANDO 01-10-99 */ |
800 |
+ extern VEC *sp_mv_mlt(), *sp_vm_mlt(); |
801 |
+ extern int sp_free(); |
802 |
+ |
803 |
+@@ -132,6 +136,9 @@ |
804 |
+ *sp_zero(SPMAT *), *sp_resize(SPMAT *,int,int), |
805 |
+ *sp_compact(SPMAT *,double); |
806 |
+ double sp_get_val(SPMAT *,int,int), sp_set_val(SPMAT *,int,int,double); |
807 |
++/* ANDO 01-10-99 */ |
808 |
++double sp_inc_val(SPMAT *,int,int,double), sp_dec_val(SPMAT *,int,int,double); |
809 |
++/* ANDO 01-10-99 */ |
810 |
+ VEC *sp_mv_mlt(SPMAT *,VEC *,VEC *), *sp_vm_mlt(SPMAT *,VEC *,VEC *); |
811 |
+ int sp_free(SPMAT *); |
812 |
+ |
813 |
+--- a/sparseio.c |
814 |
++++ b/sparseio.c |
815 |
+@@ -222,9 +222,9 @@ |
816 |
+ error(E_INPUT,"sp_finput"); |
817 |
+ if ( *line == 'e' || *line == 'E' ) |
818 |
+ break; |
819 |
+-#if REAL == DOUBLE |
820 |
++#if MESCHACH_REAL == MESCHACH_DOUBLE |
821 |
+ } while ( sscanf(line,"%u %lf",&col,&val) != 2 || |
822 |
+-#elif REAL == FLOAT |
823 |
++#elif MESCHACH_REAL == MESCHACH_FLOAT |
824 |
+ } while ( sscanf(line,"%u %f",&col,&val) != 2 || |
825 |
+ #endif |
826 |
+ col >= n || col <= curr_col ); |
827 |
+@@ -282,9 +282,9 @@ |
828 |
+ curr_col = -1; |
829 |
+ for ( len = 0; len < MAXSCRATCH; len++ ) |
830 |
+ { |
831 |
+-#if REAL == DOUBLE |
832 |
++#if MESCHACH_REAL == MESCHACH_DOUBLE |
833 |
+ if ( (ret_val=fscanf(fp,"%u : %lf",&col,&val)) != 2 ) |
834 |
+-#elif REAL == FLOAT |
835 |
++#elif MESCHACH_REAL == MESCHACH_FLOAT |
836 |
+ if ( (ret_val=fscanf(fp,"%u : %f",&col,&val)) != 2 ) |
837 |
+ #endif |
838 |
+ break; |
839 |
+--- a/splufctr.c |
840 |
++++ b/splufctr.c |
841 |
+@@ -56,21 +56,27 @@ |
842 |
+ Real max_val, tmp; |
843 |
+ static VEC *col_vals=VNULL; |
844 |
+ |
845 |
+- if ( ! A || ! px ) |
846 |
++ if ( ! A || ! px ) { |
847 |
+ error(E_NULL,"spLUfctr"); |
848 |
+- if ( alpha <= 0.0 || alpha > 1.0 ) |
849 |
++ } |
850 |
++ if ( alpha <= 0.0 || alpha > 1.0 ) { |
851 |
+ error(E_RANGE,"alpha in spLUfctr"); |
852 |
+- if ( px->size <= A->m ) |
853 |
++ } |
854 |
++ if ( px->size <= A->m ) { |
855 |
+ px = px_resize(px,A->m); |
856 |
++ } |
857 |
+ px_ident(px); |
858 |
+ col_vals = v_resize(col_vals,A->m); |
859 |
+ MEM_STAT_REG(col_vals,TYPE_VEC); |
860 |
+ |
861 |
+- m = A->m; n = A->n; |
862 |
+- if ( ! A->flag_col ) |
863 |
++ m = A->m; |
864 |
++ n = A->n; |
865 |
++ if ( ! A->flag_col ) { |
866 |
+ sp_col_access(A); |
867 |
+- if ( ! A->flag_diag ) |
868 |
++ } |
869 |
++ if ( ! A->flag_diag ) { |
870 |
+ sp_diag_access(A); |
871 |
++ } |
872 |
+ A->flag_col = A->flag_diag = FALSE; |
873 |
+ if ( ! merge ) { |
874 |
+ merge = sprow_get(20); |
875 |
+@@ -87,25 +93,29 @@ |
876 |
+ { |
877 |
+ r = &(A->row[i]); |
878 |
+ idx = sprow_idx(r,k); |
879 |
+- if ( idx < 0 ) |
880 |
++ if ( idx < 0 ) { |
881 |
+ tmp = 0.0; |
882 |
+- else |
883 |
++ } else { |
884 |
+ tmp = r->elt[idx].val; |
885 |
+- if ( fabs(tmp) > max_val ) |
886 |
++ } |
887 |
++ if ( fabs(tmp) > max_val ) { |
888 |
+ max_val = fabs(tmp); |
889 |
++ } |
890 |
+ col_vals->ve[i] = tmp; |
891 |
+ } |
892 |
+ |
893 |
+- if ( max_val == 0.0 ) |
894 |
++ if ( max_val == 0.0 ) { |
895 |
+ continue; |
896 |
++ } |
897 |
+ |
898 |
+ best_len = n+1; /* only if no possibilities */ |
899 |
+ best_i = -1; |
900 |
+ for ( i = k; i < m; i++ ) |
901 |
+ { |
902 |
+ tmp = fabs(col_vals->ve[i]); |
903 |
+- if ( tmp == 0.0 ) |
904 |
++ if ( tmp == 0.0 ) { |
905 |
+ continue; |
906 |
++ } |
907 |
+ if ( tmp >= alpha*max_val ) |
908 |
+ { |
909 |
+ r = &(A->row[i]); |
910 |
+@@ -171,17 +181,21 @@ |
911 |
+ SPROW *r; |
912 |
+ row_elt *elt; |
913 |
+ |
914 |
+- if ( ! A || ! b ) |
915 |
++ if ( ! A || ! b ) { |
916 |
+ error(E_NULL,"spLUsolve"); |
917 |
+- if ( (pivot != PNULL && A->m != pivot->size) || A->m != b->dim ) |
918 |
++ } |
919 |
++ if ( (pivot != PNULL && A->m != pivot->size) || A->m != b->dim ) { |
920 |
+ error(E_SIZES,"spLUsolve"); |
921 |
+- if ( ! x || x->dim != A->n ) |
922 |
++ } |
923 |
++ if ( ! x || x->dim != A->n ) { |
924 |
+ x = v_resize(x,A->n); |
925 |
++ } |
926 |
+ |
927 |
+- if ( pivot != PNULL ) |
928 |
++ if ( pivot != PNULL ) { |
929 |
+ x = px_vec(pivot,b,x); |
930 |
+- else |
931 |
++ } else { |
932 |
+ x = v_copy(b,x); |
933 |
++ } |
934 |
+ |
935 |
+ x_ve = x->ve; |
936 |
+ lim = min(A->m,A->n); |
937 |
+@@ -191,21 +205,24 @@ |
938 |
+ r = &(A->row[i]); |
939 |
+ len = r->len; |
940 |
+ elt = r->elt; |
941 |
+- for ( idx = 0; idx < len && elt->col < i; idx++, elt++ ) |
942 |
++ for ( idx = 0; idx < len && elt->col < i; idx++, elt++ ) { |
943 |
+ sum -= elt->val*x_ve[elt->col]; |
944 |
++ } |
945 |
+ x_ve[i] = sum; |
946 |
+ } |
947 |
+ |
948 |
+- for ( i = lim-1; i >= 0; i-- ) |
949 |
++ for ( i = lim; i-- > 0; ) |
950 |
+ { |
951 |
+ sum = x_ve[i]; |
952 |
+ r = &(A->row[i]); |
953 |
+ len = r->len; |
954 |
+ elt = &(r->elt[len-1]); |
955 |
+- for ( idx = len-1; idx >= 0 && elt->col > i; idx--, elt-- ) |
956 |
++ for ( idx = len-1; idx >= 0 && elt->col > i; idx--, elt-- ) { |
957 |
+ sum -= elt->val*x_ve[elt->col]; |
958 |
+- if ( idx < 0 || elt->col != i || elt->val == 0.0 ) |
959 |
++ } |
960 |
++ if ( idx < 0 || elt->col != i || elt->val == 0.0 ) { |
961 |
+ error(E_SING,"spLUsolve"); |
962 |
++ } |
963 |
+ x_ve[i] = sum/elt->val; |
964 |
+ } |
965 |
+ |
966 |
+--- a/sptort.c |
967 |
++++ b/sptort.c |
968 |
+@@ -39,9 +39,9 @@ |
969 |
+ |
970 |
+ /* for iterative methods */ |
971 |
+ |
972 |
+-#if REAL == DOUBLE |
973 |
++#if MESCHACH_REAL == MESCHACH_DOUBLE |
974 |
+ #define EPS 1e-7 |
975 |
+-#elif REAL == FLOAT |
976 |
++#elif MESCHACH_REAL == MESCHACH_FLOAT |
977 |
+ #define EPS 1e-3 |
978 |
+ #endif |
979 |
+ |
980 |
+--- a/zmatio.c |
981 |
++++ b/zmatio.c |
982 |
+@@ -53,18 +53,18 @@ |
983 |
+ fprintf(stderr,"real and imag parts: "); |
984 |
+ if ( fgets(line,MAXLINE,fp) == NULL ) |
985 |
+ error(E_EOF,"z_finput"); |
986 |
+-#if REAL == DOUBLE |
987 |
++#if MESCHACH_REAL == MESCHACH_DOUBLE |
988 |
+ io_code = sscanf(line,"%lf%lf",&z.re,&z.im); |
989 |
+-#elif REAL == FLOAT |
990 |
++#elif MESCHACH_REAL == MESCHACH_FLOAT |
991 |
+ io_code = sscanf(line,"%f%f",&z.re,&z.im); |
992 |
+ #endif |
993 |
+ |
994 |
+ } while ( io_code != 2 ); |
995 |
+ } |
996 |
+ else |
997 |
+-#if REAL == DOUBLE |
998 |
++#if MESCHACH_REAL == MESCHACH_DOUBLE |
999 |
+ if ( (io_code=fscanf(fp," (%lf,%lf)",&z.re,&z.im)) < 2 ) |
1000 |
+-#elif REAL == FLOAT |
1001 |
++#elif MESCHACH_REAL == MESCHACH_FLOAT |
1002 |
+ if ( (io_code=fscanf(fp," (%f,%f)",&z.re,&z.im)) < 2 ) |
1003 |
+ #endif |
1004 |
+ error((io_code == EOF) ? E_EOF : E_FORMAT,"z_finput"); |
1005 |
+@@ -129,9 +129,9 @@ |
1006 |
+ if ( (*line == 'f' || *line == 'F') && j < n-1 ) |
1007 |
+ { j++; dynamic = FALSE; goto redo2; } |
1008 |
+ } while ( *line=='\0' || |
1009 |
+-#if REAL == DOUBLE |
1010 |
++#if MESCHACH_REAL == MESCHACH_DOUBLE |
1011 |
+ sscanf(line,"%lf%lf", |
1012 |
+-#elif REAL == FLOAT |
1013 |
++#elif MESCHACH_REAL == MESCHACH_FLOAT |
1014 |
+ sscanf(line,"%f%f", |
1015 |
+ #endif |
1016 |
+ &mat->me[i][j].re,&mat->me[i][j].im)<1 ); |
1017 |
+@@ -176,9 +176,9 @@ |
1018 |
+ for ( j=0; j<n; j++ ) |
1019 |
+ { |
1020 |
+ /* printf("bzm_finput: j = %d\n", j); */ |
1021 |
+-#if REAL == DOUBLE |
1022 |
++#if MESCHACH_REAL == MESCHACH_DOUBLE |
1023 |
+ if ((io_code=fscanf(fp," ( %lf , %lf )", |
1024 |
+-#elif REAL == FLOAT |
1025 |
++#elif MESCHACH_REAL == MESCHACH_FLOAT |
1026 |
+ if ((io_code=fscanf(fp," ( %f , %f )", |
1027 |
+ #endif |
1028 |
+ &mat->me[i][j].re,&mat->me[i][j].im)) < 2 ) |
1029 |
+@@ -239,9 +239,9 @@ |
1030 |
+ if ( (*line == 'f' || *line == 'F') && i < dim-1 ) |
1031 |
+ { i++; dynamic = FALSE; goto redo; } |
1032 |
+ } while ( *line=='\0' || |
1033 |
+-#if REAL == DOUBLE |
1034 |
++#if MESCHACH_REAL == MESCHACH_DOUBLE |
1035 |
+ sscanf(line,"%lf%lf", |
1036 |
+-#elif REAL == FLOAT |
1037 |
++#elif MESCHACH_REAL == MESCHACH_FLOAT |
1038 |
+ sscanf(line,"%f%f", |
1039 |
+ #endif |
1040 |
+ &vec->ve[i].re,&vec->ve[i].im) < 2 ); |
1041 |
+@@ -271,9 +271,9 @@ |
1042 |
+ /* get entries */ |
1043 |
+ skipjunk(fp); |
1044 |
+ for ( i=0; i<dim; i++ ) |
1045 |
+-#if REAL == DOUBLE |
1046 |
++#if MESCHACH_REAL == MESCHACH_DOUBLE |
1047 |
+ if ((io_code=fscanf(fp," (%lf,%lf)", |
1048 |
+-#elif REAL == FLOAT |
1049 |
++#elif MESCHACH_REAL == MESCHACH_FLOAT |
1050 |
+ if ((io_code=fscanf(fp," (%f,%f)", |
1051 |
+ #endif |
1052 |
+ &vec->ve[i].re,&vec->ve[i].im)) < 2 ) |
1053 |
|
1054 |
diff --git a/sci-libs/meschach/files/meschach-makefile.patch b/sci-libs/meschach/files/meschach-makefile.patch |
1055 |
new file mode 100644 |
1056 |
index 000000000..701c91246 |
1057 |
--- /dev/null |
1058 |
+++ b/sci-libs/meschach/files/meschach-makefile.patch |
1059 |
@@ -0,0 +1,156 @@ |
1060 |
+--- a/configure.in |
1061 |
++++ b/configure.in |
1062 |
+@@ -44,14 +44,15 @@ |
1063 |
+ # and has a different meaning for keyword "complex"! Drew Parsons, 2001. |
1064 |
+ ##AC_HEADER_CHECK(complex.h, AC_DEFINE(HAVE_COMPLEX_H),) |
1065 |
+ AC_HEADER_CHECK(malloc.h, AC_DEFINE(HAVE_MALLOC_H),) |
1066 |
++AC_HEADER_CHECK(huge_val.h, AC_DEFINE(HAVE_HUGE_VAL_H),) |
1067 |
+ AC_HEADER_CHECK(varargs.h, AC_DEFINE(VARARGS),) |
1068 |
+ AC_DEFINE(NOT_SEGMENTED) |
1069 |
+ AC_SIZE_T |
1070 |
+ AC_CONST |
1071 |
+ AC_WORDS_BIGENDIAN |
1072 |
+-AC_WITH(complex, AC_DEFINE(COMPLEX)) |
1073 |
++AC_WITH(complex, AC_DEFINE(MESCHACH_COMPLEX)) |
1074 |
+ AC_WITH(sparse, AC_DEFINE(SPARSE)) |
1075 |
+-AC_WITH(all, AC_DEFINE(COMPLEX)) |
1076 |
++AC_WITH(all, AC_DEFINE(MESCHACH_COMPLEX)) |
1077 |
+ AC_WITH(all, AC_DEFINE(SPARSE)) |
1078 |
+ AC_WITH(unroll, AC_DEFINE(VUNROLL)) |
1079 |
+ AC_WITH(munroll, AC_DEFINE(MUNROLL)) |
1080 |
+--- a/makefile.in |
1081 |
++++ b/makefile.in |
1082 |
+@@ -18,8 +18,7 @@ |
1083 |
+ LIBS = @LIBS@ |
1084 |
+ RANLIB = @RANLIB@ |
1085 |
+ |
1086 |
+- |
1087 |
+-CFLAGS = -O3 -fPIC |
1088 |
++CFLAGS += -fPIC |
1089 |
+ |
1090 |
+ |
1091 |
+ .c.o: |
1092 |
+@@ -68,7 +67,7 @@ |
1093 |
+ |
1094 |
+ # Different configurations |
1095 |
+ # the dependencies **between** the parts are for dmake |
1096 |
+-all: shared static |
1097 |
++all: shared |
1098 |
+ #all: @PROGS@ part1 part2 part3 zpart1 zpart2 shared |
1099 |
+ part2: part1 |
1100 |
+ part3: part2 |
1101 |
+@@ -77,50 +76,10 @@ |
1102 |
+ zpart2: zpart1 |
1103 |
+ complex: part1 part2 zpart1 zpart2 |
1104 |
+ |
1105 |
++shared: libmeschach.so |
1106 |
+ |
1107 |
+-$(LIST1): $(HBASE) |
1108 |
+-part1: $(LIST1) |
1109 |
+- ar ru libmeschach.a $(LIST1) |
1110 |
+- $(RANLIB) libmeschach.a |
1111 |
+-# $(CC) -shared -o libmeschach.so $(LIST1) |
1112 |
+- |
1113 |
+-$(LIST2): $(HBASE) matrix2.h |
1114 |
+-part2: $(LIST2) |
1115 |
+- ar ru libmeschach.a $(LIST2) |
1116 |
+- $(RANLIB) libmeschach.a |
1117 |
+-# $(CC) -shared -o libmeschach.so $(LIST2) |
1118 |
+- |
1119 |
+-$(LIST3): $(HBASE) sparse.h sparse2.h |
1120 |
+-part3: $(LIST3) |
1121 |
+- ar ru libmeschach.a $(LIST3) |
1122 |
+- $(RANLIB) libmeschach.a |
1123 |
+-# $(CC) -shared -o libmeschach.so $(LIST3) |
1124 |
+- |
1125 |
+-$(ZLIST1): $(HBASDE) zmatrix.h |
1126 |
+-zpart1: $(ZLIST1) |
1127 |
+- ar ru libmeschach.a $(ZLIST1) |
1128 |
+- $(RANLIB) libmeschach.a |
1129 |
+-# $(CC) -shared -o libmeschach.so $(ZLIST1) |
1130 |
+- |
1131 |
+-$(ZLIST2): $(HBASE) zmatrix.h zmatrix2.h |
1132 |
+-zpart2: $(ZLIST2) |
1133 |
+- ar ru libmeschach.a $(ZLIST2) |
1134 |
+- $(RANLIB) libmeschach.a |
1135 |
+-# $(CC) -shared -o libmeschach.so $(ZLIST2) |
1136 |
+- |
1137 |
+-$(OLDLIST): $(HBASE) sparse.h sparse2.h |
1138 |
+-oldpart: $(OLDLIST) |
1139 |
+- ar ru libmeschach.a $(OLDLIST) |
1140 |
+- $(RANLIB) libmeschach.a |
1141 |
+-# $(CC) -shared -o libmeschach.so $(OLDLIST) |
1142 |
+- |
1143 |
+-shared: $(ALL_LISTS) |
1144 |
+- $(CC) -shared -o libmeschach.so $(ALL_LISTS) -lc -lm -Wl,-soname -Wl,libmeschach.so.$(vers) |
1145 |
+- |
1146 |
+-static: $(ALL_LISTS) |
1147 |
+- ar ru libmeschach.a $(ALL_LISTS) |
1148 |
+- $(RANLIB) libmeschach.a |
1149 |
+- |
1150 |
++libmeschach.so: $(ALL_LISTS) |
1151 |
++ $(CC) $(LDFLAGS) -shared -o libmeschach.so $(ALL_LISTS) -lc -lm -Wl,-soname -Wl,libmeschach.so.$(vers) |
1152 |
+ |
1153 |
+ ####################################### |
1154 |
+ |
1155 |
+@@ -199,32 +158,32 @@ |
1156 |
+ |
1157 |
+ alltorture: torture sptort ztorture memtort itertort mfuntort iotort |
1158 |
+ |
1159 |
+-torture:torture.o libmeschach.a |
1160 |
+- $(CC) $(CFLAGS) $(DEFS) -o torture torture.o \ |
1161 |
+- libmeschach.a $(LIBS) |
1162 |
+-sptort:sptort.o libmeschach.a |
1163 |
+- $(CC) $(CFLAGS) $(DEFS) -o sptort sptort.o \ |
1164 |
+- libmeschach.a $(LIBS) |
1165 |
+-memtort: memtort.o libmeschach.a |
1166 |
+- $(CC) $(CFLAGS) $(DEFS) -o memtort memtort.o \ |
1167 |
+- libmeschach.a $(LIBS) |
1168 |
+-ztorture:ztorture.o libmeschach.a |
1169 |
+- $(CC) $(CFLAGS) $(DEFS) -o ztorture ztorture.o \ |
1170 |
+- libmeschach.a $(LIBS) |
1171 |
+-itertort: itertort.o libmeschach.a |
1172 |
+- $(CC) $(CFLAGS) $(DEFS) -o itertort itertort.o \ |
1173 |
+- libmeschach.a $(LIBS) |
1174 |
+- |
1175 |
+-iotort: iotort.o libmeschach.a |
1176 |
+- $(CC) $(CFLAGS) $(DEFS) -o iotort iotort.o \ |
1177 |
+- libmeschach.a $(LIBS) |
1178 |
+-mfuntort: mfuntort.o libmeschach.a |
1179 |
+- $(CC) $(CFLAGS) $(DEFS) -o mfuntort mfuntort.o \ |
1180 |
+- libmeschach.a $(LIBS) |
1181 |
+-tstmove: tstmove.o libmeschach.a |
1182 |
+- $(CC) $(CFLAGS) $(DEFS) -o tstmove tstmove.o \ |
1183 |
+- libmeschach.a $(LIBS) |
1184 |
+-tstpxvec: tstpxvec.o libmeschach.a |
1185 |
+- $(CC) $(CFLAGS) $(DEFS) -o tstpxvec tstpxvec.o \ |
1186 |
+- libmeschach.a $(LIBS) |
1187 |
++torture:torture.o libmeschach.so |
1188 |
++ $(CC) $(CFLAGS) $(LDFLAGS) $(DEFS) -fPIE -o torture torture.o \ |
1189 |
++ -lmeschach -L. $(LIBS) |
1190 |
++sptort:sptort.o libmeschach.so |
1191 |
++ $(CC) $(CFLAGS) $(LDFLAGS) $(DEFS) -fPIE -o sptort sptort.o \ |
1192 |
++ -lmeschach -L. $(LIBS) |
1193 |
++memtort: memtort.o libmeschach.so |
1194 |
++ $(CC) $(CFLAGS) $(LDFLAGS) $(DEFS) -fPIE -o memtort memtort.o \ |
1195 |
++ -lmeschach -L. $(LIBS) |
1196 |
++ztorture:ztorture.o libmeschach.so |
1197 |
++ $(CC) $(CFLAGS) $(LDFLAGS) $(DEFS) -fPIE -o ztorture ztorture.o \ |
1198 |
++ -lmeschach -L. $(LIBS) |
1199 |
++itertort: itertort.o libmeschach.so |
1200 |
++ $(CC) $(CFLAGS) $(LDFLAGS) $(DEFS) -fPIE -o itertort itertort.o \ |
1201 |
++ -lmeschach -L. $(LIBS) |
1202 |
++ |
1203 |
++iotort: iotort.o libmeschach.so |
1204 |
++ $(CC) $(CFLAGS) $(LDFLAGS) $(DEFS) -fPIE -o iotort iotort.o \ |
1205 |
++ -lmeschach -L. $(LIBS) |
1206 |
++mfuntort: mfuntort.o libmeschach.so |
1207 |
++ $(CC) $(CFLAGS) $(LDFLAGS) $(DEFS) -fPIE -o mfuntort mfuntort.o \ |
1208 |
++ -lmeschach -L. $(LIBS) |
1209 |
++tstmove: tstmove.o libmeschach.so |
1210 |
++ $(CC) $(CFLAGS) $(LDFLAGS) $(DEFS) -fPIE -o tstmove tstmove.o \ |
1211 |
++ -lmeschach -L. $(LIBS) |
1212 |
++tstpxvec: tstpxvec.o libmeschach.so |
1213 |
++ $(CC) $(CFLAGS) $(LDFLAGS) $(DEFS) -fPIE -o tstpxvec tstpxvec.o \ |
1214 |
++ -lmeschach -L. $(LIBS) |
1215 |
+ |
1216 |
|
1217 |
diff --git a/sci-libs/meschach/meschach-1.2b.ebuild b/sci-libs/meschach/meschach-1.2b.ebuild |
1218 |
index b1f5b41bd..d973fb63a 100644 |
1219 |
--- a/sci-libs/meschach/meschach-1.2b.ebuild |
1220 |
+++ b/sci-libs/meschach/meschach-1.2b.ebuild |
1221 |
@@ -26,14 +26,15 @@ REQUIRED_USE=" |
1222 |
PATCHES=( |
1223 |
"${WORKDIR}/debian/patches/${PN}_${PV}-13.diff" |
1224 |
"${WORKDIR}/debian/patches/${PN}_${PV}-13.configure.diff" |
1225 |
- "${FILESDIR}/makefile.patch" |
1226 |
"${FILESDIR}/configure.patch" |
1227 |
+ "${FILESDIR}/${PN}-2-mbdyn.diff" |
1228 |
+ "${FILESDIR}/${PN}-makefile.patch" |
1229 |
) |
1230 |
|
1231 |
src_prepare() { |
1232 |
default |
1233 |
- use old && sed -i -- 's/all: shared static/all: oldpart shared static/g' makefile.in |
1234 |
mv configure.in configure.ac || die |
1235 |
+ use old && sed -i -- 's/all: shared static/all: oldpart shared static/g' makefile.ac |
1236 |
tc-export AR CC |
1237 |
eautoreconf |
1238 |
} |