aboutsummaryrefslogtreecommitdiff
path: root/redist/dclapack.h
diff options
context:
space:
mode:
Diffstat (limited to 'redist/dclapack.h')
-rw-r--r--redist/dclapack.h61
1 files changed, 33 insertions, 28 deletions
diff --git a/redist/dclapack.h b/redist/dclapack.h
index 7f30187..0950815 100644
--- a/redist/dclapack.h
+++ b/redist/dclapack.h
@@ -9,14 +9,14 @@
#define _ABS(a) ( (a)<=0 ? 0-(a) : (a) )
-//Tricky: If you want to use this with pointers, instead of 2D arrays, you will
-//need to #define DYNAMIC_INDEX, as well as, for all arrays, suffix their name
-//with 'c'
+// Tricky: If you want to use this with pointers, instead of 2D arrays, you will
+// need to #define DYNAMIC_INDEX, as well as, for all arrays, suffix their name
+// with 'c'
#ifdef DYNAMIC_INDEX
- #define _(AM,O,P) AM[O*AM##c+P]
+#define _(AM, O, P) AM[O * AM##c + P]
#else
- #define _(AM,O,P) AM[O][P]
+#define _(AM, O, P) AM[O][P]
#endif
/*
@@ -50,7 +50,6 @@
} \
}
-
/*
* Returns the identity matrix (with size n x n, but width Ic)
*/
@@ -90,7 +89,7 @@
_(U, _i, _j) = _(A, _i, _j); \
} \
} \
- IDENTITY(L, n, n); \
+ IDENTITY(L, n, n); \
\
for (_i = 0; _i < (n)-1; _i++) { \
\
@@ -181,30 +180,36 @@
*/
#ifdef DYNAMIC_INDEX
- #define INV_SETUP(ORDER) \
- FLOAT Ipiv[ORDER*ORDER]; const int Ipivc = ORDER; \
- FLOAT L[ORDER*ORDER]; const int Lc = ORDER; \
- FLOAT U[ORDER*ORDER]; const int Uc = ORDER; \
- FLOAT I[ORDER*ORDER]; const int Ic = ORDER; \
- FLOAT C[ORDER*ORDER]; const int Cc = ORDER;
+#define INV_SETUP(ORDER) \
+ FLOAT Ipiv[ORDER * ORDER]; \
+ const int Ipivc = ORDER; \
+ FLOAT L[ORDER * ORDER]; \
+ const int Lc = ORDER; \
+ FLOAT U[ORDER * ORDER]; \
+ const int Uc = ORDER; \
+ FLOAT I[ORDER * ORDER]; \
+ const int Ic = ORDER; \
+ FLOAT C[ORDER * ORDER]; \
+ const int Cc = ORDER;
#else
- #define INV_SETUP(ORDER) \
- FLOAT Ipiv[ORDER][ORDER]; \
- FLOAT L[ORDER][ORDER]; \
- FLOAT U[ORDER][ORDER]; \
- FLOAT I[ORDER][ORDER]; \
- FLOAT C[ORDER][ORDER];
+#define INV_SETUP(ORDER) \
+ FLOAT Ipiv[ORDER][ORDER]; \
+ FLOAT L[ORDER][ORDER]; \
+ FLOAT U[ORDER][ORDER]; \
+ FLOAT I[ORDER][ORDER]; \
+ FLOAT C[ORDER][ORDER];
#endif
-#define INV(Ainv,A,n,ORDER) { \
- INV_SETUP(ORDER) \
- int Piv[ORDER]; \
- IDENTITY(I,n,n); \
- LU(L,U,A,Piv,n); \
- PIVOT(Ipiv,I,Piv,n,n); \
- L_SUB(C,L,Ipiv,n,n); \
- U_SUB(Ainv,U,C,n,n); \
-}
+#define INV(Ainv, A, n, ORDER) \
+ { \
+ INV_SETUP(ORDER) \
+ int Piv[ORDER]; \
+ IDENTITY(I, n, n); \
+ LU(L, U, A, Piv, n); \
+ PIVOT(Ipiv, I, Piv, n, n); \
+ L_SUB(C, L, Ipiv, n, n); \
+ U_SUB(Ainv, U, C, n, n); \
+ }
/*
PRINT(A,n,n); \