From 04bd16aeb391e67716344268cf0f43d1f31f180a Mon Sep 17 00:00:00 2001 From: cnlohr Date: Sat, 17 Mar 2018 14:21:20 -0400 Subject: Update dcl and test. --- redist/dclapack.h | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'redist/dclapack.h') diff --git a/redist/dclapack.h b/redist/dclapack.h index 2823c5d..cae377b 100644 --- a/redist/dclapack.h +++ b/redist/dclapack.h @@ -37,9 +37,9 @@ /* * Returns the identity matrix (with size n x n, but width Ic) */ -#define IDENTITY(I, n) \ +#define IDENTITY(I, m, n) \ { \ - for (int _i = 0; _i < (n); _i++) { \ + for (int _i = 0; _i < (m); _i++) { \ for (int _j = 0; _j < _i; _j++) { \ _(I, _i, _j) = 0.0f; \ } \ @@ -50,6 +50,17 @@ } \ } + +/* + * Returns the identity matrix (with size n x n, but width Ic) + */ +#define ZERO(Z, m, n) \ + { \ + for (int _i = 0; _i < (m); _i++) \ + for (int _j = 0; _j < (n); _j++) \ + _(Z, _i, _j) = 0.0f; \ + } + /* * R = Transpose(A) * A is (m by n) @@ -79,7 +90,7 @@ _(U, _i, _j) = _(A, _i, _j); \ } \ } \ - IDENTITY(L, n); \ + IDENTITY(L, n, n); \ \ for (_i = 0; _i < (n)-1; _i++) { \ \ @@ -188,7 +199,7 @@ #define INV(Ainv,A,n,ORDER) { \ INV_SETUP(ORDER) \ int Piv[ORDER]; \ - IDENTITY(I,n); \ + IDENTITY(I,n,n); \ LU(L,U,A,Piv,n); \ PIVOT(Ipiv,I,Piv,n,n); \ L_SUB(C,L,Ipiv,n,n); \ @@ -258,6 +269,7 @@ PRINT(Ainv,n,n); \ for (int _k = 0; _k < n; _k++) { \ sum += _(A, _i, _k) * _(B, _k, _j); \ } \ + printf( "-> %d %d = %f %f %f %f[%d %d]\n", _i, _j, alpha,sum,beta, _(C,_i,_j), _i, _j ); \ _(R, _i, _j) = alpha * sum + beta * _(C, _i, _j); \ } \ } \ -- cgit v1.2.3