Пример #1
0
// For triangular band matrix A and vector X solve
// X = inv(A) * X or X = inv(A.T) * X
func dtbsv(uplo, transA, diag string,
	N int, K int, A []float64, lda int, 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.dtbsv_(cuplo, ctransA, cdiag,
		(*C.int)(unsafe.Pointer(&N)),
		(*C.int)(unsafe.Pointer(&K)),
		(*C.double)(unsafe.Pointer(&A[0])),
		(*C.int)(unsafe.Pointer(&lda)),
		(*C.double)(unsafe.Pointer(&X[0])),
		(*C.int)(unsafe.Pointer(&incX)))
}
Пример #2
0
// For triangular band matrix A and vector X solve
// X = inv(A) * X or X = inv(A.T) * X
func dtbsv(uplo, transA, diag string,
	N int, K int, A []float64, lda int, 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.dtbsv_(cuplo, ctransA, cdiag,
		(*C.int)(unsafe.Pointer(&N)),
		(*C.int)(unsafe.Pointer(&K)),
		(*C.double)(unsafe.Pointer(&A[0])),
		(*C.int)(unsafe.Pointer(&lda)),
		(*C.double)(unsafe.Pointer(&X[0])),
		(*C.int)(unsafe.Pointer(&incX)))
}