Ejemplo n.º 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)
}
Ejemplo n.º 2
0
// 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)
}