1. Fazlul Shahriar
  2. cgo-cblas

Commits

Fazlul Shahriar  committed 6a20347

add more level1 functions

  • Participants
  • Parent commits 69300a5
  • Branches default

Comments (0)

Files changed (1)

File cblas/level1.go

View file
 	return int(C.cblas_izamax(C.int(x.Size),
 		unsafe.Pointer(&x.Data[0]), C.int(x.Stride)))
 }
+
+/*
+void cblas_sswap(const int N, float *X, const int incX,
+                 float *Y, const int incY);
+void cblas_scopy(const int N, const float *X, const int incX,
+                 float *Y, const int incY);
+*/
+
+// Saxpy updates y: y <- alpha*x + y.
+func Saxpy(alpha float32, x, y *Float64Vector) {
+	C.cblas_saxpy(C.int(x.Size), C.float(alpha),
+		(*C.float)(unsafe.Pointer(&x.Data[0])), C.int(x.Stride),
+		(*C.float)(unsafe.Pointer(&y.Data[0])), C.int(y.Stride))
+}
+
+/*
+void cblas_dswap(const int N, double *X, const int incX,
+                 double *Y, const int incY);
+void cblas_dcopy(const int N, const double *X, const int incX,
+                 double *Y, const int incY);
+*/
+
+// Daxpy updates y: y <- alpha*x + y.
+func Daxpy(alpha float64, x, y *Float64Vector) {
+	C.cblas_daxpy(C.int(x.Size), C.double(alpha),
+		(*C.double)(unsafe.Pointer(&x.Data[0])), C.int(x.Stride),
+		(*C.double)(unsafe.Pointer(&y.Data[0])), C.int(y.Stride))
+}
+
+/*
+void cblas_cswap(const int N, void *X, const int incX,
+                 void *Y, const int incY);
+void cblas_ccopy(const int N, const void *X, const int incX,
+                 void *Y, const int incY);
+*/
+
+// Caxpy updates y: y <- alpha*x + y.
+func Caxpy(alpha complex64, x, y *Complex64Vector) {
+	C.cblas_caxpy(C.int(x.Size), unsafe.Pointer(&alpha),
+		unsafe.Pointer(&x.Data[0]), C.int(x.Stride),
+		unsafe.Pointer(&y.Data[0]), C.int(y.Stride))
+}
+
+/*
+void cblas_zswap(const int N, void *X, const int incX,
+                 void *Y, const int incY);
+void cblas_zcopy(const int N, const void *X, const int incX,
+                 void *Y, const int incY);
+*/
+
+// Zaxpy updates y: y <- alpha*x + y.
+func Zaxpy(alpha complex128, x, y *Complex128Vector) {
+	C.cblas_zaxpy(C.int(x.Size), unsafe.Pointer(&alpha),
+		unsafe.Pointer(&x.Data[0]), C.int(x.Stride),
+		unsafe.Pointer(&y.Data[0]), C.int(y.Stride))
+}
+
+/*
+void cblas_srotg(float *a, float *b, float *c, float *s);
+void cblas_srotmg(float *d1, float *d2, float *b1, const float b2, float *P);
+void cblas_srot(const int N, float *X, const int incX,
+                float *Y, const int incY, const float c, const float s);
+void cblas_srotm(const int N, float *X, const int incX,
+                float *Y, const int incY, const float *P);
+
+void cblas_drotg(double *a, double *b, double *c, double *s);
+void cblas_drotmg(double *d1, double *d2, double *b1, const double b2, double *P);
+void cblas_drot(const int N, double *X, const int incX,
+                double *Y, const int incY, const double c, const double s);
+void cblas_drotm(const int N, double *X, const int incX,
+                double *Y, const int incY, const double *P);
+*/
+
+// Sscal scales x by constant alpha.
+func Sscal(alpha float32, x *Float32Vector) {
+	C.cblas_sscal(C.int(x.Size), C.float(alpha),
+		(*C.float)(unsafe.Pointer(&x.Data[0])), C.int(x.Stride))
+}
+
+// Dscal scales x by constant alpha.
+func Dscal(alpha float64, x *Float64Vector) {
+	C.cblas_dscal(C.int(x.Size), C.double(alpha),
+		(*C.double)(unsafe.Pointer(&x.Data[0])), C.int(x.Stride))
+}
+
+// Cscal scales x by constant alpha.
+func Cscal(alpha complex64, x *Complex64Vector) {
+	C.cblas_cscal(C.int(x.Size), unsafe.Pointer(&alpha),
+		unsafe.Pointer(&x.Data[0]), C.int(x.Stride))
+}
+
+// Zscal scales x by constant alpha.
+func Zscal(alpha complex128, x *Complex128Vector) {
+	C.cblas_zscal(C.int(x.Size), unsafe.Pointer(&alpha),
+		unsafe.Pointer(&x.Data[0]), C.int(x.Stride))
+}
+
+// Csscal scales x by constant alpha.
+func Csscal(alpha float32, x *Complex64Vector) {
+	C.cblas_csscal(C.int(x.Size), C.float(alpha),
+		unsafe.Pointer(&x.Data[0]), C.int(x.Stride))
+}
+
+// Zdscal scales x by constant alpha.
+func Zdscal(alpha float64, x *Complex128Vector) {
+	C.cblas_zdscal(C.int(x.Size), C.double(alpha),
+		unsafe.Pointer(&x.Data[0]), C.int(x.Stride))
+}