コード例 #1
0
ファイル: cgo_double.go プロジェクト: sguzwf/algorithm
func dtrmm(side, uplo, transA, diag string,
	M int, N int, alpha float64, A []float64, lda int, B []float64, ldb int) {

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

	// protect against index out of bounds panics
	var aptr, bptr *float64 = nil, nil
	if len(A) > 0 {
		aptr = &A[0]
	}
	if len(B) > 0 {
		bptr = &B[0]
	}
	C.dtrmm_(cside, cuplo, ctrans, cdiag,
		(*C.int)(unsafe.Pointer(&M)),
		(*C.int)(unsafe.Pointer(&N)),
		(*C.double)(unsafe.Pointer(&alpha)),
		(*C.double)(unsafe.Pointer(aptr)),
		(*C.int)(unsafe.Pointer(&lda)),
		(*C.double)(unsafe.Pointer(bptr)),
		(*C.int)(unsafe.Pointer(&ldb)))
}
コード例 #2
0
ファイル: cgo_double.go プロジェクト: hrautila/go.opt.old
func dtrmm(side, uplo, transA, diag string,
	M int, N int, alpha float64, A []float64, lda int, B []float64, ldb int) {

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

	C.dtrmm_(cside, cuplo, ctrans, cdiag,
		(*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(&B[0])),
		(*C.int)(unsafe.Pointer(&ldb)))
}