func dgetrsHelper(trans bool, n, nrhs int, a []float64, lda int, ipiv []C.integer, b []float64, ldb int) error { var ( trans_ = transChar(trans) 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.dgetrs_(&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)) } }
// DTRTRS: complex double-precision TRiangular Solve // // http://www.netlib.org/lapack/complex16/ztrtrs.f func ztrtrs(tri Triangle, h bool, diag diagType, n, nrhs int, a []complex128, lda int, b []complex128, ldb int) error { var ( uplo_ = uploChar(tri) trans_ = conjTransChar(h) diag_ = diagChar(diag) n_ = C.integer(n) nrhs_ = C.integer(nrhs) a_ = ptrComplex128(a) lda_ = C.integer(lda) b_ = ptrComplex128(b) ldb_ = C.integer(ldb) ) var info_ C.integer C.ztrtrs_(&uplo_, &trans_, &diag_, &n_, &nrhs_, a_, &lda_, b_, &ldb_, &info_) info := int(info_) switch { case info < 0: return errInvalidArg(-info) case info > 0: return errSingular(info) default: return nil } }
func zgeevHelper(jobvl, jobvr jobzMode, n int, a []complex128, lda int, w, vl []complex128, ldvl int, vr []complex128, ldvr int, work []complex128, lwork int, rwork []float64) error { var ( jobvl_ = jobzChar(jobvl) jobvr_ = jobzChar(jobvr) n_ = C.integer(n) a_ = ptrComplex128(a) lda_ = C.integer(lda) w_ = ptrComplex128(w) vl_ = ptrComplex128(vl) ldvl_ = C.integer(ldvl) vr_ = ptrComplex128(vr) ldvr_ = C.integer(ldvr) work_ = ptrComplex128(work) lwork_ = C.integer(lwork) rwork_ = ptrFloat64(rwork) ) var info_ C.integer C.zgeev_(&jobvl_, &jobvr_, &n_, a_, &lda_, w_, vl_, &ldvl_, vr_, &ldvr_, work_, &lwork_, rwork_, &info_) info := int(info_) switch { case info < 0: return errInvalidArg(-info) case info > 0: return errOffDiagFailConverge(info) default: return nil } }
// Needs to be supplied ipiv and work. func zhesvHelper(n, nrhs int, a []complex128, lda int, ipiv []C.integer, b []complex128, ldb int, work []complex128, lwork int) error { var ( uplo_ = C.char(DefaultTri) 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) work_ = ptrComplex128(work) lwork_ = C.integer(lwork) ) var info_ C.integer C.zhesv_(&uplo_, &n_, &nrhs_, a_, &lda_, ipiv_, b_, &ldb_, work_, &lwork_, &info_) info := int(info_) switch { case info < 0: return errInvalidArg(-info) case info > 0: return errSingular(info) default: return nil } }
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)) } }
func zheevHelper(jobz jobzMode, uplo Triangle, n int, a []complex128, lda int, w []float64, work []complex128, lwork int, rwork []float64) error { var ( jobz_ = jobzChar(jobz) uplo_ = uploChar(uplo) n_ = C.integer(n) a_ = ptrComplex128(a) lda_ = C.integer(lda) w_ = ptrFloat64(w) work_ = ptrComplex128(work) lwork_ = C.integer(lwork) rwork_ = ptrFloat64(rwork) ) var info_ C.integer C.zheev_(&jobz_, &uplo_, &n_, a_, &lda_, w_, work_, &lwork_, rwork_, &info_) info := int(info_) switch { case info < 0: return errInvalidArg(-info) case info > 0: return errOffDiagFailConverge(info) default: return nil } }
// DPOTRF: (Double-precision) POsitive-definite TRiangular Factor // // http://www.netlib.org/lapack/double/dpotrf.f func dpotrf(uplo Triangle, n int, a []float64, lda int) error { var ( uplo_ = uploChar(uplo) n_ = C.integer(n) a_ = ptrFloat64(a) lda_ = C.integer(lda) ) var info_ C.integer C.dpotrf_(&uplo_, &n_, a_, &lda_, &info_) return dpotrfError(int(info_)) }
// ZPOTRF: complex double-precision POsitive-definite TRiangular Factor // // http://www.netlib.org/lapack/complex16/zpotrf.f func zpotrf(uplo Triangle, n int, a []complex128, lda int) error { var ( uplo_ = uploChar(uplo) n_ = C.integer(n) a_ = ptrComplex128(a) lda_ = C.integer(lda) ) var info_ C.integer C.zpotrf_(&uplo_, &n_, a_, &lda_, &info_) return zpotrfError(int(info_)) }
func zgetrfHelper(m, n int, a []complex128, lda int, ipiv []C.integer) error { var ( m_ = C.integer(m) n_ = C.integer(n) a_ = ptrComplex128(a) lda_ = C.integer(lda) ipiv_ = ptrInt(ipiv) ) var info_ C.integer C.zgetrf_(&m_, &n_, a_, &lda_, ipiv_, &info_) return zgetrfError(int(info_)) }
func dgetrfHelper(m, n int, a []float64, lda int, ipiv []C.integer) error { var ( m_ = C.integer(m) n_ = C.integer(n) a_ = ptrFloat64(a) lda_ = C.integer(lda) ipiv_ = ptrInt(ipiv) ) var info_ C.integer C.dgetrf_(&m_, &n_, a_, &lda_, ipiv_, &info_) return dgetrfError(int(info_)) }
// 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_)) }
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_)) }
// ZPOSV: complex double-precision POsitive-definite SolVe // // http://www.netlib.org/lapack/complex16/zposv.f func zposv(n, nrhs int, a []complex128, lda int, b []complex128, ldb int) error { var ( uplo_ = C.char(DefaultTri) n_ = C.integer(n) nrhs_ = C.integer(nrhs) a_ = ptrComplex128(a) lda_ = C.integer(lda) b_ = ptrComplex128(b) ldb_ = C.integer(ldb) ) var info_ C.integer C.zposv_(&uplo_, &n_, &nrhs_, a_, &lda_, b_, &ldb_, &info_) return zpotrfError(int(info_)) }
func zgesvHelper(n, nrhs int, a []complex128, lda int, ipiv []C.integer, b []complex128, ldb int) error { var ( 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.zgesv_(&n_, &nrhs_, a_, &lda_, ipiv_, b_, &ldb_, &info_) return zgetrfError(int(info_)) }
func toCInt(x []int) []C.integer { if len(x) == 0 { return nil } y := make([]C.integer, len(x)) for i, xi := range x { y[i] = C.integer(xi) } return y }
// ZPOTRI: complex double-precision POsitive-definite TRiangular factor Invert // // http://www.netlib.org/lapack/complex16/zpotri.f func zpotri(uplo Triangle, n int, a []complex128, lda int) error { var ( uplo_ = uploChar(uplo) n_ = C.integer(n) a_ = ptrComplex128(a) lda_ = C.integer(lda) ) var info_ C.integer C.zpotri_(&uplo_, &n_, a_, &lda_, &info_) info := int(info_) switch { case info < 0: return errInvalidArg(-info) case info == 0: return nil default: return errNotPosDef(info) } }
func zunmqrHelper(side matSide, h bool, m, n, k int, a []complex128, lda int, tau []complex128, c []complex128, ldc int, work []complex128, lwork int) error { var ( side_ = sideChar(side) trans_ = conjTransChar(h) m_ = C.integer(m) n_ = C.integer(n) k_ = C.integer(k) a_ = ptrComplex128(a) lda_ = C.integer(lda) tau_ = ptrComplex128(tau) c_ = ptrComplex128(c) ldc_ = C.integer(ldc) work_ = ptrComplex128(work) lwork_ = C.integer(lwork) ) var info_ C.integer C.zunmqr_(&side_, &trans_, &m_, &n_, &k_, a_, &lda_, tau_, c_, &ldc_, work_, &lwork_, &info_) info := int(info_) switch { case info < 0: return errInvalidArg(-info) case info == 0: return nil default: panic(errUnknown(info)) } }
func zgelsHelper(m, n, nrhs int, a []complex128, lda int, b []complex128, ldb int, work []complex128, lwork int) error { var ( trans_ = conjTransChar(false) m_ = C.integer(m) n_ = C.integer(n) nrhs_ = C.integer(nrhs) a_ = ptrComplex128(a) lda_ = C.integer(lda) b_ = ptrComplex128(b) ldb_ = C.integer(ldb) work_ = ptrComplex128(work) lwork_ = C.integer(lwork) ) var info_ C.integer C.zgels_(&trans_, &m_, &n_, &nrhs_, a_, &lda_, b_, &ldb_, work_, &lwork_, &info_) info := int(info_) switch { case info < 0: return errInvalidArg(-info) case info > 0: return errNotFullRank(info) default: return nil } }
func zgesddHelper(m, n int, a []complex128, lda int, s []float64, u []complex128, ldu int, vt []complex128, ldvt int, work []complex128, lwork int, rwork []float64, iwork []C.integer) error { var ( jobz_ = C.char('S') m_ = C.integer(m) n_ = C.integer(n) a_ = ptrComplex128(a) lda_ = C.integer(lda) s_ = ptrFloat64(s) u_ = ptrComplex128(u) ldu_ = C.integer(ldu) vt_ = ptrComplex128(vt) ldvt_ = C.integer(ldvt) work_ = ptrComplex128(work) lwork_ = C.integer(lwork) rwork_ = ptrFloat64(rwork) iwork_ = ptrInt(iwork) ) var info_ C.integer C.zgesdd_(&jobz_, &m_, &n_, a_, &lda_, s_, u_, &ldu_, vt_, &ldvt_, work_, &lwork_, rwork_, iwork_, &info_) info := int(info_) switch { case info < 0: return errInvalidArg(-info) case info > 0: return errFailConverge(info) default: return nil } }
func dormqrHelper(side matSide, trans bool, m, n, k int, a []float64, lda int, tau []float64, c []float64, ldc int, work []float64, lwork int) error { var ( side_ = sideChar(side) trans_ = transChar(trans) m_ = C.integer(m) n_ = C.integer(n) k_ = C.integer(k) a_ = ptrFloat64(a) lda_ = C.integer(lda) tau_ = ptrFloat64(tau) c_ = ptrFloat64(c) ldc_ = C.integer(ldc) work_ = ptrFloat64(work) lwork_ = C.integer(lwork) ) var info_ C.integer C.dormqr_(&side_, &trans_, &m_, &n_, &k_, a_, &lda_, tau_, c_, &ldc_, work_, &lwork_, &info_) info := int(info_) switch { case info < 0: return errInvalidArg(-info) case info == 0: return nil default: panic(errUnknown(info)) } }
func zgelsdHelper(m, n, nrhs int, a []complex128, lda int, b []complex128, ldb int, s []float64, rcond float64, work []complex128, lwork int, rwork []float64, iwork []C.integer) error { var ( m_ = C.integer(m) n_ = C.integer(n) nrhs_ = C.integer(nrhs) a_ = ptrComplex128(a) lda_ = C.integer(lda) b_ = ptrComplex128(b) ldb_ = C.integer(ldb) s_ = ptrFloat64(s) rcond_ = C.doublereal(rcond) work_ = ptrComplex128(work) lwork_ = C.integer(lwork) rwork_ = ptrFloat64(rwork) iwork_ = ptrInt(iwork) ) var ( rank_ C.integer info_ C.integer ) C.zgelsd_(&m_, &n_, &nrhs_, a_, &lda_, b_, &ldb_, s_, &rcond_, &rank_, work_, &lwork_, rwork_, iwork_, &info_) info := int(info_) switch { case info < 0: return errInvalidArg(-info) case info > 0: return errOffDiagFailConverge(info) default: return nil } }
// http://www.netlib.org/blas/dgemm.f func dgemm(transa, transb Transpose, m, n, k int, alpha float64, a []float64, lda int, b []float64, ldb int, beta float64, c []float64, ldc int) { var ( transa_ = C.char(transa) transb_ = C.char(transb) m_ = C.integer(m) n_ = C.integer(n) k_ = C.integer(k) alpha_ = (*C.doublereal)(unsafe.Pointer(&alpha)) a_ *C.doublereal lda_ = C.integer(lda) b_ *C.doublereal ldb_ = C.integer(ldb) beta_ = (*C.doublereal)(unsafe.Pointer(&beta)) c_ *C.doublereal ldc_ = C.integer(ldc) ) if len(a) > 0 { a_ = (*C.doublereal)(unsafe.Pointer(&a[0])) } if len(b) > 0 { b_ = (*C.doublereal)(unsafe.Pointer(&b[0])) } if len(c) > 0 { c_ = (*C.doublereal)(unsafe.Pointer(&c[0])) } C.dgemm_(&transa_, &transb_, &m_, &n_, &k_, alpha_, a_, &lda_, b_, &ldb_, beta_, c_, &ldc_) }
// ZPOTRS: complex double-precision POsitive-definite TRiangular factor Solve // // http://www.netlib.org/lapack/complex16/zpotrs.f func zpotrs(uplo Triangle, n, nrhs int, a []complex128, lda int, b []complex128, ldb int) error { var ( uplo_ = uploChar(uplo) n_ = C.integer(n) nrhs_ = C.integer(nrhs) a_ = ptrComplex128(a) lda_ = C.integer(lda) b_ = ptrComplex128(b) ldb_ = C.integer(ldb) ) var info_ C.integer C.zpotrs_(&uplo_, &n_, &nrhs_, a_, &lda_, b_, &ldb_, &info_) info := int(info_) switch { case info < 0: return errInvalidArg(-info) case info == 0: return nil default: panic(errUnknown(info)) } }
func zgeqrfHelper(m, n int, a []complex128, lda int, tau, work []complex128, lwork int) error { var ( m_ = C.integer(m) n_ = C.integer(n) a_ = ptrComplex128(a) lda_ = C.integer(lda) tau_ = ptrComplex128(tau) work_ = ptrComplex128(work) lwork_ = C.integer(lwork) ) var info_ C.integer C.zgeqrf_(&m_, &n_, a_, &lda_, tau_, work_, &lwork_, &info_) info := int(info_) switch { case info < 0: return errInvalidArg(-info) case info == 0: return nil default: panic(errUnknown(info)) } }
func zhetrfHelper(uplo Triangle, n int, a []complex128, lda int, ipiv []C.integer, work []complex128, lwork int) error { var ( uplo_ = C.char(uplo) n_ = C.integer(n) a_ = ptrComplex128(a) lda_ = C.integer(lda) ipiv_ = ptrInt(ipiv) work_ = ptrComplex128(work) lwork_ = C.integer(lwork) ) var info_ C.integer C.zhetrf_(&uplo_, &n_, a_, &lda_, ipiv_, work_, &lwork_, &info_) info := int(info_) switch { case info < 0: return errInvalidArg(-info) case info > 0: return errSingular(info) default: return nil } }