예제 #1
0
파일: cgo_double.go 프로젝트: jvlmdr/linalg
// void dposv_(char *uplo, int *n, int *nrhs, double *A, int *lda,
//		double *B, int *ldb, int *info);
func dposv(uplo string, N, Nrhs int, A []float64, lda int, B []float64, ldb int) int {
	var info int = 0
	cuplo := C.CString(uplo)
	defer C.free(unsafe.Pointer(cuplo))
	C.dposv_(cuplo,
		(*C.int)(unsafe.Pointer(&N)),
		(*C.int)(unsafe.Pointer(&Nrhs)),
		(*C.double)(unsafe.Pointer(&A[0])),
		(*C.int)(unsafe.Pointer(&lda)),
		(*C.double)(unsafe.Pointer(&B[0])),
		(*C.int)(unsafe.Pointer(&ldb)),
		(*C.int)(unsafe.Pointer(&info)))
	return info
}
예제 #2
0
파일: cgo_dposv.go 프로젝트: jvlmdr/lin-go
// DPOSV: (Double-precision) POsitive-definite SolVe
//
// http://www.netlib.org/lapack/double/dposv.f
func dposv(n, nrhs int, a []float64, lda int, b []float64, ldb int) error {
	var (
		uplo_ = C.char(DefaultTri)
		n_    = C.integer(n)
		nrhs_ = C.integer(nrhs)
		a_    = ptrFloat64(a)
		lda_  = C.integer(lda)
		b_    = ptrFloat64(b)
		ldb_  = C.integer(ldb)
	)
	var info_ C.integer

	C.dposv_(&uplo_, &n_, &nrhs_, a_, &lda_, b_, &ldb_, &info_)
	return dpotrfError(int(info_))
}