コード例 #1
0
ファイル: cgo_double.go プロジェクト: hrautila/go.opt.old
// For triangular packed matrix A and vector X compute
// X = A * X, X = A.T * X
func dtpmv(uplo, transA, diag string,
	N int, Ap []float64, X []float64, incX int) {

	cuplo := C.CString(uplo)
	defer C.free(unsafe.Pointer(cuplo))
	ctransA := C.CString(transA)
	defer C.free(unsafe.Pointer(ctransA))
	cdiag := C.CString(diag)
	defer C.free(unsafe.Pointer(cdiag))

	C.dtpmv_(cuplo, ctransA, cdiag,
		(*C.int)(unsafe.Pointer(&N)),
		(*C.double)(unsafe.Pointer(&Ap[0])),
		(*C.double)(unsafe.Pointer(&X[0])),
		(*C.int)(unsafe.Pointer(&incX)))
}
コード例 #2
0
ファイル: cgo_double.go プロジェクト: sguzwf/algorithm
// For triangular packed matrix A and vector X compute
// X = A * X, X = A.T * X
func dtpmv(uplo, transA, diag string,
	N int, Ap []float64, X []float64, incX int) {

	cuplo := C.CString(uplo)
	defer C.free(unsafe.Pointer(cuplo))
	ctransA := C.CString(transA)
	defer C.free(unsafe.Pointer(ctransA))
	cdiag := C.CString(diag)
	defer C.free(unsafe.Pointer(cdiag))

	// ?? TODO: protect against index out of bounds panics.
	C.dtpmv_(cuplo, ctransA, cdiag,
		(*C.int)(unsafe.Pointer(&N)),
		(*C.double)(unsafe.Pointer(&Ap[0])),
		(*C.double)(unsafe.Pointer(&X[0])),
		(*C.int)(unsafe.Pointer(&incX)))
}