예제 #1
0
// For general matrix A and vector X and Y compute
// Y = alpha * A * X + beta * Y or Y = alpha * A.T * X + beta * Y
func dgemv(transA string, M int, N int, alpha float64,
	A []float64, lda int, X []float64, incX int, beta float64,
	Y []float64, incY int) {

	ctransA := C.CString(transA)
	defer C.free(unsafe.Pointer(ctransA))

	C.dgemv_(ctransA,
		(*C.int)(unsafe.Pointer(&M)),
		(*C.int)(unsafe.Pointer(&N)),
		(*C.double)(unsafe.Pointer(&alpha)),
		(*C.double)(unsafe.Pointer(&A[0])),
		(*C.int)(unsafe.Pointer(&lda)),
		(*C.double)(unsafe.Pointer(&X[0])),
		(*C.int)(unsafe.Pointer(&incX)),
		(*C.double)(unsafe.Pointer(&beta)),
		(*C.double)(unsafe.Pointer(&Y[0])),
		(*C.int)(unsafe.Pointer(&incY)))
}
예제 #2
0
// For general matrix A and vector X and Y compute
// Y = alpha * A * X + beta * Y or Y = alpha * A.T * X + beta * Y
func dgemv(transA string, M int, N int, alpha float64,
	A []float64, lda int, X []float64, incX int, beta float64,
	Y []float64, incY int) {

	ctransA := C.CString(transA)
	defer C.free(unsafe.Pointer(ctransA))

	// ?? TODO: protect against index out of bounds panics.
	C.dgemv_(ctransA,
		(*C.int)(unsafe.Pointer(&M)),
		(*C.int)(unsafe.Pointer(&N)),
		(*C.double)(unsafe.Pointer(&alpha)),
		(*C.double)(unsafe.Pointer(&A[0])),
		(*C.int)(unsafe.Pointer(&lda)),
		(*C.double)(unsafe.Pointer(&X[0])),
		(*C.int)(unsafe.Pointer(&incX)),
		(*C.double)(unsafe.Pointer(&beta)),
		(*C.double)(unsafe.Pointer(&Y[0])),
		(*C.int)(unsafe.Pointer(&incY)))
}