1. binet
  2. go-cblas

Commits

Sebastien Binet  committed b45ba69

more skeletons

  • Participants
  • Parent commits 03e8de4
  • Branches default

Comments (0)

Files changed (9)

File LICENSE

View file
 
 We will gladly answer any questions regarding the software. If a
 modification is done, however, it is the responsibility of the person
-who modified the routine to provide support. 
+who modified the routine to provide support. 

File Makefile

View file
+# Copyright 2009 The Go Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style
+# license that can be found in the LICENSE file.
+
+include ${GOROOT}/src/Make.inc
+
+all: install
+
+DIRS=\
+        pkg\
+        tests\
+
+
+clean.dirs: $(addsuffix .clean, $(DIRS))
+install.dirs: $(addsuffix .install, $(DIRS))
+nuke.dirs: $(addsuffix .nuke, $(DIRS))
+test.dirs: $(addsuffix .test, $(TEST))
+bench.dirs: $(addsuffix .bench, $(BENCH))
+
+%.clean:
+	+cd $* && $(QUOTED_GOBIN)/gomake clean
+
+%.install:
+	+cd $* && $(QUOTED_GOBIN)/gomake install
+
+clean: clean.dirs
+
+install: install.dirs
+
+#-include ${GOROOT}/src/Make.deps

File pkg/Makefile

View file
+# Copyright 2009 The Go Authors.  All rights reserved.
+# Use of this source code is governed by a BSD-style
+# license that can be found in the LICENSE file.
+
+include $(GOROOT)/src/Make.inc
+
+TARG=cblas
+
+CGO_LDFLAGS=-lcblas
+
+CGOFILES=\
+	cblas_lvl1.go\
+	cblas_lvl2.go\
+	cblas_lvl3.go\
+	cblas.go
+
+
+include $(GOROOT)/src/Make.pkg
+
+%: install %.go
+	$(GC) $*.go
+	$(LD) -o $@ $*.$O

File pkg/cblas.go

View file
+// simplistic wrapper around the C-interface to the BLAS
+package cblas
+
+//#include "cblas.h"
+//#include <stdlib.h>
+//#include <string.h>
+import "C"
+
+func init() {
+	
+}
+
+// EOF

File pkg/cblas_lvl1.go

View file
+// simplistic wrapper around the C-interface to the BLAS
+package cblas
+
+//#include "cblas.h"
+//#include <stdlib.h>
+//#include <string.h>
+import "C"
+import "unsafe"
+
+func Sdsdot(N int, alpha float, 
+	X []float, incX int,
+	Y []float, incY int) float {
+	c_X := (*C.float)(unsafe.Pointer(&X[0]))
+	c_Y := (*C.float)(unsafe.Pointer(&Y[0]))
+
+	return float(
+		C.cblas_sdsdot(C.int(N), C.float(alpha),
+		 c_X, C.int(incX),
+		 c_Y, C.int(incY)))
+}

File pkg/cblas_lvl2.go

View file
+// simplistic wrapper around the C-interface to the BLAS
+package cblas
+
+//#include "cblas.h"
+//#include <stdlib.h>
+//#include <string.h>
+import "C"
+import "unsafe"
+
+func Sgemv() {
+	
+}

File pkg/cblas_lvl3.go

View file
+// simplistic wrapper around the C-interface to the BLAS
+package cblas
+
+//#include "cblas.h"
+//#include <stdlib.h>
+//#include <string.h>
+import "C"
+import "unsafe"
+
+func Sgemm() {
+	
+}

File tests/Makefile

View file
+# Copyright 2009 The Go Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style
+# license that can be found in the LICENSE file.
+
+include ${GOROOT}/src/Make.inc
+
+TARG=go-cblas-t1
+GOFILES=\
+	t1.go
+
+include ${GOROOT}/src/Make.cmd

File tests/t1.go

View file
+package main
+
+import _ "cblas"
+
+func main() {
+	
+}
+
+/*
+     #include <stdio.h>
+     
+     int
+     main (void)
+     {
+       int lda = 3;
+     
+       float A[] = { 0.11, 0.12, 0.13,
+                     0.21, 0.22, 0.23 };
+     
+       int ldb = 2;
+       
+       float B[] = { 1011, 1012,
+                     1021, 1022,
+                     1031, 1032 };
+     
+       int ldc = 2;
+     
+       float C[] = { 0.00, 0.00,
+                     0.00, 0.00 };
+     
+       // Compute C = A B 
+     
+       cblas_sgemm (CblasRowMajor, 
+                    CblasNoTrans, CblasNoTrans, 2, 2, 3,
+                    1.0, A, lda, B, ldb, 0.0, C, ldc);
+     
+       printf ("[ %g, %g\n", C[0], C[1]);
+       printf ("  %g, %g ]\n", C[2], C[3]);
+     
+       return 0;  
+     }
+
+*/