Пример #1
0
// dgesv_(int *n, int *nrhs, double *A, int *lda, int *ipiv, double *B, int *ldb, int *info);
func dgesv(N, Nrhs int, A []float64, lda int, ipiv []int32, B []float64, ldb int) int {
	var info int = 0
	C.dgesv_((*C.int)(unsafe.Pointer(&N)), (*C.int)(unsafe.Pointer(&Nrhs)),
		(*C.double)(unsafe.Pointer(&A[0])), (*C.int)(unsafe.Pointer(&lda)),
		(*C.int)(unsafe.Pointer(&ipiv[0])),
		(*C.double)(unsafe.Pointer(&B[0])), (*C.int)(unsafe.Pointer(&ldb)),
		(*C.int)(unsafe.Pointer(&info)))
	return info
}
Пример #2
0
func dgesvHelper(n, nrhs int, a []float64, lda int, ipiv []C.integer, b []float64, ldb int) error {
	var (
		n_    = C.integer(n)
		nrhs_ = C.integer(nrhs)
		a_    = ptrFloat64(a)
		lda_  = C.integer(lda)
		ipiv_ = ptrInt(ipiv)
		b_    = ptrFloat64(b)
		ldb_  = C.integer(ldb)
	)
	var info_ C.integer

	C.dgesv_(&n_, &nrhs_, a_, &lda_, ipiv_, b_, &ldb_, &info_)
	return dgetrfError(int(info_))
}