diff --git a/Makefile b/Makefile index 1d11717..90a6be8 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # Include the .env file and export the variables ifneq (,$(wildcard .env)) - include .env - export $(shell sed 's/=.*//' .env) + include .env + export $(shell sed 's/=.*//' .env) endif test: diff --git a/README.md b/README.md index 63dc150..6b33398 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,10 @@ -# Go-Blis +# Go-Lapack + +Linear algebra package in golang using native bindings to various architecture specific linear algebra libraries. + +The difference between this repository [gonum](https://github.com/gonum/gonum) is gonum is a golang native implementation while this repo uses native bindings to the blas or blis. + +## go-blis Go-Blis is a Go wrapper for the [BLIS](https://github.com/flame/blis) library. BLIS is a portable software framework for instantiating high-performance BLAS-like dense linear algebra libraries. The framework was designed to isolate essential kernels of computation that, when optimized, immediately enable optimized implementations of most of its commonly used and computationally intensive operations. diff --git a/blis/level3/level3.go b/blis/level3/level3.go new file mode 100644 index 0000000..e6d2549 --- /dev/null +++ b/blis/level3/level3.go @@ -0,0 +1,19 @@ +package level3 + +// #cgo LDFLAGS: -lblis +// #include "blis.h" +import "C" +import ( + "github.com/jmoney/go-blas/mat" +) + +// Bli_dgemm maps to bli_dgemm in BLIS. +// +// Computes the operation: C := (alpha * A') * (beta * B') + C +func Bli_dgemm(transa mat.TransT, transb mat.TransT, alpha *float64, a mat.General, beta *float64, b mat.General, c mat.General) { + C.bli_dgemm(C.trans_t(transa), C.trans_t(transb), + C.longlong(a.Rows), C.longlong(b.Cols), C.longlong(a.Cols), + (*C.double)(alpha), (*C.double)(&a.Data[0]), C.longlong(a.RowsStride), C.longlong(a.ColsStride), + (*C.double)(&b.Data[0]), C.longlong(b.RowsStride), C.longlong(b.ColsStride), (*C.double)(beta), + (*C.double)(&c.Data[0]), C.longlong(c.RowsStride), C.longlong(c.ColsStride)) +} diff --git a/level3/level3_test.go b/blis/level3/level3_test.go similarity index 100% rename from level3/level3_test.go rename to blis/level3/level3_test.go diff --git a/level3/level3.go b/level3/level3.go deleted file mode 100644 index 819d73a..0000000 --- a/level3/level3.go +++ /dev/null @@ -1,27 +0,0 @@ -package level3 - -// #cgo LDFLAGS: -lblis -// #include "blis.h" -import "C" -import ( - "github.com/jmoney/go-blas/mat" -) - -/* -void bli_?gemm( - - trans_t transa, - trans_t transb, - dim_t m, - dim_t n, - dim_t k, - ctype* alpha, - ctype* a, inc_t rsa, inc_t csa, - ctype* b, inc_t rsb, inc_t csb, - ctype* beta, - ctype* c, inc_t rsc, inc_t csc - ); -*/ -func Bli_dgemm(transa mat.TransT, transb mat.TransT, alpha *float64, a mat.General, beta *float64, b mat.General, c mat.General) { - C.bli_dgemm(C.trans_t(transa), C.trans_t(transb), C.longlong(a.Rows), C.longlong(b.Cols), C.longlong(a.Cols), (*C.double)(alpha), (*C.double)(&a.Data[0]), C.longlong(a.RowsStride), C.longlong(a.ColsStride), (*C.double)(&b.Data[0]), C.longlong(b.RowsStride), C.longlong(b.ColsStride), (*C.double)(beta), (*C.double)(&c.Data[0]), C.longlong(c.RowsStride), C.longlong(c.ColsStride)) -}