예제 #1
0
// Calculate norm2(X).
func dnrm2(N int, X []float64, incX int) float64 {
	var val C.double
	val = C.dnrm2_((*C.int)(unsafe.Pointer(&N)),
		(*C.double)(unsafe.Pointer(&X[0])),
		(*C.int)(unsafe.Pointer(&incX)))
	return float64(val)
}
예제 #2
0
파일: blas.go 프로젝트: rygomez/goutil
// extern double dnrm2_(int *n, double *x, int *incx);
func Dnrm2(n int, x []float64, incX int) float64 {
	r := C.dnrm2_(
		(*C.int)(unsafe.Pointer(&n)),
		array64(x),
		(*C.int)(unsafe.Pointer(&incX)),
	)
	return float64(r)
}