diff options
author | Alberto Ruiz <aruiz@um.es> | 2008-11-14 16:16:04 +0000 |
---|---|---|
committer | Alberto Ruiz <aruiz@um.es> | 2008-11-14 16:16:04 +0000 |
commit | f0a2248b9d9532e0814519408bff8b886bca2bbc (patch) | |
tree | 05d0751368350fe12b6f402528441290c49e64af /lib/Data/Packed/Internal/auxi.c | |
parent | b69fa7ed53d52e812afd27547f4f63e74cfe5527 (diff) |
subMatrix reimplemented and removed auxi.c
Diffstat (limited to 'lib/Data/Packed/Internal/auxi.c')
-rw-r--r-- | lib/Data/Packed/Internal/auxi.c | 71 |
1 files changed, 0 insertions, 71 deletions
diff --git a/lib/Data/Packed/Internal/auxi.c b/lib/Data/Packed/Internal/auxi.c deleted file mode 100644 index 5c06cb6..0000000 --- a/lib/Data/Packed/Internal/auxi.c +++ /dev/null | |||
@@ -1,71 +0,0 @@ | |||
1 | #include "auxi.h" | ||
2 | #include <gsl/gsl_matrix.h> | ||
3 | #include <string.h> | ||
4 | #include <stdio.h> | ||
5 | |||
6 | #define MACRO(B) do {B} while (0) | ||
7 | #define ERROR(CODE) MACRO(return CODE;) | ||
8 | #define REQUIRES(COND, CODE) MACRO(if(!(COND)) {ERROR(CODE);}) | ||
9 | #define OK return 0; | ||
10 | |||
11 | #define MIN(A,B) ((A)<(B)?(A):(B)) | ||
12 | #define MAX(A,B) ((A)>(B)?(A):(B)) | ||
13 | |||
14 | #ifdef DBG | ||
15 | #define DEBUGMSG(M) printf("*** calling aux C function: %s\n",M); | ||
16 | #else | ||
17 | #define DEBUGMSG(M) | ||
18 | #endif | ||
19 | |||
20 | #define CHECK(RES,CODE) MACRO(if(RES) return CODE;) | ||
21 | |||
22 | #ifdef DBG | ||
23 | #define DEBUGMAT(MSG,X) printf(MSG" = \n"); gsl_matrix_fprintf(stdout,X,"%f"); printf("\n"); | ||
24 | #else | ||
25 | #define DEBUGMAT(MSG,X) | ||
26 | #endif | ||
27 | |||
28 | #ifdef DBG | ||
29 | #define DEBUGVEC(MSG,X) printf(MSG" = \n"); gsl_vector_fprintf(stdout,X,"%f"); printf("\n"); | ||
30 | #else | ||
31 | #define DEBUGVEC(MSG,X) | ||
32 | #endif | ||
33 | |||
34 | #define DVVIEW(A) gsl_vector_view A = gsl_vector_view_array(A##p,A##n) | ||
35 | #define DMVIEW(A) gsl_matrix_view A = gsl_matrix_view_array(A##p,A##r,A##c) | ||
36 | #define CVVIEW(A) gsl_vector_complex_view A = gsl_vector_complex_view_array((double*)A##p,A##n) | ||
37 | #define CMVIEW(A) gsl_matrix_complex_view A = gsl_matrix_complex_view_array((double*)A##p,A##r,A##c) | ||
38 | #define KDVVIEW(A) gsl_vector_const_view A = gsl_vector_const_view_array(A##p,A##n) | ||
39 | #define KDMVIEW(A) gsl_matrix_const_view A = gsl_matrix_const_view_array(A##p,A##r,A##c) | ||
40 | #define KCVVIEW(A) gsl_vector_complex_const_view A = gsl_vector_complex_const_view_array((double*)A##p,A##n) | ||
41 | #define KCMVIEW(A) gsl_matrix_complex_const_view A = gsl_matrix_complex_const_view_array((double*)A##p,A##r,A##c) | ||
42 | |||
43 | #define V(a) (&a.vector) | ||
44 | #define M(a) (&a.matrix) | ||
45 | |||
46 | #define GCVEC(A) int A##n, gsl_complex*A##p | ||
47 | #define KGCVEC(A) int A##n, const gsl_complex*A##p | ||
48 | |||
49 | #define BAD_SIZE 2000 | ||
50 | #define BAD_CODE 2001 | ||
51 | #define MEM 2002 | ||
52 | #define BAD_FILE 2003 | ||
53 | |||
54 | |||
55 | int submatrixR(int r1, int r2, int c1, int c2, KRMAT(x),RMAT(r)) { | ||
56 | REQUIRES(0<=r1 && r1<=r2 && r2<xr && 0<=c1 && c1<=c2 && c2<xc && | ||
57 | rr==r2-r1+1 && rc==c2-c1+1,BAD_SIZE); | ||
58 | DEBUGMSG("submatrixR"); | ||
59 | KDMVIEW(x); | ||
60 | DMVIEW(r); | ||
61 | gsl_matrix_const_view S = gsl_matrix_const_submatrix(M(x),r1,c1,rr,rc); | ||
62 | int res = gsl_matrix_memcpy(M(r),M(S)); | ||
63 | CHECK(res,res); | ||
64 | OK | ||
65 | } | ||
66 | |||
67 | //--------------------------------------- | ||
68 | void asm_finit() { | ||
69 | asm("finit"); | ||
70 | } | ||
71 | //--------------------------------------- | ||