Skip to content

Commit

Permalink
added hemm example to examples.d file
Browse files Browse the repository at this point in the history
  • Loading branch information
ActiveAnalytics committed Apr 4, 2017
1 parent 739d1f4 commit 28db011
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 9 deletions.
26 changes: 26 additions & 0 deletions source/dblas/examples.d
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,32 @@ import std.complex: Complex, complex;
** to make sure that they are running properly.
*/


/* C function for hemm */
extern (C){
void cblas_zhemm(in CBLAS_ORDER Order, in CBLAS_SIDE Side,
in CBLAS_UPLO Uplo, in int M, in int N,
in void *alpha, in void *A, in int lda, in void *B,
in int ldb, in void *beta, void *C, in int ldc);
}

/* Testing for hemm */
void test_hemm(){
CBLAS_LAYOUT order = CblasRowMajor;
CBLAS_SIDE side = CblasLeft;
CBLAS_UPLO uplo = CblasUpper;

Complex!double[] a = [complex(-0.359, 0.089)];
Complex!double[] b = [complex(-0.451, -0.337), complex(-0.901, -0.871)];
Complex!double[] c = [complex(0.729, 0.631), complex(0.364, 0.246)];
Complex!double alpha = complex(0, 0.1), beta = alpha;

int ldc = 2, ldb = 2, lda = 1, m = 1, n = 2;
hemm(order, side, uplo, m, n, alpha, a.ptr, lda, b.ptr, ldb, beta, c.ptr, ldc);
writeln("hemm (Complex!double): ", c);
}


/* C function for gemm */
extern (C){
void cblas_dgemm(const CBLAS_ORDER Order, const CBLAS_TRANSPOSE TransA,
Expand Down
14 changes: 5 additions & 9 deletions source/dblas/package.d
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ import std.complex: Complex, complex;
/* To compile: */
/* dub build dblas # or dub run ... */

/* C function for gemm */
/* C function for hemm */
extern (C){
void
cblas_zhemm (in CBLAS_ORDER Order, in CBLAS_SIDE Side,
in CBLAS_UPLO Uplo, in int M, in int N,
in void *alpha, in void *A, in int lda, in void *B,
in int ldb, in void *beta, void *C, in int ldc);
void cblas_zhemm(in CBLAS_ORDER Order, in CBLAS_SIDE Side,
in CBLAS_UPLO Uplo, in int M, in int N,
in void *alpha, in void *A, in int lda, in void *B,
in int ldb, in void *beta, void *C, in int ldc);
}

/* Testing for hemm */
Expand All @@ -45,6 +44,3 @@ void main(){
writeln("hemm (Complex!double): ", c);
}

/*void hemm(N, X)(in CBLAS_ORDER order, in CBLAS_SIDE side, in CBLAS_UPLO uplo, in N m, in N n,
in X* alpha, in X* a, in N lda, in X* b, in N ldb, in X* beta, X* c, in N ldc)*/

0 comments on commit 28db011

Please sign in to comment.