Example #1
0
func zgetrsHelper(h bool, n, nrhs int, a []complex128, lda int, ipiv []C.integer, b []complex128, ldb int) error {
	var (
		trans_ = conjTransChar(h)
		n_     = C.integer(n)
		nrhs_  = C.integer(nrhs)
		a_     = ptrComplex128(a)
		lda_   = C.integer(lda)
		ipiv_  = ptrInt(ipiv)
		b_     = ptrComplex128(b)
		ldb_   = C.integer(ldb)
	)
	var info_ C.integer

	C.zgetrs_(&trans_, &n_, &nrhs_, a_, &lda_, ipiv_, b_, &ldb_, &info_)

	info := int(info_)
	switch {
	case info < 0:
		return errInvalidArg(-info)
	case info == 0:
		return nil
	default:
		panic(errUnknown(info))
	}
}
Example #2
0
// void zgetrs_(char *trans, int *n, int *nrhs, complex *A, int *lda, int *ipiv, complex *B, int *ldb, int *info);
func zgetrs(trans string, N, Nrhs int, A []complex128, lda int, ipiv []int32, B []complex128, ldb int) int {
	ctrans := C.CString(trans)
	defer C.free(unsafe.Pointer(ctrans))
	var info int = 0
	C.zgetrs_(ctrans,
		(*C.int)(unsafe.Pointer(&N)),
		(*C.int)(unsafe.Pointer(&Nrhs)),
		(unsafe.Pointer(&A[0])),
		(*C.int)(unsafe.Pointer(&lda)),
		(*C.int)(unsafe.Pointer(&ipiv[0])),
		(unsafe.Pointer(&B[0])),
		(*C.int)(unsafe.Pointer(&ldb)),
		(*C.int)(unsafe.Pointer(&info)))
	return info
}