Commits

Anonymous committed accf825

add zdotc

Comments (0)

Files changed (1)

pkg/cblas_lvl1.go

 	c_incX := C.int(1)
 
 	c_Y := (*C.float)(unsafe.Pointer(&y[0]))
-	c_incY := C.int(-1)
+	c_incY := C.int(1)
 
 	return float32(
 		C.cblas_sdsdot(c_N, c_alpha,
 	c_incX := C.int(1)
 
 	c_Y := (*C.float)(unsafe.Pointer(&y[0]))
-	c_incY := C.int(-1)
+	c_incY := C.int(1)
 
 	return float64(
 		C.cblas_dsdot(c_N,
 }
 
 /*
- float  cblas_sdot(const int N, const float  *X, const int incX,
- const float  *Y, const int incY);
+ float  cblas_sdot(const int N, const float  *X, const int incX, const float  *Y, const int incY);
  */
 func Sdot(x, y []float32) float32 {
 	if len(x) != len(y) {
 	c_incX := C.int(1)
 
 	c_Y := (*C.float)(unsafe.Pointer(&y[0]))
-	c_incY := C.int(-1)
+	c_incY := C.int(1)
 
 	return float32(
 		C.cblas_sdot(c_N,
 }
 
 /*
- double cblas_ddot(const int N, const double *X, const int incX,
- const double *Y, const int incY);
+ double cblas_ddot(const int N, const double *X, const int incX, const double *Y, const int incY);
  */
 func Ddot(x, y []float64) float64 {
 	if len(x) != len(y) {
 	c_incX := C.int(1)
 
 	c_Y := (*C.double)(unsafe.Pointer(&y[0]))
-	c_incY := C.int(-1)
+	c_incY := C.int(1)
 
 	return float64(
 		C.cblas_ddot(c_N,
 }
 
 /*
- void   cblas_cdotu_sub(const int N, const void *X, const int incX,
- const void *Y, const int incY, void *dotu);
+ void   cblas_cdotu_sub(const int N, const void *X, const int incX, const void *Y, const int incY, void *dotu);
  */
 func Cdotu(x, y []complex64) complex64 {
 
 	c_incX := C.int(1)
 
 	c_Y := unsafe.Pointer(&y[0])
-	c_incY := C.int(-1)
+	c_incY := C.int(1)
 
 	C.cblas_cdotu_sub(c_N,
 		c_X, c_incX,
 }
 
 /*
- void   cblas_cdotc_sub(const int N, const void *X, const int incX,
- const void *Y, const int incY, void *dotc);
+ void   cblas_cdotc_sub(const int N, const void *X, const int incX, const void *Y, const int incY, void *dotc);
  */
 func Cdotc(x, y []complex64) complex64 {
 
 	c_incX := C.int(1)
 
 	c_Y := unsafe.Pointer(&y[0])
-	c_incY := C.int(-1)
+	c_incY := C.int(1)
 
 	C.cblas_cdotc_sub(c_N,
 		c_X, c_incX,
 }
 
 /*
- void   cblas_zdotu_sub(const int N, const void *X, const int incX,
- const void *Y, const int incY, void *dotu);
+ void   cblas_zdotu_sub(const int N, const void *X, const int incX, const void *Y, const int incY, void *dotu);
  */
 func Zdotu(x, y []complex128) complex128 {
 
 	c_incX := C.int(1)
 
 	c_Y := unsafe.Pointer(&y[0])
-	c_incY := C.int(-1)
+	c_incY := C.int(1)
 
 	C.cblas_zdotu_sub(c_N,
 		c_X, c_incX,
 }
 
 /*
- void   cblas_zdotc_sub(const int N, const void *X, const int incX,
- const void *Y, const int incY, void *dotc);
- func Zdotc(x,y []complex64) complex64 {
+ void   cblas_zdotc_sub(const int N, const void *X, const int incX, const void *Y, const int incY, void *dotc);
+ */
+func Zdotc(x,y []complex64) complex64 {
 
  if len(x) != len(y) {
- panic("slices' size differ")
- }
+		panic("slices' size differ")
+	}
 
- var ret C.complexfloat
- c_ret := (*C.char)(unsafe.Pointer(ret))
+	var ret C.complexfloat
+	c_ret := unsafe.Pointer(&ret)
 
- c_N := C.int(len(x))
+	c_N := C.int(len(x))
 
- c_X    := (*C.complexfloat)(unsafe.Pointer(&x[0]))
- c_incX := C.int(1)
+	c_X    := unsafe.Pointer(&x[0])
+	c_incX := C.int(1)
 
- c_Y    := (*C.complexfloat)(unsafe.Pointer(&y[0]))
- c_incY := C.int(-1)
+	c_Y    := unsafe.Pointer(&y[0])
+	c_incY := C.int(1)
 
- C.cblas_cdotu_sub(c_N,
- c_X, c_incX,
- c_Y, c_incY,
- c_ret)
+	C.cblas_cdotu_sub(c_N,
+		c_X, c_incX,
+		c_Y, c_incY,
+		c_ret)
 
- return complex(
- float32(ret.real), 
- float32(ret.imag))
- }
- */
+	return complex(
+		float32(C.crealf(ret)), 
+		float32(C.cimagf(ret)))
+}
 
 /*
  float  cblas_snrm2(const int N, const float *X, const int incX);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.