aboutsummaryrefslogtreecommitdiff
path: root/redist
diff options
context:
space:
mode:
authorcnlohr <lohr85@gmail.com>2018-03-17 03:15:46 -0400
committercnlohr <lohr85@gmail.com>2018-03-17 03:15:46 -0400
commitf0c26bd1b0b8ffe05c0c5f04567a9b7aa47c3e6b (patch)
tree3b869cafdea395944a5f9677dcbdafdec9027e5d /redist
parent08eec7a6bd5edc0fd1cae7f98d7788ea3905a467 (diff)
downloadlibsurvive-f0c26bd1b0b8ffe05c0c5f04567a9b7aa47c3e6b.tar.gz
libsurvive-f0c26bd1b0b8ffe05c0c5f04567a9b7aa47c3e6b.tar.bz2
Update dclapack to do automatic size-of-array'ing
Diffstat (limited to 'redist')
-rw-r--r--redist/dclapack.h8
-rw-r--r--redist/dclhelpers.c28
-rw-r--r--redist/dclhelpers.h4
3 files changed, 24 insertions, 16 deletions
diff --git a/redist/dclapack.h b/redist/dclapack.h
index 1dc7b77..af8869c 100644
--- a/redist/dclapack.h
+++ b/redist/dclapack.h
@@ -9,10 +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'
+
#ifdef DYNAMIC_INDEX
- #define _(A,O,P) A[O*A##c+P]
+ #define _(AM,O,P) AM[O*AM##c+P]
#else
- #define _(A,O,P) A[O][P]
+ #define _(AM,O,P) AM[O][P]
#endif
diff --git a/redist/dclhelpers.c b/redist/dclhelpers.c
index 9fa9266..c3725f8 100644
--- a/redist/dclhelpers.c
+++ b/redist/dclhelpers.c
@@ -69,34 +69,40 @@ void dcldgemm(
int k,
DCL_FLOAT alpha,
const DCL_FLOAT* A,
- int lda, //must be n
+ int Ac, //must be n
const DCL_FLOAT* B,
- int ldb, //must be m
+ int Bc, //must be m
DCL_FLOAT beta,
- const DCL_FLOAT * C,
- int ldc //must be n
+ DCL_FLOAT * C,
+ int Cc //must be n
)
{
const DCL_FLOAT * ta;
const DCL_FLOAT * tb;
+ int tac = Ac;
+ int tbc = Bc;
if( transA )
{
- ta = alloca( sizeof( DCL_FLOAT ) * n * m );
- //TRANSP( ta, A, n, m );
+ DCL_FLOAT * la = alloca( sizeof( DCL_FLOAT ) * n * m );
+ const int lac = m;
+ TRANSP( la, A, n, m );
+ ta = la;
+ tac = lac;
}
else
ta = A;
if( transB )
{
- tb = alloca( sizeof( DCL_FLOAT ) * n * m );
- //TRANSP( tb, B, n, m );
+ DCL_FLOAT * lb = alloca( sizeof( DCL_FLOAT ) * n * m );
+ const int lbc = m;
+ TRANSP( lb, B, n, m );
+ tb = lb;
+ tbc = lbc;
}
else
tb = B;
-
- //XXX Tricky: In here, A is mxn
-
+ GMULADD(C,ta,tb,C,alpha,beta,n,m,k);
}
diff --git a/redist/dclhelpers.h b/redist/dclhelpers.h
index 5010e02..8779e1a 100644
--- a/redist/dclhelpers.h
+++ b/redist/dclhelpers.h
@@ -3,8 +3,6 @@
#define DCL_FLOAT FLT
-//XXX XXX XXX WARNING XXX XXX XXX The argument order may be changing!!!
-
/* Prints matrix A of size[n][m] */
void dclPrint( const DCL_FLOAT * A, int Ac, int n, int m );
@@ -75,7 +73,7 @@ void dcldgemm(
const DCL_FLOAT* B,
int Bc,
DCL_FLOAT beta,
- const DCL_FLOAT * C,
+ DCL_FLOAT * C,
int Cc
);