示例#1
0
/*
 double cblas_dasum(const int N, const double *X, const int incX);
*/
func Dasum(x []float64) float64 {
	c_N := C.int(len(x))

	c_X := (*C.double)(unsafe.Pointer(&x[0]))
	c_incX := C.int(1)

	return float64(C.cblas_dasum(c_N, c_X, c_incX))
}
示例#2
0
文件: blas.go 项目: hellcoderz/go-nlp
// Return the sum of v
func (v vector) sum() float64 {
	return float64(C.cblas_dasum(C.int(len(v)), (*C.double)(unsafe.Pointer(&v[0])), 1))
}