-- Do not edit! Automatically generated by create-lapack-ffi.
module Numeric.LAPACK.ComfortArray.ComplexFloat where

import qualified Numeric.LAPACK.FFI.ComplexFloat as FFI
import qualified Numeric.Netlib.ComfortArray.Utility as Call
import Numeric.Netlib.ComfortArray.Utility (ZeroInt, (^!))

import qualified Data.Array.Comfort.Storable.Mutable as MutArray
import qualified Data.Array.Comfort.Storable as Array
import Data.Array.Comfort.Storable.Mutable (IOArray)
import Data.Array.Comfort.Storable (Array)

import Data.Complex (Complex)

import Foreign.Storable.Complex ()
import Foreign.Storable (peek)
import Foreign.Ptr (Ptr, FunPtr)
import Foreign.C.String (castCCharToChar)
import Foreign.C.Types (CInt)

import Control.Monad.Trans.Cont (evalContT)
import Control.Monad.IO.Class (liftIO)
import Control.Applicative (pure, (<*>))


-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cbbcsd.f>
bbcsd ::
   Char {- ^ jobu1 -} ->
   Char {- ^ jobu2 -} ->
   Char {- ^ jobv1t -} ->
   Char {- ^ jobv2t -} ->
   Char {- ^ trans -} ->
   Int {- ^ m -} ->
   IOArray ZeroInt Float {- ^ theta -} ->
   IOArray ZeroInt Float {- ^ phi -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ u1 -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ u2 -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ v1t -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ v2t -} ->
   Int {- ^ lrwork -} ->
   IO (Array ZeroInt Float, Array ZeroInt Float, Array ZeroInt Float, Array ZeroInt Float, Array ZeroInt Float, Array ZeroInt Float, Array ZeroInt Float, Array ZeroInt Float, Int)
bbcsd jobu1 jobu2 jobv1t jobv2t trans m theta phi u1 u2 v1t v2t lrwork = do
   let thetaDim0 = Call.sizes1 $ MutArray.shape theta
   let phiDim0 = Call.sizes1 $ MutArray.shape phi
   let (u1Dim0,u1Dim1) = Call.sizes2 $ MutArray.shape u1
   let (u2Dim0,u2Dim1) = Call.sizes2 $ MutArray.shape u2
   let (v1tDim0,v1tDim1) = Call.sizes2 $ MutArray.shape v1t
   let (v2tDim0,v2tDim1) = Call.sizes2 $ MutArray.shape v2t
   let q = thetaDim0
   let p = u1Dim0
   let ldu1 = u1Dim1
   let ldu2 = u2Dim1
   let ldv1t = v1tDim1
   let ldv2t = v2tDim1
   Call.assert "bbcsd: q-1 == phiDim0" (q-1 == phiDim0)
   Call.assert "bbcsd: m-p == u2Dim0" (m-p == u2Dim0)
   Call.assert "bbcsd: q == v1tDim0" (q == v1tDim0)
   Call.assert "bbcsd: m-q == v2tDim0" (m-q == v2tDim0)
   b11d <- Call.newArray1 q
   b11e <- Call.newArray1 (q-1)
   b12d <- Call.newArray1 q
   b12e <- Call.newArray1 (q-1)
   b21d <- Call.newArray1 q
   b21e <- Call.newArray1 (q-1)
   b22d <- Call.newArray1 q
   b22e <- Call.newArray1 (q-1)
   rwork <- Call.newArray1 (maximum[1,lrwork])
   evalContT $ do
      jobu1Ptr <- Call.char jobu1
      jobu2Ptr <- Call.char jobu2
      jobv1tPtr <- Call.char jobv1t
      jobv2tPtr <- Call.char jobv2t
      transPtr <- Call.char trans
      mPtr <- Call.cint m
      pPtr <- Call.cint p
      qPtr <- Call.cint q
      thetaPtr <- Call.ioarray theta
      phiPtr <- Call.ioarray phi
      u1Ptr <- Call.ioarray u1
      ldu1Ptr <- Call.cint ldu1
      u2Ptr <- Call.ioarray u2
      ldu2Ptr <- Call.cint ldu2
      v1tPtr <- Call.ioarray v1t
      ldv1tPtr <- Call.cint ldv1t
      v2tPtr <- Call.ioarray v2t
      ldv2tPtr <- Call.cint ldv2t
      b11dPtr <- Call.ioarray b11d
      b11ePtr <- Call.ioarray b11e
      b12dPtr <- Call.ioarray b12d
      b12ePtr <- Call.ioarray b12e
      b21dPtr <- Call.ioarray b21d
      b21ePtr <- Call.ioarray b21e
      b22dPtr <- Call.ioarray b22d
      b22ePtr <- Call.ioarray b22e
      rworkPtr <- Call.ioarray rwork
      lrworkPtr <- Call.cint lrwork
      infoPtr <- Call.alloca
      liftIO $ FFI.bbcsd jobu1Ptr jobu2Ptr jobv1tPtr jobv2tPtr transPtr mPtr pPtr qPtr thetaPtr phiPtr u1Ptr ldu1Ptr u2Ptr ldu2Ptr v1tPtr ldv1tPtr v2tPtr ldv2tPtr b11dPtr b11ePtr b12dPtr b12ePtr b21dPtr b21ePtr b22dPtr b22ePtr rworkPtr lrworkPtr infoPtr
      liftIO $ pure (,,,,,,,,)
         <*> Call.freezeArray b11d
         <*> Call.freezeArray b11e
         <*> Call.freezeArray b12d
         <*> Call.freezeArray b12e
         <*> Call.freezeArray b21d
         <*> Call.freezeArray b21e
         <*> Call.freezeArray b22d
         <*> Call.freezeArray b22e
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cbdsqr.f>
bdsqr ::
   Char {- ^ uplo -} ->
   Int {- ^ nru -} ->
   IOArray ZeroInt Float {- ^ d -} ->
   IOArray ZeroInt Float {- ^ e -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ vt -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ u -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ c -} ->
   IO (Int)
bdsqr uplo nru d e vt u c = do
   let dDim0 = Call.sizes1 $ MutArray.shape d
   let eDim0 = Call.sizes1 $ MutArray.shape e
   let (vtDim0,vtDim1) = Call.sizes2 $ MutArray.shape vt
   let (uDim0,uDim1) = Call.sizes2 $ MutArray.shape u
   let (cDim0,cDim1) = Call.sizes2 $ MutArray.shape c
   let n = dDim0
   let ncvt = vtDim0
   let ldvt = vtDim1
   let ldu = uDim1
   let ncc = cDim0
   let ldc = cDim1
   Call.assert "bdsqr: n-1 == eDim0" (n-1 == eDim0)
   Call.assert "bdsqr: n == uDim0" (n == uDim0)
   rwork <- Call.newArray1 (4*n)
   evalContT $ do
      uploPtr <- Call.char uplo
      nPtr <- Call.cint n
      ncvtPtr <- Call.cint ncvt
      nruPtr <- Call.cint nru
      nccPtr <- Call.cint ncc
      dPtr <- Call.ioarray d
      ePtr <- Call.ioarray e
      vtPtr <- Call.ioarray vt
      ldvtPtr <- Call.cint ldvt
      uPtr <- Call.ioarray u
      lduPtr <- Call.cint ldu
      cPtr <- Call.ioarray c
      ldcPtr <- Call.cint ldc
      rworkPtr <- Call.ioarray rwork
      infoPtr <- Call.alloca
      liftIO $ FFI.bdsqr uploPtr nPtr ncvtPtr nruPtr nccPtr dPtr ePtr vtPtr ldvtPtr uPtr lduPtr cPtr ldcPtr rworkPtr infoPtr
      liftIO $ fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgbbrd.f>
gbbrd ::
   Char {- ^ vect -} ->
   Int {- ^ m -} ->
   Int {- ^ kl -} ->
   Int {- ^ ku -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ ab -} ->
   Int {- ^ ldq -} ->
   Int {- ^ ldpt -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ c -} ->
   IO (Array ZeroInt Float, Array ZeroInt Float, Array (ZeroInt,ZeroInt) (Complex Float), Array (ZeroInt,ZeroInt) (Complex Float), Int)
gbbrd vect m kl ku ab ldq ldpt c = do
   let (abDim0,abDim1) = Call.sizes2 $ MutArray.shape ab
   let (cDim0,cDim1) = Call.sizes2 $ MutArray.shape c
   let n = abDim0
   let ldab = abDim1
   let ncc = cDim0
   let ldc = cDim1
   d <- Call.newArray1 (minimum[m,n])
   e <- Call.newArray1 (minimum[m,n]-1)
   q <- Call.newArray2 m ldq
   pt <- Call.newArray2 n ldpt
   work <- Call.newArray1 (maximum[m,n])
   rwork <- Call.newArray1 (maximum[m,n])
   evalContT $ do
      vectPtr <- Call.char vect
      mPtr <- Call.cint m
      nPtr <- Call.cint n
      nccPtr <- Call.cint ncc
      klPtr <- Call.cint kl
      kuPtr <- Call.cint ku
      abPtr <- Call.ioarray ab
      ldabPtr <- Call.cint ldab
      dPtr <- Call.ioarray d
      ePtr <- Call.ioarray e
      qPtr <- Call.ioarray q
      ldqPtr <- Call.cint ldq
      ptPtr <- Call.ioarray pt
      ldptPtr <- Call.cint ldpt
      cPtr <- Call.ioarray c
      ldcPtr <- Call.cint ldc
      workPtr <- Call.ioarray work
      rworkPtr <- Call.ioarray rwork
      infoPtr <- Call.alloca
      liftIO $ FFI.gbbrd vectPtr mPtr nPtr nccPtr klPtr kuPtr abPtr ldabPtr dPtr ePtr qPtr ldqPtr ptPtr ldptPtr cPtr ldcPtr workPtr rworkPtr infoPtr
      liftIO $ pure (,,,,)
         <*> Call.freezeArray d
         <*> Call.freezeArray e
         <*> Call.freezeArray q
         <*> Call.freezeArray pt
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgbcon.f>
gbcon ::
   Char {- ^ norm -} ->
   Int {- ^ kl -} ->
   Int {- ^ ku -} ->
   Array (ZeroInt,ZeroInt) (Complex Float) {- ^ ab -} ->
   Array ZeroInt CInt {- ^ ipiv -} ->
   Float {- ^ anorm -} ->
   IO (Float, Int)
gbcon norm kl ku ab ipiv anorm = do
   let (abDim0,abDim1) = Call.sizes2 $ Array.shape ab
   let ipivDim0 = Call.sizes1 $ Array.shape ipiv
   let n = abDim0
   let ldab = abDim1
   Call.assert "gbcon: n == ipivDim0" (n == ipivDim0)
   work <- Call.newArray1 (2*n)
   rwork <- Call.newArray1 n
   evalContT $ do
      normPtr <- Call.char norm
      nPtr <- Call.cint n
      klPtr <- Call.cint kl
      kuPtr <- Call.cint ku
      abPtr <- Call.array ab
      ldabPtr <- Call.cint ldab
      ipivPtr <- Call.array ipiv
      anormPtr <- Call.float anorm
      rcondPtr <- Call.alloca
      workPtr <- Call.ioarray work
      rworkPtr <- Call.ioarray rwork
      infoPtr <- Call.alloca
      liftIO $ FFI.gbcon normPtr nPtr klPtr kuPtr abPtr ldabPtr ipivPtr anormPtr rcondPtr workPtr rworkPtr infoPtr
      liftIO $ pure (,)
         <*> peek rcondPtr
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgbequ.f>
gbequ ::
   Int {- ^ m -} ->
   Int {- ^ kl -} ->
   Int {- ^ ku -} ->
   Array (ZeroInt,ZeroInt) (Complex Float) {- ^ ab -} ->
   IO (Array ZeroInt Float, Array ZeroInt Float, Float, Float, Float, Int)
gbequ m kl ku ab = do
   let (abDim0,abDim1) = Call.sizes2 $ Array.shape ab
   let n = abDim0
   let ldab = abDim1
   r <- Call.newArray1 m
   c <- Call.newArray1 n
   evalContT $ do
      mPtr <- Call.cint m
      nPtr <- Call.cint n
      klPtr <- Call.cint kl
      kuPtr <- Call.cint ku
      abPtr <- Call.array ab
      ldabPtr <- Call.cint ldab
      rPtr <- Call.ioarray r
      cPtr <- Call.ioarray c
      rowcndPtr <- Call.alloca
      colcndPtr <- Call.alloca
      amaxPtr <- Call.alloca
      infoPtr <- Call.alloca
      liftIO $ FFI.gbequ mPtr nPtr klPtr kuPtr abPtr ldabPtr rPtr cPtr rowcndPtr colcndPtr amaxPtr infoPtr
      liftIO $ pure (,,,,,)
         <*> Call.freezeArray r
         <*> Call.freezeArray c
         <*> peek rowcndPtr
         <*> peek colcndPtr
         <*> peek amaxPtr
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgbequb.f>
gbequb ::
   Int {- ^ m -} ->
   Int {- ^ kl -} ->
   Int {- ^ ku -} ->
   Array (ZeroInt,ZeroInt) (Complex Float) {- ^ ab -} ->
   IO (Array ZeroInt Float, Array ZeroInt Float, Float, Float, Float, Int)
gbequb m kl ku ab = do
   let (abDim0,abDim1) = Call.sizes2 $ Array.shape ab
   let n = abDim0
   let ldab = abDim1
   r <- Call.newArray1 m
   c <- Call.newArray1 n
   evalContT $ do
      mPtr <- Call.cint m
      nPtr <- Call.cint n
      klPtr <- Call.cint kl
      kuPtr <- Call.cint ku
      abPtr <- Call.array ab
      ldabPtr <- Call.cint ldab
      rPtr <- Call.ioarray r
      cPtr <- Call.ioarray c
      rowcndPtr <- Call.alloca
      colcndPtr <- Call.alloca
      amaxPtr <- Call.alloca
      infoPtr <- Call.alloca
      liftIO $ FFI.gbequb mPtr nPtr klPtr kuPtr abPtr ldabPtr rPtr cPtr rowcndPtr colcndPtr amaxPtr infoPtr
      liftIO $ pure (,,,,,)
         <*> Call.freezeArray r
         <*> Call.freezeArray c
         <*> peek rowcndPtr
         <*> peek colcndPtr
         <*> peek amaxPtr
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgbrfs.f>
gbrfs ::
   Char {- ^ trans -} ->
   Int {- ^ kl -} ->
   Int {- ^ ku -} ->
   Array (ZeroInt,ZeroInt) (Complex Float) {- ^ ab -} ->
   Array (ZeroInt,ZeroInt) (Complex Float) {- ^ afb -} ->
   Array ZeroInt CInt {- ^ ipiv -} ->
   Array (ZeroInt,ZeroInt) (Complex Float) {- ^ b -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ x -} ->
   IO (Array ZeroInt Float, Array ZeroInt Float, Int)
gbrfs trans kl ku ab afb ipiv b x = do
   let (abDim0,abDim1) = Call.sizes2 $ Array.shape ab
   let (afbDim0,afbDim1) = Call.sizes2 $ Array.shape afb
   let ipivDim0 = Call.sizes1 $ Array.shape ipiv
   let (bDim0,bDim1) = Call.sizes2 $ Array.shape b
   let (xDim0,xDim1) = Call.sizes2 $ MutArray.shape x
   let n = abDim0
   let ldab = abDim1
   let ldafb = afbDim1
   let nrhs = bDim0
   let ldb = bDim1
   let ldx = xDim1
   Call.assert "gbrfs: n == afbDim0" (n == afbDim0)
   Call.assert "gbrfs: n == ipivDim0" (n == ipivDim0)
   Call.assert "gbrfs: nrhs == xDim0" (nrhs == xDim0)
   ferr <- Call.newArray1 nrhs
   berr <- Call.newArray1 nrhs
   work <- Call.newArray1 (2*n)
   rwork <- Call.newArray1 n
   evalContT $ do
      transPtr <- Call.char trans
      nPtr <- Call.cint n
      klPtr <- Call.cint kl
      kuPtr <- Call.cint ku
      nrhsPtr <- Call.cint nrhs
      abPtr <- Call.array ab
      ldabPtr <- Call.cint ldab
      afbPtr <- Call.array afb
      ldafbPtr <- Call.cint ldafb
      ipivPtr <- Call.array ipiv
      bPtr <- Call.array b
      ldbPtr <- Call.cint ldb
      xPtr <- Call.ioarray x
      ldxPtr <- Call.cint ldx
      ferrPtr <- Call.ioarray ferr
      berrPtr <- Call.ioarray berr
      workPtr <- Call.ioarray work
      rworkPtr <- Call.ioarray rwork
      infoPtr <- Call.alloca
      liftIO $ FFI.gbrfs transPtr nPtr klPtr kuPtr nrhsPtr abPtr ldabPtr afbPtr ldafbPtr ipivPtr bPtr ldbPtr xPtr ldxPtr ferrPtr berrPtr workPtr rworkPtr infoPtr
      liftIO $ pure (,,)
         <*> Call.freezeArray ferr
         <*> Call.freezeArray berr
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgbsv.f>
gbsv ::
   Int {- ^ kl -} ->
   Int {- ^ ku -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ ab -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ b -} ->
   IO (Array ZeroInt CInt, Int)
gbsv kl ku ab b = do
   let (abDim0,abDim1) = Call.sizes2 $ MutArray.shape ab
   let (bDim0,bDim1) = Call.sizes2 $ MutArray.shape b
   let n = abDim0
   let ldab = abDim1
   let nrhs = bDim0
   let ldb = bDim1
   ipiv <- Call.newArray1 n
   evalContT $ do
      nPtr <- Call.cint n
      klPtr <- Call.cint kl
      kuPtr <- Call.cint ku
      nrhsPtr <- Call.cint nrhs
      abPtr <- Call.ioarray ab
      ldabPtr <- Call.cint ldab
      ipivPtr <- Call.ioarray ipiv
      bPtr <- Call.ioarray b
      ldbPtr <- Call.cint ldb
      infoPtr <- Call.alloca
      liftIO $ FFI.gbsv nPtr klPtr kuPtr nrhsPtr abPtr ldabPtr ipivPtr bPtr ldbPtr infoPtr
      liftIO $ pure (,)
         <*> Call.freezeArray ipiv
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgbsvx.f>
gbsvx ::
   Char {- ^ fact -} ->
   Char {- ^ trans -} ->
   Int {- ^ kl -} ->
   Int {- ^ ku -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ ab -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ afb -} ->
   IOArray ZeroInt CInt {- ^ ipiv -} ->
   Char {- ^ equed -} ->
   IOArray ZeroInt Float {- ^ r -} ->
   IOArray ZeroInt Float {- ^ c -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ b -} ->
   Int {- ^ ldx -} ->
   IO (Char, Array (ZeroInt,ZeroInt) (Complex Float), Float, Array ZeroInt Float, Array ZeroInt Float, Int)
gbsvx fact trans kl ku ab afb ipiv equed r c b ldx = do
   let (abDim0,abDim1) = Call.sizes2 $ MutArray.shape ab
   let (afbDim0,afbDim1) = Call.sizes2 $ MutArray.shape afb
   let ipivDim0 = Call.sizes1 $ MutArray.shape ipiv
   let rDim0 = Call.sizes1 $ MutArray.shape r
   let cDim0 = Call.sizes1 $ MutArray.shape c
   let (bDim0,bDim1) = Call.sizes2 $ MutArray.shape b
   let n = abDim0
   let ldab = abDim1
   let ldafb = afbDim1
   let nrhs = bDim0
   let ldb = bDim1
   Call.assert "gbsvx: n == afbDim0" (n == afbDim0)
   Call.assert "gbsvx: n == ipivDim0" (n == ipivDim0)
   Call.assert "gbsvx: n == rDim0" (n == rDim0)
   Call.assert "gbsvx: n == cDim0" (n == cDim0)
   x <- Call.newArray2 nrhs ldx
   ferr <- Call.newArray1 nrhs
   berr <- Call.newArray1 nrhs
   work <- Call.newArray1 (2*n)
   rwork <- Call.newArray1 n
   evalContT $ do
      factPtr <- Call.char fact
      transPtr <- Call.char trans
      nPtr <- Call.cint n
      klPtr <- Call.cint kl
      kuPtr <- Call.cint ku
      nrhsPtr <- Call.cint nrhs
      abPtr <- Call.ioarray ab
      ldabPtr <- Call.cint ldab
      afbPtr <- Call.ioarray afb
      ldafbPtr <- Call.cint ldafb
      ipivPtr <- Call.ioarray ipiv
      equedPtr <- Call.char equed
      rPtr <- Call.ioarray r
      cPtr <- Call.ioarray c
      bPtr <- Call.ioarray b
      ldbPtr <- Call.cint ldb
      xPtr <- Call.ioarray x
      ldxPtr <- Call.cint ldx
      rcondPtr <- Call.alloca
      ferrPtr <- Call.ioarray ferr
      berrPtr <- Call.ioarray berr
      workPtr <- Call.ioarray work
      rworkPtr <- Call.ioarray rwork
      infoPtr <- Call.alloca
      liftIO $ FFI.gbsvx factPtr transPtr nPtr klPtr kuPtr nrhsPtr abPtr ldabPtr afbPtr ldafbPtr ipivPtr equedPtr rPtr cPtr bPtr ldbPtr xPtr ldxPtr rcondPtr ferrPtr berrPtr workPtr rworkPtr infoPtr
      liftIO $ pure (,,,,,)
         <*> fmap castCCharToChar (peek equedPtr)
         <*> Call.freezeArray x
         <*> peek rcondPtr
         <*> Call.freezeArray ferr
         <*> Call.freezeArray berr
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgbtf2.f>
gbtf2 ::
   Int {- ^ m -} ->
   Int {- ^ kl -} ->
   Int {- ^ ku -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ ab -} ->
   IO (Array ZeroInt CInt, Int)
gbtf2 m kl ku ab = do
   let (abDim0,abDim1) = Call.sizes2 $ MutArray.shape ab
   let n = abDim0
   let ldab = abDim1
   ipiv <- Call.newArray1 (minimum[m,n])
   evalContT $ do
      mPtr <- Call.cint m
      nPtr <- Call.cint n
      klPtr <- Call.cint kl
      kuPtr <- Call.cint ku
      abPtr <- Call.ioarray ab
      ldabPtr <- Call.cint ldab
      ipivPtr <- Call.ioarray ipiv
      infoPtr <- Call.alloca
      liftIO $ FFI.gbtf2 mPtr nPtr klPtr kuPtr abPtr ldabPtr ipivPtr infoPtr
      liftIO $ pure (,)
         <*> Call.freezeArray ipiv
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgbtrf.f>
gbtrf ::
   Int {- ^ m -} ->
   Int {- ^ kl -} ->
   Int {- ^ ku -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ ab -} ->
   IO (Array ZeroInt CInt, Int)
gbtrf m kl ku ab = do
   let (abDim0,abDim1) = Call.sizes2 $ MutArray.shape ab
   let n = abDim0
   let ldab = abDim1
   ipiv <- Call.newArray1 (minimum[m,n])
   evalContT $ do
      mPtr <- Call.cint m
      nPtr <- Call.cint n
      klPtr <- Call.cint kl
      kuPtr <- Call.cint ku
      abPtr <- Call.ioarray ab
      ldabPtr <- Call.cint ldab
      ipivPtr <- Call.ioarray ipiv
      infoPtr <- Call.alloca
      liftIO $ FFI.gbtrf mPtr nPtr klPtr kuPtr abPtr ldabPtr ipivPtr infoPtr
      liftIO $ pure (,)
         <*> Call.freezeArray ipiv
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgbtrs.f>
gbtrs ::
   Char {- ^ trans -} ->
   Int {- ^ kl -} ->
   Int {- ^ ku -} ->
   Array (ZeroInt,ZeroInt) (Complex Float) {- ^ ab -} ->
   Array ZeroInt CInt {- ^ ipiv -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ b -} ->
   IO (Int)
gbtrs trans kl ku ab ipiv b = do
   let (abDim0,abDim1) = Call.sizes2 $ Array.shape ab
   let ipivDim0 = Call.sizes1 $ Array.shape ipiv
   let (bDim0,bDim1) = Call.sizes2 $ MutArray.shape b
   let n = abDim0
   let ldab = abDim1
   let nrhs = bDim0
   let ldb = bDim1
   Call.assert "gbtrs: n == ipivDim0" (n == ipivDim0)
   evalContT $ do
      transPtr <- Call.char trans
      nPtr <- Call.cint n
      klPtr <- Call.cint kl
      kuPtr <- Call.cint ku
      nrhsPtr <- Call.cint nrhs
      abPtr <- Call.array ab
      ldabPtr <- Call.cint ldab
      ipivPtr <- Call.array ipiv
      bPtr <- Call.ioarray b
      ldbPtr <- Call.cint ldb
      infoPtr <- Call.alloca
      liftIO $ FFI.gbtrs transPtr nPtr klPtr kuPtr nrhsPtr abPtr ldabPtr ipivPtr bPtr ldbPtr infoPtr
      liftIO $ fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgebak.f>
gebak ::
   Char {- ^ job -} ->
   Char {- ^ side -} ->
   Int {- ^ ilo -} ->
   Int {- ^ ihi -} ->
   Array ZeroInt Float {- ^ scale -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ v -} ->
   IO (Int)
gebak job side ilo ihi scale v = do
   let scaleDim0 = Call.sizes1 $ Array.shape scale
   let (vDim0,vDim1) = Call.sizes2 $ MutArray.shape v
   let n = scaleDim0
   let m = vDim0
   let ldv = vDim1
   evalContT $ do
      jobPtr <- Call.char job
      sidePtr <- Call.char side
      nPtr <- Call.cint n
      iloPtr <- Call.cint ilo
      ihiPtr <- Call.cint ihi
      scalePtr <- Call.array scale
      mPtr <- Call.cint m
      vPtr <- Call.ioarray v
      ldvPtr <- Call.cint ldv
      infoPtr <- Call.alloca
      liftIO $ FFI.gebak jobPtr sidePtr nPtr iloPtr ihiPtr scalePtr mPtr vPtr ldvPtr infoPtr
      liftIO $ fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgebal.f>
gebal ::
   Char {- ^ job -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   IO (Int, Int, Array ZeroInt Float, Int)
gebal job a = do
   let (aDim0,aDim1) = Call.sizes2 $ MutArray.shape a
   let n = aDim0
   let lda = aDim1
   scale <- Call.newArray1 n
   evalContT $ do
      jobPtr <- Call.char job
      nPtr <- Call.cint n
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      iloPtr <- Call.alloca
      ihiPtr <- Call.alloca
      scalePtr <- Call.ioarray scale
      infoPtr <- Call.alloca
      liftIO $ FFI.gebal jobPtr nPtr aPtr ldaPtr iloPtr ihiPtr scalePtr infoPtr
      liftIO $ pure (,,,)
         <*> fmap fromIntegral (peek iloPtr)
         <*> fmap fromIntegral (peek ihiPtr)
         <*> Call.freezeArray scale
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgebd2.f>
gebd2 ::
   Int {- ^ m -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   IO (Array ZeroInt Float, Array ZeroInt Float, Array ZeroInt (Complex Float), Array ZeroInt (Complex Float), Int)
gebd2 m a = do
   let (aDim0,aDim1) = Call.sizes2 $ MutArray.shape a
   let n = aDim0
   let lda = aDim1
   d <- Call.newArray1 (minimum[m,n])
   e <- Call.newArray1 (minimum[m,n]-1)
   tauq <- Call.newArray1 (minimum[m,n])
   taup <- Call.newArray1 (minimum[m,n])
   work <- Call.newArray1 (maximum[m,n])
   evalContT $ do
      mPtr <- Call.cint m
      nPtr <- Call.cint n
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      dPtr <- Call.ioarray d
      ePtr <- Call.ioarray e
      tauqPtr <- Call.ioarray tauq
      taupPtr <- Call.ioarray taup
      workPtr <- Call.ioarray work
      infoPtr <- Call.alloca
      liftIO $ FFI.gebd2 mPtr nPtr aPtr ldaPtr dPtr ePtr tauqPtr taupPtr workPtr infoPtr
      liftIO $ pure (,,,,)
         <*> Call.freezeArray d
         <*> Call.freezeArray e
         <*> Call.freezeArray tauq
         <*> Call.freezeArray taup
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgebrd.f>
gebrd ::
   Int {- ^ m -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   Int {- ^ lwork -} ->
   IO (Array ZeroInt Float, Array ZeroInt Float, Array ZeroInt (Complex Float), Array ZeroInt (Complex Float), Int)
gebrd m a lwork = do
   let (aDim0,aDim1) = Call.sizes2 $ MutArray.shape a
   let n = aDim0
   let lda = aDim1
   d <- Call.newArray1 (minimum[m,n])
   e <- Call.newArray1 (minimum[m,n]-1)
   tauq <- Call.newArray1 (minimum[m,n])
   taup <- Call.newArray1 (minimum[m,n])
   work <- Call.newArray1 (maximum[1,lwork])
   evalContT $ do
      mPtr <- Call.cint m
      nPtr <- Call.cint n
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      dPtr <- Call.ioarray d
      ePtr <- Call.ioarray e
      tauqPtr <- Call.ioarray tauq
      taupPtr <- Call.ioarray taup
      workPtr <- Call.ioarray work
      lworkPtr <- Call.cint lwork
      infoPtr <- Call.alloca
      liftIO $ FFI.gebrd mPtr nPtr aPtr ldaPtr dPtr ePtr tauqPtr taupPtr workPtr lworkPtr infoPtr
      liftIO $ pure (,,,,)
         <*> Call.freezeArray d
         <*> Call.freezeArray e
         <*> Call.freezeArray tauq
         <*> Call.freezeArray taup
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgecon.f>
gecon ::
   Char {- ^ norm -} ->
   Array (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   Float {- ^ anorm -} ->
   IO (Float, Int)
gecon norm a anorm = do
   let (aDim0,aDim1) = Call.sizes2 $ Array.shape a
   let n = aDim0
   let lda = aDim1
   work <- Call.newArray1 (2*n)
   rwork <- Call.newArray1 (2*n)
   evalContT $ do
      normPtr <- Call.char norm
      nPtr <- Call.cint n
      aPtr <- Call.array a
      ldaPtr <- Call.cint lda
      anormPtr <- Call.float anorm
      rcondPtr <- Call.alloca
      workPtr <- Call.ioarray work
      rworkPtr <- Call.ioarray rwork
      infoPtr <- Call.alloca
      liftIO $ FFI.gecon normPtr nPtr aPtr ldaPtr anormPtr rcondPtr workPtr rworkPtr infoPtr
      liftIO $ pure (,)
         <*> peek rcondPtr
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgeequ.f>
geequ ::
   Int {- ^ m -} ->
   Array (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   IO (Array ZeroInt Float, Array ZeroInt Float, Float, Float, Float, Int)
geequ m a = do
   let (aDim0,aDim1) = Call.sizes2 $ Array.shape a
   let n = aDim0
   let lda = aDim1
   r <- Call.newArray1 m
   c <- Call.newArray1 n
   evalContT $ do
      mPtr <- Call.cint m
      nPtr <- Call.cint n
      aPtr <- Call.array a
      ldaPtr <- Call.cint lda
      rPtr <- Call.ioarray r
      cPtr <- Call.ioarray c
      rowcndPtr <- Call.alloca
      colcndPtr <- Call.alloca
      amaxPtr <- Call.alloca
      infoPtr <- Call.alloca
      liftIO $ FFI.geequ mPtr nPtr aPtr ldaPtr rPtr cPtr rowcndPtr colcndPtr amaxPtr infoPtr
      liftIO $ pure (,,,,,)
         <*> Call.freezeArray r
         <*> Call.freezeArray c
         <*> peek rowcndPtr
         <*> peek colcndPtr
         <*> peek amaxPtr
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgeequb.f>
geequb ::
   Int {- ^ m -} ->
   Array (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   IO (Array ZeroInt Float, Array ZeroInt Float, Float, Float, Float, Int)
geequb m a = do
   let (aDim0,aDim1) = Call.sizes2 $ Array.shape a
   let n = aDim0
   let lda = aDim1
   r <- Call.newArray1 m
   c <- Call.newArray1 n
   evalContT $ do
      mPtr <- Call.cint m
      nPtr <- Call.cint n
      aPtr <- Call.array a
      ldaPtr <- Call.cint lda
      rPtr <- Call.ioarray r
      cPtr <- Call.ioarray c
      rowcndPtr <- Call.alloca
      colcndPtr <- Call.alloca
      amaxPtr <- Call.alloca
      infoPtr <- Call.alloca
      liftIO $ FFI.geequb mPtr nPtr aPtr ldaPtr rPtr cPtr rowcndPtr colcndPtr amaxPtr infoPtr
      liftIO $ pure (,,,,,)
         <*> Call.freezeArray r
         <*> Call.freezeArray c
         <*> peek rowcndPtr
         <*> peek colcndPtr
         <*> peek amaxPtr
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgees.f>
gees ::
   Char {- ^ jobvs -} ->
   Char {- ^ sort -} ->
   FunPtr (Ptr (Complex Float) -> IO Bool) {- ^ select -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   Int {- ^ ldvs -} ->
   Int {- ^ lwork -} ->
   IO (Int, Array ZeroInt (Complex Float), Array (ZeroInt,ZeroInt) (Complex Float), Int)
gees jobvs sort select a ldvs lwork = do
   let (aDim0,aDim1) = Call.sizes2 $ MutArray.shape a
   let n = aDim0
   let lda = aDim1
   w <- Call.newArray1 n
   vs <- Call.newArray2 n ldvs
   work <- Call.newArray1 (maximum[1,lwork])
   rwork <- Call.newArray1 n
   bwork <- Call.newArray1 n
   evalContT $ do
      jobvsPtr <- Call.char jobvs
      sortPtr <- Call.char sort
      selectPtr <- pure select
      nPtr <- Call.cint n
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      sdimPtr <- Call.alloca
      wPtr <- Call.ioarray w
      vsPtr <- Call.ioarray vs
      ldvsPtr <- Call.cint ldvs
      workPtr <- Call.ioarray work
      lworkPtr <- Call.cint lwork
      rworkPtr <- Call.ioarray rwork
      bworkPtr <- Call.ioarray bwork
      infoPtr <- Call.alloca
      liftIO $ FFI.gees jobvsPtr sortPtr selectPtr nPtr aPtr ldaPtr sdimPtr wPtr vsPtr ldvsPtr workPtr lworkPtr rworkPtr bworkPtr infoPtr
      liftIO $ pure (,,,)
         <*> fmap fromIntegral (peek sdimPtr)
         <*> Call.freezeArray w
         <*> Call.freezeArray vs
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgeesx.f>
geesx ::
   Char {- ^ jobvs -} ->
   Char {- ^ sort -} ->
   FunPtr (Ptr (Complex Float) -> IO Bool) {- ^ select -} ->
   Char {- ^ sense -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   Int {- ^ ldvs -} ->
   Int {- ^ lwork -} ->
   IO (Int, Array ZeroInt (Complex Float), Array (ZeroInt,ZeroInt) (Complex Float), Float, Float, Int)
geesx jobvs sort select sense a ldvs lwork = do
   let (aDim0,aDim1) = Call.sizes2 $ MutArray.shape a
   let n = aDim0
   let lda = aDim1
   w <- Call.newArray1 n
   vs <- Call.newArray2 n ldvs
   work <- Call.newArray1 (maximum[1,lwork])
   rwork <- Call.newArray1 n
   bwork <- Call.newArray1 n
   evalContT $ do
      jobvsPtr <- Call.char jobvs
      sortPtr <- Call.char sort
      selectPtr <- pure select
      sensePtr <- Call.char sense
      nPtr <- Call.cint n
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      sdimPtr <- Call.alloca
      wPtr <- Call.ioarray w
      vsPtr <- Call.ioarray vs
      ldvsPtr <- Call.cint ldvs
      rcondePtr <- Call.alloca
      rcondvPtr <- Call.alloca
      workPtr <- Call.ioarray work
      lworkPtr <- Call.cint lwork
      rworkPtr <- Call.ioarray rwork
      bworkPtr <- Call.ioarray bwork
      infoPtr <- Call.alloca
      liftIO $ FFI.geesx jobvsPtr sortPtr selectPtr sensePtr nPtr aPtr ldaPtr sdimPtr wPtr vsPtr ldvsPtr rcondePtr rcondvPtr workPtr lworkPtr rworkPtr bworkPtr infoPtr
      liftIO $ pure (,,,,,)
         <*> fmap fromIntegral (peek sdimPtr)
         <*> Call.freezeArray w
         <*> Call.freezeArray vs
         <*> peek rcondePtr
         <*> peek rcondvPtr
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgeev.f>
geev ::
   Char {- ^ jobvl -} ->
   Char {- ^ jobvr -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   Int {- ^ ldvl -} ->
   Int {- ^ ldvr -} ->
   Int {- ^ lwork -} ->
   IO (Array ZeroInt (Complex Float), Array (ZeroInt,ZeroInt) (Complex Float), Array (ZeroInt,ZeroInt) (Complex Float), Int)
geev jobvl jobvr a ldvl ldvr lwork = do
   let (aDim0,aDim1) = Call.sizes2 $ MutArray.shape a
   let n = aDim0
   let lda = aDim1
   w <- Call.newArray1 n
   vl <- Call.newArray2 n ldvl
   vr <- Call.newArray2 n ldvr
   work <- Call.newArray1 (maximum[1,lwork])
   rwork <- Call.newArray1 (2*n)
   evalContT $ do
      jobvlPtr <- Call.char jobvl
      jobvrPtr <- Call.char jobvr
      nPtr <- Call.cint n
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      wPtr <- Call.ioarray w
      vlPtr <- Call.ioarray vl
      ldvlPtr <- Call.cint ldvl
      vrPtr <- Call.ioarray vr
      ldvrPtr <- Call.cint ldvr
      workPtr <- Call.ioarray work
      lworkPtr <- Call.cint lwork
      rworkPtr <- Call.ioarray rwork
      infoPtr <- Call.alloca
      liftIO $ FFI.geev jobvlPtr jobvrPtr nPtr aPtr ldaPtr wPtr vlPtr ldvlPtr vrPtr ldvrPtr workPtr lworkPtr rworkPtr infoPtr
      liftIO $ pure (,,,)
         <*> Call.freezeArray w
         <*> Call.freezeArray vl
         <*> Call.freezeArray vr
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgeevx.f>
geevx ::
   Char {- ^ balanc -} ->
   Char {- ^ jobvl -} ->
   Char {- ^ jobvr -} ->
   Char {- ^ sense -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   Int {- ^ ldvl -} ->
   Int {- ^ ldvr -} ->
   Int {- ^ lwork -} ->
   IO (Array ZeroInt (Complex Float), Array (ZeroInt,ZeroInt) (Complex Float), Array (ZeroInt,ZeroInt) (Complex Float), Int, Int, Array ZeroInt Float, Float, Array ZeroInt Float, Array ZeroInt Float, Int)
geevx balanc jobvl jobvr sense a ldvl ldvr lwork = do
   let (aDim0,aDim1) = Call.sizes2 $ MutArray.shape a
   let n = aDim0
   let lda = aDim1
   w <- Call.newArray1 n
   vl <- Call.newArray2 n ldvl
   vr <- Call.newArray2 n ldvr
   scale <- Call.newArray1 n
   rconde <- Call.newArray1 n
   rcondv <- Call.newArray1 n
   work <- Call.newArray1 (maximum[1,lwork])
   rwork <- Call.newArray1 (2*n)
   evalContT $ do
      balancPtr <- Call.char balanc
      jobvlPtr <- Call.char jobvl
      jobvrPtr <- Call.char jobvr
      sensePtr <- Call.char sense
      nPtr <- Call.cint n
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      wPtr <- Call.ioarray w
      vlPtr <- Call.ioarray vl
      ldvlPtr <- Call.cint ldvl
      vrPtr <- Call.ioarray vr
      ldvrPtr <- Call.cint ldvr
      iloPtr <- Call.alloca
      ihiPtr <- Call.alloca
      scalePtr <- Call.ioarray scale
      abnrmPtr <- Call.alloca
      rcondePtr <- Call.ioarray rconde
      rcondvPtr <- Call.ioarray rcondv
      workPtr <- Call.ioarray work
      lworkPtr <- Call.cint lwork
      rworkPtr <- Call.ioarray rwork
      infoPtr <- Call.alloca
      liftIO $ FFI.geevx balancPtr jobvlPtr jobvrPtr sensePtr nPtr aPtr ldaPtr wPtr vlPtr ldvlPtr vrPtr ldvrPtr iloPtr ihiPtr scalePtr abnrmPtr rcondePtr rcondvPtr workPtr lworkPtr rworkPtr infoPtr
      liftIO $ pure (,,,,,,,,,)
         <*> Call.freezeArray w
         <*> Call.freezeArray vl
         <*> Call.freezeArray vr
         <*> fmap fromIntegral (peek iloPtr)
         <*> fmap fromIntegral (peek ihiPtr)
         <*> Call.freezeArray scale
         <*> peek abnrmPtr
         <*> Call.freezeArray rconde
         <*> Call.freezeArray rcondv
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgehd2.f>
gehd2 ::
   Int {- ^ ilo -} ->
   Int {- ^ ihi -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   IO (Array ZeroInt (Complex Float), Int)
gehd2 ilo ihi a = do
   let (aDim0,aDim1) = Call.sizes2 $ MutArray.shape a
   let n = aDim0
   let lda = aDim1
   tau <- Call.newArray1 (n-1)
   work <- Call.newArray1 n
   evalContT $ do
      nPtr <- Call.cint n
      iloPtr <- Call.cint ilo
      ihiPtr <- Call.cint ihi
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      tauPtr <- Call.ioarray tau
      workPtr <- Call.ioarray work
      infoPtr <- Call.alloca
      liftIO $ FFI.gehd2 nPtr iloPtr ihiPtr aPtr ldaPtr tauPtr workPtr infoPtr
      liftIO $ pure (,)
         <*> Call.freezeArray tau
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgehrd.f>
gehrd ::
   Int {- ^ ilo -} ->
   Int {- ^ ihi -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   Int {- ^ lwork -} ->
   IO (Array ZeroInt (Complex Float), Int)
gehrd ilo ihi a lwork = do
   let (aDim0,aDim1) = Call.sizes2 $ MutArray.shape a
   let n = aDim0
   let lda = aDim1
   tau <- Call.newArray1 (n-1)
   work <- Call.newArray1 lwork
   evalContT $ do
      nPtr <- Call.cint n
      iloPtr <- Call.cint ilo
      ihiPtr <- Call.cint ihi
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      tauPtr <- Call.ioarray tau
      workPtr <- Call.ioarray work
      lworkPtr <- Call.cint lwork
      infoPtr <- Call.alloca
      liftIO $ FFI.gehrd nPtr iloPtr ihiPtr aPtr ldaPtr tauPtr workPtr lworkPtr infoPtr
      liftIO $ pure (,)
         <*> Call.freezeArray tau
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgelq2.f>
gelq2 ::
   Int {- ^ m -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   IO (Array ZeroInt (Complex Float), Int)
gelq2 m a = do
   let (aDim0,aDim1) = Call.sizes2 $ MutArray.shape a
   let n = aDim0
   let lda = aDim1
   tau <- Call.newArray1 (minimum[m,n])
   work <- Call.newArray1 m
   evalContT $ do
      mPtr <- Call.cint m
      nPtr <- Call.cint n
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      tauPtr <- Call.ioarray tau
      workPtr <- Call.ioarray work
      infoPtr <- Call.alloca
      liftIO $ FFI.gelq2 mPtr nPtr aPtr ldaPtr tauPtr workPtr infoPtr
      liftIO $ pure (,)
         <*> Call.freezeArray tau
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgelqf.f>
gelqf ::
   Int {- ^ m -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   Int {- ^ lwork -} ->
   IO (Array ZeroInt (Complex Float), Int)
gelqf m a lwork = do
   let (aDim0,aDim1) = Call.sizes2 $ MutArray.shape a
   let n = aDim0
   let lda = aDim1
   tau <- Call.newArray1 (minimum[m,n])
   work <- Call.newArray1 (maximum[1,lwork])
   evalContT $ do
      mPtr <- Call.cint m
      nPtr <- Call.cint n
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      tauPtr <- Call.ioarray tau
      workPtr <- Call.ioarray work
      lworkPtr <- Call.cint lwork
      infoPtr <- Call.alloca
      liftIO $ FFI.gelqf mPtr nPtr aPtr ldaPtr tauPtr workPtr lworkPtr infoPtr
      liftIO $ pure (,)
         <*> Call.freezeArray tau
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgels.f>
gels ::
   Char {- ^ trans -} ->
   Int {- ^ m -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ b -} ->
   Int {- ^ lwork -} ->
   IO (Int)
gels trans m a b lwork = do
   let (aDim0,aDim1) = Call.sizes2 $ MutArray.shape a
   let (bDim0,bDim1) = Call.sizes2 $ MutArray.shape b
   let n = aDim0
   let lda = aDim1
   let nrhs = bDim0
   let ldb = bDim1
   work <- Call.newArray1 (maximum[1,lwork])
   evalContT $ do
      transPtr <- Call.char trans
      mPtr <- Call.cint m
      nPtr <- Call.cint n
      nrhsPtr <- Call.cint nrhs
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      bPtr <- Call.ioarray b
      ldbPtr <- Call.cint ldb
      workPtr <- Call.ioarray work
      lworkPtr <- Call.cint lwork
      infoPtr <- Call.alloca
      liftIO $ FFI.gels transPtr mPtr nPtr nrhsPtr aPtr ldaPtr bPtr ldbPtr workPtr lworkPtr infoPtr
      liftIO $ fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgelsd.f>
gelsd ::
   Int {- ^ m -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ b -} ->
   Float {- ^ rcond -} ->
   Int {- ^ lwork -} ->
   Int {- ^ lrwork -} ->
   Int {- ^ liwork -} ->
   IO (Array ZeroInt Float, Int, Int)
gelsd m a b rcond lwork lrwork liwork = do
   let (aDim0,aDim1) = Call.sizes2 $ MutArray.shape a
   let (bDim0,bDim1) = Call.sizes2 $ MutArray.shape b
   let n = aDim0
   let lda = aDim1
   let nrhs = bDim0
   let ldb = bDim1
   s <- Call.newArray1 (minimum[m,n])
   work <- Call.newArray1 (maximum[1,lwork])
   rwork <- Call.newArray1 (maximum[1,lrwork])
   iwork <- Call.newArray1 (maximum[1,liwork])
   evalContT $ do
      mPtr <- Call.cint m
      nPtr <- Call.cint n
      nrhsPtr <- Call.cint nrhs
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      bPtr <- Call.ioarray b
      ldbPtr <- Call.cint ldb
      sPtr <- Call.ioarray s
      rcondPtr <- Call.float rcond
      rankPtr <- Call.alloca
      workPtr <- Call.ioarray work
      lworkPtr <- Call.cint lwork
      rworkPtr <- Call.ioarray rwork
      iworkPtr <- Call.ioarray iwork
      infoPtr <- Call.alloca
      liftIO $ FFI.gelsd mPtr nPtr nrhsPtr aPtr ldaPtr bPtr ldbPtr sPtr rcondPtr rankPtr workPtr lworkPtr rworkPtr iworkPtr infoPtr
      liftIO $ pure (,,)
         <*> Call.freezeArray s
         <*> fmap fromIntegral (peek rankPtr)
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgelss.f>
gelss ::
   Int {- ^ m -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ b -} ->
   Float {- ^ rcond -} ->
   Int {- ^ lwork -} ->
   IO (Array ZeroInt Float, Int, Int)
gelss m a b rcond lwork = do
   let (aDim0,aDim1) = Call.sizes2 $ MutArray.shape a
   let (bDim0,bDim1) = Call.sizes2 $ MutArray.shape b
   let n = aDim0
   let lda = aDim1
   let nrhs = bDim0
   let ldb = bDim1
   s <- Call.newArray1 (minimum[m,n])
   work <- Call.newArray1 (maximum[1,lwork])
   rwork <- Call.newArray1 (5*minimum[m,n])
   evalContT $ do
      mPtr <- Call.cint m
      nPtr <- Call.cint n
      nrhsPtr <- Call.cint nrhs
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      bPtr <- Call.ioarray b
      ldbPtr <- Call.cint ldb
      sPtr <- Call.ioarray s
      rcondPtr <- Call.float rcond
      rankPtr <- Call.alloca
      workPtr <- Call.ioarray work
      lworkPtr <- Call.cint lwork
      rworkPtr <- Call.ioarray rwork
      infoPtr <- Call.alloca
      liftIO $ FFI.gelss mPtr nPtr nrhsPtr aPtr ldaPtr bPtr ldbPtr sPtr rcondPtr rankPtr workPtr lworkPtr rworkPtr infoPtr
      liftIO $ pure (,,)
         <*> Call.freezeArray s
         <*> fmap fromIntegral (peek rankPtr)
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgelsy.f>
gelsy ::
   Int {- ^ m -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ b -} ->
   IOArray ZeroInt CInt {- ^ jpvt -} ->
   Float {- ^ rcond -} ->
   Int {- ^ lwork -} ->
   IO (Int, Int)
gelsy m a b jpvt rcond lwork = do
   let (aDim0,aDim1) = Call.sizes2 $ MutArray.shape a
   let (bDim0,bDim1) = Call.sizes2 $ MutArray.shape b
   let jpvtDim0 = Call.sizes1 $ MutArray.shape jpvt
   let n = aDim0
   let lda = aDim1
   let nrhs = bDim0
   let ldb = bDim1
   Call.assert "gelsy: n == jpvtDim0" (n == jpvtDim0)
   work <- Call.newArray1 (maximum[1,lwork])
   rwork <- Call.newArray1 (2*n)
   evalContT $ do
      mPtr <- Call.cint m
      nPtr <- Call.cint n
      nrhsPtr <- Call.cint nrhs
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      bPtr <- Call.ioarray b
      ldbPtr <- Call.cint ldb
      jpvtPtr <- Call.ioarray jpvt
      rcondPtr <- Call.float rcond
      rankPtr <- Call.alloca
      workPtr <- Call.ioarray work
      lworkPtr <- Call.cint lwork
      rworkPtr <- Call.ioarray rwork
      infoPtr <- Call.alloca
      liftIO $ FFI.gelsy mPtr nPtr nrhsPtr aPtr ldaPtr bPtr ldbPtr jpvtPtr rcondPtr rankPtr workPtr lworkPtr rworkPtr infoPtr
      liftIO $ pure (,)
         <*> fmap fromIntegral (peek rankPtr)
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgeql2.f>
geql2 ::
   Int {- ^ m -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   IO (Array ZeroInt (Complex Float), Int)
geql2 m a = do
   let (aDim0,aDim1) = Call.sizes2 $ MutArray.shape a
   let n = aDim0
   let lda = aDim1
   tau <- Call.newArray1 (minimum[m,n])
   work <- Call.newArray1 n
   evalContT $ do
      mPtr <- Call.cint m
      nPtr <- Call.cint n
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      tauPtr <- Call.ioarray tau
      workPtr <- Call.ioarray work
      infoPtr <- Call.alloca
      liftIO $ FFI.geql2 mPtr nPtr aPtr ldaPtr tauPtr workPtr infoPtr
      liftIO $ pure (,)
         <*> Call.freezeArray tau
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgeqlf.f>
geqlf ::
   Int {- ^ m -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   Int {- ^ lwork -} ->
   IO (Array ZeroInt (Complex Float), Int)
geqlf m a lwork = do
   let (aDim0,aDim1) = Call.sizes2 $ MutArray.shape a
   let n = aDim0
   let lda = aDim1
   tau <- Call.newArray1 (minimum[m,n])
   work <- Call.newArray1 (maximum[1,lwork])
   evalContT $ do
      mPtr <- Call.cint m
      nPtr <- Call.cint n
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      tauPtr <- Call.ioarray tau
      workPtr <- Call.ioarray work
      lworkPtr <- Call.cint lwork
      infoPtr <- Call.alloca
      liftIO $ FFI.geqlf mPtr nPtr aPtr ldaPtr tauPtr workPtr lworkPtr infoPtr
      liftIO $ pure (,)
         <*> Call.freezeArray tau
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgeqp3.f>
geqp3 ::
   Int {- ^ m -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   IOArray ZeroInt CInt {- ^ jpvt -} ->
   Int {- ^ lwork -} ->
   IO (Array ZeroInt (Complex Float), Int)
geqp3 m a jpvt lwork = do
   let (aDim0,aDim1) = Call.sizes2 $ MutArray.shape a
   let jpvtDim0 = Call.sizes1 $ MutArray.shape jpvt
   let n = aDim0
   let lda = aDim1
   Call.assert "geqp3: n == jpvtDim0" (n == jpvtDim0)
   tau <- Call.newArray1 (minimum[m,n])
   work <- Call.newArray1 (maximum[1,lwork])
   rwork <- Call.newArray1 (2*n)
   evalContT $ do
      mPtr <- Call.cint m
      nPtr <- Call.cint n
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      jpvtPtr <- Call.ioarray jpvt
      tauPtr <- Call.ioarray tau
      workPtr <- Call.ioarray work
      lworkPtr <- Call.cint lwork
      rworkPtr <- Call.ioarray rwork
      infoPtr <- Call.alloca
      liftIO $ FFI.geqp3 mPtr nPtr aPtr ldaPtr jpvtPtr tauPtr workPtr lworkPtr rworkPtr infoPtr
      liftIO $ pure (,)
         <*> Call.freezeArray tau
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgeqr2.f>
geqr2 ::
   Int {- ^ m -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   IO (Array ZeroInt (Complex Float), Int)
geqr2 m a = do
   let (aDim0,aDim1) = Call.sizes2 $ MutArray.shape a
   let n = aDim0
   let lda = aDim1
   tau <- Call.newArray1 (minimum[m,n])
   work <- Call.newArray1 n
   evalContT $ do
      mPtr <- Call.cint m
      nPtr <- Call.cint n
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      tauPtr <- Call.ioarray tau
      workPtr <- Call.ioarray work
      infoPtr <- Call.alloca
      liftIO $ FFI.geqr2 mPtr nPtr aPtr ldaPtr tauPtr workPtr infoPtr
      liftIO $ pure (,)
         <*> Call.freezeArray tau
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgeqr2p.f>
geqr2p ::
   Int {- ^ m -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   IO (Array ZeroInt (Complex Float), Int)
geqr2p m a = do
   let (aDim0,aDim1) = Call.sizes2 $ MutArray.shape a
   let n = aDim0
   let lda = aDim1
   tau <- Call.newArray1 (minimum[m,n])
   work <- Call.newArray1 n
   evalContT $ do
      mPtr <- Call.cint m
      nPtr <- Call.cint n
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      tauPtr <- Call.ioarray tau
      workPtr <- Call.ioarray work
      infoPtr <- Call.alloca
      liftIO $ FFI.geqr2p mPtr nPtr aPtr ldaPtr tauPtr workPtr infoPtr
      liftIO $ pure (,)
         <*> Call.freezeArray tau
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgeqrf.f>
geqrf ::
   Int {- ^ m -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   Int {- ^ lwork -} ->
   IO (Array ZeroInt (Complex Float), Int)
geqrf m a lwork = do
   let (aDim0,aDim1) = Call.sizes2 $ MutArray.shape a
   let n = aDim0
   let lda = aDim1
   tau <- Call.newArray1 (minimum[m,n])
   work <- Call.newArray1 (maximum[1,lwork])
   evalContT $ do
      mPtr <- Call.cint m
      nPtr <- Call.cint n
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      tauPtr <- Call.ioarray tau
      workPtr <- Call.ioarray work
      lworkPtr <- Call.cint lwork
      infoPtr <- Call.alloca
      liftIO $ FFI.geqrf mPtr nPtr aPtr ldaPtr tauPtr workPtr lworkPtr infoPtr
      liftIO $ pure (,)
         <*> Call.freezeArray tau
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgeqrfp.f>
geqrfp ::
   Int {- ^ m -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   Int {- ^ lwork -} ->
   IO (Array ZeroInt (Complex Float), Int)
geqrfp m a lwork = do
   let (aDim0,aDim1) = Call.sizes2 $ MutArray.shape a
   let n = aDim0
   let lda = aDim1
   tau <- Call.newArray1 (minimum[m,n])
   work <- Call.newArray1 (maximum[1,lwork])
   evalContT $ do
      mPtr <- Call.cint m
      nPtr <- Call.cint n
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      tauPtr <- Call.ioarray tau
      workPtr <- Call.ioarray work
      lworkPtr <- Call.cint lwork
      infoPtr <- Call.alloca
      liftIO $ FFI.geqrfp mPtr nPtr aPtr ldaPtr tauPtr workPtr lworkPtr infoPtr
      liftIO $ pure (,)
         <*> Call.freezeArray tau
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgerfs.f>
gerfs ::
   Char {- ^ trans -} ->
   Array (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   Array (ZeroInt,ZeroInt) (Complex Float) {- ^ af -} ->
   Array ZeroInt CInt {- ^ ipiv -} ->
   Array (ZeroInt,ZeroInt) (Complex Float) {- ^ b -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ x -} ->
   IO (Array ZeroInt Float, Array ZeroInt Float, Int)
gerfs trans a af ipiv b x = do
   let (aDim0,aDim1) = Call.sizes2 $ Array.shape a
   let (afDim0,afDim1) = Call.sizes2 $ Array.shape af
   let ipivDim0 = Call.sizes1 $ Array.shape ipiv
   let (bDim0,bDim1) = Call.sizes2 $ Array.shape b
   let (xDim0,xDim1) = Call.sizes2 $ MutArray.shape x
   let n = aDim0
   let lda = aDim1
   let ldaf = afDim1
   let nrhs = bDim0
   let ldb = bDim1
   let ldx = xDim1
   Call.assert "gerfs: n == afDim0" (n == afDim0)
   Call.assert "gerfs: n == ipivDim0" (n == ipivDim0)
   Call.assert "gerfs: nrhs == xDim0" (nrhs == xDim0)
   ferr <- Call.newArray1 nrhs
   berr <- Call.newArray1 nrhs
   work <- Call.newArray1 (2*n)
   rwork <- Call.newArray1 n
   evalContT $ do
      transPtr <- Call.char trans
      nPtr <- Call.cint n
      nrhsPtr <- Call.cint nrhs
      aPtr <- Call.array a
      ldaPtr <- Call.cint lda
      afPtr <- Call.array af
      ldafPtr <- Call.cint ldaf
      ipivPtr <- Call.array ipiv
      bPtr <- Call.array b
      ldbPtr <- Call.cint ldb
      xPtr <- Call.ioarray x
      ldxPtr <- Call.cint ldx
      ferrPtr <- Call.ioarray ferr
      berrPtr <- Call.ioarray berr
      workPtr <- Call.ioarray work
      rworkPtr <- Call.ioarray rwork
      infoPtr <- Call.alloca
      liftIO $ FFI.gerfs transPtr nPtr nrhsPtr aPtr ldaPtr afPtr ldafPtr ipivPtr bPtr ldbPtr xPtr ldxPtr ferrPtr berrPtr workPtr rworkPtr infoPtr
      liftIO $ pure (,,)
         <*> Call.freezeArray ferr
         <*> Call.freezeArray berr
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgerq2.f>
gerq2 ::
   Int {- ^ m -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   IO (Array ZeroInt (Complex Float), Int)
gerq2 m a = do
   let (aDim0,aDim1) = Call.sizes2 $ MutArray.shape a
   let n = aDim0
   let lda = aDim1
   tau <- Call.newArray1 (minimum[m,n])
   work <- Call.newArray1 m
   evalContT $ do
      mPtr <- Call.cint m
      nPtr <- Call.cint n
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      tauPtr <- Call.ioarray tau
      workPtr <- Call.ioarray work
      infoPtr <- Call.alloca
      liftIO $ FFI.gerq2 mPtr nPtr aPtr ldaPtr tauPtr workPtr infoPtr
      liftIO $ pure (,)
         <*> Call.freezeArray tau
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgerqf.f>
gerqf ::
   Int {- ^ m -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   Int {- ^ lwork -} ->
   IO (Array ZeroInt (Complex Float), Int)
gerqf m a lwork = do
   let (aDim0,aDim1) = Call.sizes2 $ MutArray.shape a
   let n = aDim0
   let lda = aDim1
   tau <- Call.newArray1 (minimum[m,n])
   work <- Call.newArray1 (maximum[1,lwork])
   evalContT $ do
      mPtr <- Call.cint m
      nPtr <- Call.cint n
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      tauPtr <- Call.ioarray tau
      workPtr <- Call.ioarray work
      lworkPtr <- Call.cint lwork
      infoPtr <- Call.alloca
      liftIO $ FFI.gerqf mPtr nPtr aPtr ldaPtr tauPtr workPtr lworkPtr infoPtr
      liftIO $ pure (,)
         <*> Call.freezeArray tau
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgesc2.f>
gesc2 ::
   Array (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   IOArray ZeroInt (Complex Float) {- ^ rhs -} ->
   Array ZeroInt CInt {- ^ ipiv -} ->
   Array ZeroInt CInt {- ^ jpiv -} ->
   IO (Float)
gesc2 a rhs ipiv jpiv = do
   let (aDim0,aDim1) = Call.sizes2 $ Array.shape a
   let rhsDim0 = Call.sizes1 $ MutArray.shape rhs
   let ipivDim0 = Call.sizes1 $ Array.shape ipiv
   let jpivDim0 = Call.sizes1 $ Array.shape jpiv
   let n = aDim0
   let lda = aDim1
   let _rhsSize = rhsDim0
   Call.assert "gesc2: n == ipivDim0" (n == ipivDim0)
   Call.assert "gesc2: n == jpivDim0" (n == jpivDim0)
   evalContT $ do
      nPtr <- Call.cint n
      aPtr <- Call.array a
      ldaPtr <- Call.cint lda
      rhsPtr <- Call.ioarray rhs
      ipivPtr <- Call.array ipiv
      jpivPtr <- Call.array jpiv
      scalePtr <- Call.alloca
      liftIO $ FFI.gesc2 nPtr aPtr ldaPtr rhsPtr ipivPtr jpivPtr scalePtr
      liftIO $ peek scalePtr

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgesdd.f>
gesdd ::
   Char {- ^ jobz -} ->
   Int {- ^ m -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   Int {- ^ ucol -} ->
   Int {- ^ ldu -} ->
   Int {- ^ ldvt -} ->
   Int {- ^ lwork -} ->
   Int {- ^ lrwork -} ->
   IO (Array ZeroInt Float, Array (ZeroInt,ZeroInt) (Complex Float), Array (ZeroInt,ZeroInt) (Complex Float), Int)
gesdd jobz m a ucol ldu ldvt lwork lrwork = do
   let (aDim0,aDim1) = Call.sizes2 $ MutArray.shape a
   let n = aDim0
   let lda = aDim1
   s <- Call.newArray1 (minimum[m,n])
   u <- Call.newArray2 ucol ldu
   vt <- Call.newArray2 n ldvt
   work <- Call.newArray1 (maximum[1,lwork])
   rwork <- Call.newArray1 (maximum[1,lrwork])
   iwork <- Call.newArray1 (8*minimum[m,n])
   evalContT $ do
      jobzPtr <- Call.char jobz
      mPtr <- Call.cint m
      nPtr <- Call.cint n
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      sPtr <- Call.ioarray s
      uPtr <- Call.ioarray u
      lduPtr <- Call.cint ldu
      vtPtr <- Call.ioarray vt
      ldvtPtr <- Call.cint ldvt
      workPtr <- Call.ioarray work
      lworkPtr <- Call.cint lwork
      rworkPtr <- Call.ioarray rwork
      iworkPtr <- Call.ioarray iwork
      infoPtr <- Call.alloca
      liftIO $ FFI.gesdd jobzPtr mPtr nPtr aPtr ldaPtr sPtr uPtr lduPtr vtPtr ldvtPtr workPtr lworkPtr rworkPtr iworkPtr infoPtr
      liftIO $ pure (,,,)
         <*> Call.freezeArray s
         <*> Call.freezeArray u
         <*> Call.freezeArray vt
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgesv.f>
gesv ::
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ b -} ->
   IO (Array ZeroInt CInt, Int)
gesv a b = do
   let (aDim0,aDim1) = Call.sizes2 $ MutArray.shape a
   let (bDim0,bDim1) = Call.sizes2 $ MutArray.shape b
   let n = aDim0
   let lda = aDim1
   let nrhs = bDim0
   let ldb = bDim1
   ipiv <- Call.newArray1 n
   evalContT $ do
      nPtr <- Call.cint n
      nrhsPtr <- Call.cint nrhs
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      ipivPtr <- Call.ioarray ipiv
      bPtr <- Call.ioarray b
      ldbPtr <- Call.cint ldb
      infoPtr <- Call.alloca
      liftIO $ FFI.gesv nPtr nrhsPtr aPtr ldaPtr ipivPtr bPtr ldbPtr infoPtr
      liftIO $ pure (,)
         <*> Call.freezeArray ipiv
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgesvd.f>
gesvd ::
   Char {- ^ jobu -} ->
   Char {- ^ jobvt -} ->
   Int {- ^ m -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   Int {- ^ ucol -} ->
   Int {- ^ ldu -} ->
   Int {- ^ ldvt -} ->
   Int {- ^ lwork -} ->
   IO (Array ZeroInt Float, Array (ZeroInt,ZeroInt) (Complex Float), Array (ZeroInt,ZeroInt) (Complex Float), Int)
gesvd jobu jobvt m a ucol ldu ldvt lwork = do
   let (aDim0,aDim1) = Call.sizes2 $ MutArray.shape a
   let n = aDim0
   let lda = aDim1
   s <- Call.newArray1 (minimum[m,n])
   u <- Call.newArray2 ucol ldu
   vt <- Call.newArray2 n ldvt
   work <- Call.newArray1 (maximum[1,lwork])
   rwork <- Call.newArray1 (5*minimum[m,n])
   evalContT $ do
      jobuPtr <- Call.char jobu
      jobvtPtr <- Call.char jobvt
      mPtr <- Call.cint m
      nPtr <- Call.cint n
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      sPtr <- Call.ioarray s
      uPtr <- Call.ioarray u
      lduPtr <- Call.cint ldu
      vtPtr <- Call.ioarray vt
      ldvtPtr <- Call.cint ldvt
      workPtr <- Call.ioarray work
      lworkPtr <- Call.cint lwork
      rworkPtr <- Call.ioarray rwork
      infoPtr <- Call.alloca
      liftIO $ FFI.gesvd jobuPtr jobvtPtr mPtr nPtr aPtr ldaPtr sPtr uPtr lduPtr vtPtr ldvtPtr workPtr lworkPtr rworkPtr infoPtr
      liftIO $ pure (,,,)
         <*> Call.freezeArray s
         <*> Call.freezeArray u
         <*> Call.freezeArray vt
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgesvx.f>
gesvx ::
   Char {- ^ fact -} ->
   Char {- ^ trans -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ af -} ->
   IOArray ZeroInt CInt {- ^ ipiv -} ->
   Char {- ^ equed -} ->
   IOArray ZeroInt Float {- ^ r -} ->
   IOArray ZeroInt Float {- ^ c -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ b -} ->
   Int {- ^ ldx -} ->
   IO (Char, Array (ZeroInt,ZeroInt) (Complex Float), Float, Array ZeroInt Float, Array ZeroInt Float, Int)
gesvx fact trans a af ipiv equed r c b ldx = do
   let (aDim0,aDim1) = Call.sizes2 $ MutArray.shape a
   let (afDim0,afDim1) = Call.sizes2 $ MutArray.shape af
   let ipivDim0 = Call.sizes1 $ MutArray.shape ipiv
   let rDim0 = Call.sizes1 $ MutArray.shape r
   let cDim0 = Call.sizes1 $ MutArray.shape c
   let (bDim0,bDim1) = Call.sizes2 $ MutArray.shape b
   let n = aDim0
   let lda = aDim1
   let ldaf = afDim1
   let nrhs = bDim0
   let ldb = bDim1
   Call.assert "gesvx: n == afDim0" (n == afDim0)
   Call.assert "gesvx: n == ipivDim0" (n == ipivDim0)
   Call.assert "gesvx: n == rDim0" (n == rDim0)
   Call.assert "gesvx: n == cDim0" (n == cDim0)
   x <- Call.newArray2 nrhs ldx
   ferr <- Call.newArray1 nrhs
   berr <- Call.newArray1 nrhs
   work <- Call.newArray1 (2*n)
   rwork <- Call.newArray1 (2*n)
   evalContT $ do
      factPtr <- Call.char fact
      transPtr <- Call.char trans
      nPtr <- Call.cint n
      nrhsPtr <- Call.cint nrhs
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      afPtr <- Call.ioarray af
      ldafPtr <- Call.cint ldaf
      ipivPtr <- Call.ioarray ipiv
      equedPtr <- Call.char equed
      rPtr <- Call.ioarray r
      cPtr <- Call.ioarray c
      bPtr <- Call.ioarray b
      ldbPtr <- Call.cint ldb
      xPtr <- Call.ioarray x
      ldxPtr <- Call.cint ldx
      rcondPtr <- Call.alloca
      ferrPtr <- Call.ioarray ferr
      berrPtr <- Call.ioarray berr
      workPtr <- Call.ioarray work
      rworkPtr <- Call.ioarray rwork
      infoPtr <- Call.alloca
      liftIO $ FFI.gesvx factPtr transPtr nPtr nrhsPtr aPtr ldaPtr afPtr ldafPtr ipivPtr equedPtr rPtr cPtr bPtr ldbPtr xPtr ldxPtr rcondPtr ferrPtr berrPtr workPtr rworkPtr infoPtr
      liftIO $ pure (,,,,,)
         <*> fmap castCCharToChar (peek equedPtr)
         <*> Call.freezeArray x
         <*> peek rcondPtr
         <*> Call.freezeArray ferr
         <*> Call.freezeArray berr
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgetc2.f>
getc2 ::
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   IO (Array ZeroInt CInt, Array ZeroInt CInt, Int)
getc2 a = do
   let (aDim0,aDim1) = Call.sizes2 $ MutArray.shape a
   let n = aDim0
   let lda = aDim1
   ipiv <- Call.newArray1 n
   jpiv <- Call.newArray1 n
   evalContT $ do
      nPtr <- Call.cint n
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      ipivPtr <- Call.ioarray ipiv
      jpivPtr <- Call.ioarray jpiv
      infoPtr <- Call.alloca
      liftIO $ FFI.getc2 nPtr aPtr ldaPtr ipivPtr jpivPtr infoPtr
      liftIO $ pure (,,)
         <*> Call.freezeArray ipiv
         <*> Call.freezeArray jpiv
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgetf2.f>
getf2 ::
   Int {- ^ m -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   IO (Array ZeroInt CInt, Int)
getf2 m a = do
   let (aDim0,aDim1) = Call.sizes2 $ MutArray.shape a
   let n = aDim0
   let lda = aDim1
   ipiv <- Call.newArray1 (minimum[m,n])
   evalContT $ do
      mPtr <- Call.cint m
      nPtr <- Call.cint n
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      ipivPtr <- Call.ioarray ipiv
      infoPtr <- Call.alloca
      liftIO $ FFI.getf2 mPtr nPtr aPtr ldaPtr ipivPtr infoPtr
      liftIO $ pure (,)
         <*> Call.freezeArray ipiv
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgetrf.f>
getrf ::
   Int {- ^ m -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   IO (Array ZeroInt CInt, Int)
getrf m a = do
   let (aDim0,aDim1) = Call.sizes2 $ MutArray.shape a
   let n = aDim0
   let lda = aDim1
   ipiv <- Call.newArray1 (minimum[m,n])
   evalContT $ do
      mPtr <- Call.cint m
      nPtr <- Call.cint n
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      ipivPtr <- Call.ioarray ipiv
      infoPtr <- Call.alloca
      liftIO $ FFI.getrf mPtr nPtr aPtr ldaPtr ipivPtr infoPtr
      liftIO $ pure (,)
         <*> Call.freezeArray ipiv
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgetri.f>
getri ::
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   Array ZeroInt CInt {- ^ ipiv -} ->
   Int {- ^ lwork -} ->
   IO (Int)
getri a ipiv lwork = do
   let (aDim0,aDim1) = Call.sizes2 $ MutArray.shape a
   let ipivDim0 = Call.sizes1 $ Array.shape ipiv
   let n = aDim0
   let lda = aDim1
   Call.assert "getri: n == ipivDim0" (n == ipivDim0)
   work <- Call.newArray1 (maximum[1,lwork])
   evalContT $ do
      nPtr <- Call.cint n
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      ipivPtr <- Call.array ipiv
      workPtr <- Call.ioarray work
      lworkPtr <- Call.cint lwork
      infoPtr <- Call.alloca
      liftIO $ FFI.getri nPtr aPtr ldaPtr ipivPtr workPtr lworkPtr infoPtr
      liftIO $ fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgetrs.f>
getrs ::
   Char {- ^ trans -} ->
   Array (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   Array ZeroInt CInt {- ^ ipiv -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ b -} ->
   IO (Int)
getrs trans a ipiv b = do
   let (aDim0,aDim1) = Call.sizes2 $ Array.shape a
   let ipivDim0 = Call.sizes1 $ Array.shape ipiv
   let (bDim0,bDim1) = Call.sizes2 $ MutArray.shape b
   let n = aDim0
   let lda = aDim1
   let nrhs = bDim0
   let ldb = bDim1
   Call.assert "getrs: n == ipivDim0" (n == ipivDim0)
   evalContT $ do
      transPtr <- Call.char trans
      nPtr <- Call.cint n
      nrhsPtr <- Call.cint nrhs
      aPtr <- Call.array a
      ldaPtr <- Call.cint lda
      ipivPtr <- Call.array ipiv
      bPtr <- Call.ioarray b
      ldbPtr <- Call.cint ldb
      infoPtr <- Call.alloca
      liftIO $ FFI.getrs transPtr nPtr nrhsPtr aPtr ldaPtr ipivPtr bPtr ldbPtr infoPtr
      liftIO $ fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cggbak.f>
ggbak ::
   Char {- ^ job -} ->
   Char {- ^ side -} ->
   Int {- ^ ilo -} ->
   Int {- ^ ihi -} ->
   Array ZeroInt Float {- ^ lscale -} ->
   Array ZeroInt Float {- ^ rscale -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ v -} ->
   IO (Int)
ggbak job side ilo ihi lscale rscale v = do
   let lscaleDim0 = Call.sizes1 $ Array.shape lscale
   let rscaleDim0 = Call.sizes1 $ Array.shape rscale
   let (vDim0,vDim1) = Call.sizes2 $ MutArray.shape v
   let n = lscaleDim0
   let m = vDim0
   let ldv = vDim1
   Call.assert "ggbak: n == rscaleDim0" (n == rscaleDim0)
   evalContT $ do
      jobPtr <- Call.char job
      sidePtr <- Call.char side
      nPtr <- Call.cint n
      iloPtr <- Call.cint ilo
      ihiPtr <- Call.cint ihi
      lscalePtr <- Call.array lscale
      rscalePtr <- Call.array rscale
      mPtr <- Call.cint m
      vPtr <- Call.ioarray v
      ldvPtr <- Call.cint ldv
      infoPtr <- Call.alloca
      liftIO $ FFI.ggbak jobPtr sidePtr nPtr iloPtr ihiPtr lscalePtr rscalePtr mPtr vPtr ldvPtr infoPtr
      liftIO $ fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cggbal.f>
ggbal ::
   Char {- ^ job -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ b -} ->
   Int {- ^ lwork -} ->
   IO (Int, Int, Array ZeroInt Float, Array ZeroInt Float, Int)
ggbal job a b lwork = do
   let (aDim0,aDim1) = Call.sizes2 $ MutArray.shape a
   let (bDim0,bDim1) = Call.sizes2 $ MutArray.shape b
   let n = aDim0
   let lda = aDim1
   let ldb = bDim1
   Call.assert "ggbal: n == bDim0" (n == bDim0)
   lscale <- Call.newArray1 n
   rscale <- Call.newArray1 n
   work <- Call.newArray1 lwork
   evalContT $ do
      jobPtr <- Call.char job
      nPtr <- Call.cint n
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      bPtr <- Call.ioarray b
      ldbPtr <- Call.cint ldb
      iloPtr <- Call.alloca
      ihiPtr <- Call.alloca
      lscalePtr <- Call.ioarray lscale
      rscalePtr <- Call.ioarray rscale
      workPtr <- Call.ioarray work
      infoPtr <- Call.alloca
      liftIO $ FFI.ggbal jobPtr nPtr aPtr ldaPtr bPtr ldbPtr iloPtr ihiPtr lscalePtr rscalePtr workPtr infoPtr
      liftIO $ pure (,,,,)
         <*> fmap fromIntegral (peek iloPtr)
         <*> fmap fromIntegral (peek ihiPtr)
         <*> Call.freezeArray lscale
         <*> Call.freezeArray rscale
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgges.f>
gges ::
   Char {- ^ jobvsl -} ->
   Char {- ^ jobvsr -} ->
   Char {- ^ sort -} ->
   FunPtr (Ptr (Complex Float) -> Ptr (Complex Float) -> IO Bool) {- ^ selctg -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ b -} ->
   Int {- ^ ldvsl -} ->
   Int {- ^ ldvsr -} ->
   Int {- ^ lwork -} ->
   IO (Int, Array ZeroInt (Complex Float), Array ZeroInt (Complex Float), Array (ZeroInt,ZeroInt) (Complex Float), Array (ZeroInt,ZeroInt) (Complex Float), Int)
gges jobvsl jobvsr sort selctg a b ldvsl ldvsr lwork = do
   let (aDim0,aDim1) = Call.sizes2 $ MutArray.shape a
   let (bDim0,bDim1) = Call.sizes2 $ MutArray.shape b
   let n = aDim0
   let lda = aDim1
   let ldb = bDim1
   Call.assert "gges: n == bDim0" (n == bDim0)
   alpha <- Call.newArray1 n
   beta <- Call.newArray1 n
   vsl <- Call.newArray2 n ldvsl
   vsr <- Call.newArray2 n ldvsr
   work <- Call.newArray1 (maximum[1,lwork])
   rwork <- Call.newArray1 (8*n)
   bwork <- Call.newArray1 n
   evalContT $ do
      jobvslPtr <- Call.char jobvsl
      jobvsrPtr <- Call.char jobvsr
      sortPtr <- Call.char sort
      selctgPtr <- pure selctg
      nPtr <- Call.cint n
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      bPtr <- Call.ioarray b
      ldbPtr <- Call.cint ldb
      sdimPtr <- Call.alloca
      alphaPtr <- Call.ioarray alpha
      betaPtr <- Call.ioarray beta
      vslPtr <- Call.ioarray vsl
      ldvslPtr <- Call.cint ldvsl
      vsrPtr <- Call.ioarray vsr
      ldvsrPtr <- Call.cint ldvsr
      workPtr <- Call.ioarray work
      lworkPtr <- Call.cint lwork
      rworkPtr <- Call.ioarray rwork
      bworkPtr <- Call.ioarray bwork
      infoPtr <- Call.alloca
      liftIO $ FFI.gges jobvslPtr jobvsrPtr sortPtr selctgPtr nPtr aPtr ldaPtr bPtr ldbPtr sdimPtr alphaPtr betaPtr vslPtr ldvslPtr vsrPtr ldvsrPtr workPtr lworkPtr rworkPtr bworkPtr infoPtr
      liftIO $ pure (,,,,,)
         <*> fmap fromIntegral (peek sdimPtr)
         <*> Call.freezeArray alpha
         <*> Call.freezeArray beta
         <*> Call.freezeArray vsl
         <*> Call.freezeArray vsr
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cggesx.f>
ggesx ::
   Char {- ^ jobvsl -} ->
   Char {- ^ jobvsr -} ->
   Char {- ^ sort -} ->
   FunPtr (Ptr (Complex Float) -> Ptr (Complex Float) -> IO Bool) {- ^ selctg -} ->
   Char {- ^ sense -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ b -} ->
   Int {- ^ ldvsl -} ->
   Int {- ^ ldvsr -} ->
   Int {- ^ lwork -} ->
   Int {- ^ liwork -} ->
   IO (Int, Array ZeroInt (Complex Float), Array ZeroInt (Complex Float), Array (ZeroInt,ZeroInt) (Complex Float), Array (ZeroInt,ZeroInt) (Complex Float), Array ZeroInt Float, Array ZeroInt Float, Int)
ggesx jobvsl jobvsr sort selctg sense a b ldvsl ldvsr lwork liwork = do
   let (aDim0,aDim1) = Call.sizes2 $ MutArray.shape a
   let (bDim0,bDim1) = Call.sizes2 $ MutArray.shape b
   let n = aDim0
   let lda = aDim1
   let ldb = bDim1
   Call.assert "ggesx: n == bDim0" (n == bDim0)
   alpha <- Call.newArray1 n
   beta <- Call.newArray1 n
   vsl <- Call.newArray2 n ldvsl
   vsr <- Call.newArray2 n ldvsr
   rconde <- Call.newArray1 2
   rcondv <- Call.newArray1 2
   work <- Call.newArray1 (maximum[1,lwork])
   rwork <- Call.newArray1 (8*n)
   iwork <- Call.newArray1 (maximum[1,liwork])
   bwork <- Call.newArray1 n
   evalContT $ do
      jobvslPtr <- Call.char jobvsl
      jobvsrPtr <- Call.char jobvsr
      sortPtr <- Call.char sort
      selctgPtr <- pure selctg
      sensePtr <- Call.char sense
      nPtr <- Call.cint n
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      bPtr <- Call.ioarray b
      ldbPtr <- Call.cint ldb
      sdimPtr <- Call.alloca
      alphaPtr <- Call.ioarray alpha
      betaPtr <- Call.ioarray beta
      vslPtr <- Call.ioarray vsl
      ldvslPtr <- Call.cint ldvsl
      vsrPtr <- Call.ioarray vsr
      ldvsrPtr <- Call.cint ldvsr
      rcondePtr <- Call.ioarray rconde
      rcondvPtr <- Call.ioarray rcondv
      workPtr <- Call.ioarray work
      lworkPtr <- Call.cint lwork
      rworkPtr <- Call.ioarray rwork
      iworkPtr <- Call.ioarray iwork
      liworkPtr <- Call.cint liwork
      bworkPtr <- Call.ioarray bwork
      infoPtr <- Call.alloca
      liftIO $ FFI.ggesx jobvslPtr jobvsrPtr sortPtr selctgPtr sensePtr nPtr aPtr ldaPtr bPtr ldbPtr sdimPtr alphaPtr betaPtr vslPtr ldvslPtr vsrPtr ldvsrPtr rcondePtr rcondvPtr workPtr lworkPtr rworkPtr iworkPtr liworkPtr bworkPtr infoPtr
      liftIO $ pure (,,,,,,,)
         <*> fmap fromIntegral (peek sdimPtr)
         <*> Call.freezeArray alpha
         <*> Call.freezeArray beta
         <*> Call.freezeArray vsl
         <*> Call.freezeArray vsr
         <*> Call.freezeArray rconde
         <*> Call.freezeArray rcondv
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cggev.f>
ggev ::
   Char {- ^ jobvl -} ->
   Char {- ^ jobvr -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ b -} ->
   Int {- ^ ldvl -} ->
   Int {- ^ ldvr -} ->
   Int {- ^ lwork -} ->
   IO (Array ZeroInt (Complex Float), Array ZeroInt (Complex Float), Array (ZeroInt,ZeroInt) (Complex Float), Array (ZeroInt,ZeroInt) (Complex Float), Int)
ggev jobvl jobvr a b ldvl ldvr lwork = do
   let (aDim0,aDim1) = Call.sizes2 $ MutArray.shape a
   let (bDim0,bDim1) = Call.sizes2 $ MutArray.shape b
   let n = aDim0
   let lda = aDim1
   let ldb = bDim1
   Call.assert "ggev: n == bDim0" (n == bDim0)
   alpha <- Call.newArray1 n
   beta <- Call.newArray1 n
   vl <- Call.newArray2 n ldvl
   vr <- Call.newArray2 n ldvr
   work <- Call.newArray1 (maximum[1,lwork])
   rwork <- Call.newArray1 (8*n)
   evalContT $ do
      jobvlPtr <- Call.char jobvl
      jobvrPtr <- Call.char jobvr
      nPtr <- Call.cint n
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      bPtr <- Call.ioarray b
      ldbPtr <- Call.cint ldb
      alphaPtr <- Call.ioarray alpha
      betaPtr <- Call.ioarray beta
      vlPtr <- Call.ioarray vl
      ldvlPtr <- Call.cint ldvl
      vrPtr <- Call.ioarray vr
      ldvrPtr <- Call.cint ldvr
      workPtr <- Call.ioarray work
      lworkPtr <- Call.cint lwork
      rworkPtr <- Call.ioarray rwork
      infoPtr <- Call.alloca
      liftIO $ FFI.ggev jobvlPtr jobvrPtr nPtr aPtr ldaPtr bPtr ldbPtr alphaPtr betaPtr vlPtr ldvlPtr vrPtr ldvrPtr workPtr lworkPtr rworkPtr infoPtr
      liftIO $ pure (,,,,)
         <*> Call.freezeArray alpha
         <*> Call.freezeArray beta
         <*> Call.freezeArray vl
         <*> Call.freezeArray vr
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cggevx.f>
ggevx ::
   Char {- ^ balanc -} ->
   Char {- ^ jobvl -} ->
   Char {- ^ jobvr -} ->
   Char {- ^ sense -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ b -} ->
   Int {- ^ ldvl -} ->
   Int {- ^ ldvr -} ->
   Int {- ^ lwork -} ->
   Int {- ^ lrwork -} ->
   IO (Array ZeroInt (Complex Float), Array ZeroInt (Complex Float), Array (ZeroInt,ZeroInt) (Complex Float), Array (ZeroInt,ZeroInt) (Complex Float), Int, Int, Array ZeroInt Float, Array ZeroInt Float, Float, Float, Array ZeroInt Float, Array ZeroInt Float, Int)
ggevx balanc jobvl jobvr sense a b ldvl ldvr lwork lrwork = do
   let (aDim0,aDim1) = Call.sizes2 $ MutArray.shape a
   let (bDim0,bDim1) = Call.sizes2 $ MutArray.shape b
   let n = aDim0
   let lda = aDim1
   let ldb = bDim1
   Call.assert "ggevx: n == bDim0" (n == bDim0)
   alpha <- Call.newArray1 n
   beta <- Call.newArray1 n
   vl <- Call.newArray2 n ldvl
   vr <- Call.newArray2 n ldvr
   lscale <- Call.newArray1 n
   rscale <- Call.newArray1 n
   rconde <- Call.newArray1 n
   rcondv <- Call.newArray1 n
   work <- Call.newArray1 (maximum[1,lwork])
   rwork <- Call.newArray1 lrwork
   iwork <- Call.newArray1 (n+2)
   bwork <- Call.newArray1 n
   evalContT $ do
      balancPtr <- Call.char balanc
      jobvlPtr <- Call.char jobvl
      jobvrPtr <- Call.char jobvr
      sensePtr <- Call.char sense
      nPtr <- Call.cint n
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      bPtr <- Call.ioarray b
      ldbPtr <- Call.cint ldb
      alphaPtr <- Call.ioarray alpha
      betaPtr <- Call.ioarray beta
      vlPtr <- Call.ioarray vl
      ldvlPtr <- Call.cint ldvl
      vrPtr <- Call.ioarray vr
      ldvrPtr <- Call.cint ldvr
      iloPtr <- Call.alloca
      ihiPtr <- Call.alloca
      lscalePtr <- Call.ioarray lscale
      rscalePtr <- Call.ioarray rscale
      abnrmPtr <- Call.alloca
      bbnrmPtr <- Call.alloca
      rcondePtr <- Call.ioarray rconde
      rcondvPtr <- Call.ioarray rcondv
      workPtr <- Call.ioarray work
      lworkPtr <- Call.cint lwork
      rworkPtr <- Call.ioarray rwork
      iworkPtr <- Call.ioarray iwork
      bworkPtr <- Call.ioarray bwork
      infoPtr <- Call.alloca
      liftIO $ FFI.ggevx balancPtr jobvlPtr jobvrPtr sensePtr nPtr aPtr ldaPtr bPtr ldbPtr alphaPtr betaPtr vlPtr ldvlPtr vrPtr ldvrPtr iloPtr ihiPtr lscalePtr rscalePtr abnrmPtr bbnrmPtr rcondePtr rcondvPtr workPtr lworkPtr rworkPtr iworkPtr bworkPtr infoPtr
      liftIO $ pure (,,,,,,,,,,,,)
         <*> Call.freezeArray alpha
         <*> Call.freezeArray beta
         <*> Call.freezeArray vl
         <*> Call.freezeArray vr
         <*> fmap fromIntegral (peek iloPtr)
         <*> fmap fromIntegral (peek ihiPtr)
         <*> Call.freezeArray lscale
         <*> Call.freezeArray rscale
         <*> peek abnrmPtr
         <*> peek bbnrmPtr
         <*> Call.freezeArray rconde
         <*> Call.freezeArray rcondv
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cggglm.f>
ggglm ::
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ b -} ->
   IOArray ZeroInt (Complex Float) {- ^ d -} ->
   Int {- ^ lwork -} ->
   IO (Array ZeroInt (Complex Float), Array ZeroInt (Complex Float), Int)
ggglm a b d lwork = do
   let (aDim0,aDim1) = Call.sizes2 $ MutArray.shape a
   let (bDim0,bDim1) = Call.sizes2 $ MutArray.shape b
   let dDim0 = Call.sizes1 $ MutArray.shape d
   let m = aDim0
   let lda = aDim1
   let p = bDim0
   let ldb = bDim1
   let n = dDim0
   x <- Call.newArray1 m
   y <- Call.newArray1 p
   work <- Call.newArray1 (maximum[1,lwork])
   evalContT $ do
      nPtr <- Call.cint n
      mPtr <- Call.cint m
      pPtr <- Call.cint p
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      bPtr <- Call.ioarray b
      ldbPtr <- Call.cint ldb
      dPtr <- Call.ioarray d
      xPtr <- Call.ioarray x
      yPtr <- Call.ioarray y
      workPtr <- Call.ioarray work
      lworkPtr <- Call.cint lwork
      infoPtr <- Call.alloca
      liftIO $ FFI.ggglm nPtr mPtr pPtr aPtr ldaPtr bPtr ldbPtr dPtr xPtr yPtr workPtr lworkPtr infoPtr
      liftIO $ pure (,,)
         <*> Call.freezeArray x
         <*> Call.freezeArray y
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgghrd.f>
gghrd ::
   Char {- ^ compq -} ->
   Char {- ^ compz -} ->
   Int {- ^ ilo -} ->
   Int {- ^ ihi -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ b -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ q -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ z -} ->
   IO (Int)
gghrd compq compz ilo ihi a b q z = do
   let (aDim0,aDim1) = Call.sizes2 $ MutArray.shape a
   let (bDim0,bDim1) = Call.sizes2 $ MutArray.shape b
   let (qDim0,qDim1) = Call.sizes2 $ MutArray.shape q
   let (zDim0,zDim1) = Call.sizes2 $ MutArray.shape z
   let n = aDim0
   let lda = aDim1
   let ldb = bDim1
   let ldq = qDim1
   let ldz = zDim1
   Call.assert "gghrd: n == bDim0" (n == bDim0)
   Call.assert "gghrd: n == qDim0" (n == qDim0)
   Call.assert "gghrd: n == zDim0" (n == zDim0)
   evalContT $ do
      compqPtr <- Call.char compq
      compzPtr <- Call.char compz
      nPtr <- Call.cint n
      iloPtr <- Call.cint ilo
      ihiPtr <- Call.cint ihi
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      bPtr <- Call.ioarray b
      ldbPtr <- Call.cint ldb
      qPtr <- Call.ioarray q
      ldqPtr <- Call.cint ldq
      zPtr <- Call.ioarray z
      ldzPtr <- Call.cint ldz
      infoPtr <- Call.alloca
      liftIO $ FFI.gghrd compqPtr compzPtr nPtr iloPtr ihiPtr aPtr ldaPtr bPtr ldbPtr qPtr ldqPtr zPtr ldzPtr infoPtr
      liftIO $ fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgglse.f>
gglse ::
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ b -} ->
   IOArray ZeroInt (Complex Float) {- ^ c -} ->
   IOArray ZeroInt (Complex Float) {- ^ d -} ->
   Int {- ^ lwork -} ->
   IO (Array ZeroInt (Complex Float), Int)
gglse a b c d lwork = do
   let (aDim0,aDim1) = Call.sizes2 $ MutArray.shape a
   let (bDim0,bDim1) = Call.sizes2 $ MutArray.shape b
   let cDim0 = Call.sizes1 $ MutArray.shape c
   let dDim0 = Call.sizes1 $ MutArray.shape d
   let n = aDim0
   let lda = aDim1
   let ldb = bDim1
   let m = cDim0
   let p = dDim0
   Call.assert "gglse: n == bDim0" (n == bDim0)
   x <- Call.newArray1 n
   work <- Call.newArray1 (maximum[1,lwork])
   evalContT $ do
      mPtr <- Call.cint m
      nPtr <- Call.cint n
      pPtr <- Call.cint p
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      bPtr <- Call.ioarray b
      ldbPtr <- Call.cint ldb
      cPtr <- Call.ioarray c
      dPtr <- Call.ioarray d
      xPtr <- Call.ioarray x
      workPtr <- Call.ioarray work
      lworkPtr <- Call.cint lwork
      infoPtr <- Call.alloca
      liftIO $ FFI.gglse mPtr nPtr pPtr aPtr ldaPtr bPtr ldbPtr cPtr dPtr xPtr workPtr lworkPtr infoPtr
      liftIO $ pure (,)
         <*> Call.freezeArray x
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cggqrf.f>
ggqrf ::
   Int {- ^ n -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ b -} ->
   Int {- ^ lwork -} ->
   IO (Array ZeroInt (Complex Float), Array ZeroInt (Complex Float), Int)
ggqrf n a b lwork = do
   let (aDim0,aDim1) = Call.sizes2 $ MutArray.shape a
   let (bDim0,bDim1) = Call.sizes2 $ MutArray.shape b
   let m = aDim0
   let lda = aDim1
   let p = bDim0
   let ldb = bDim1
   taua <- Call.newArray1 (minimum[n,m])
   taub <- Call.newArray1 (minimum[n,p])
   work <- Call.newArray1 (maximum[1,lwork])
   evalContT $ do
      nPtr <- Call.cint n
      mPtr <- Call.cint m
      pPtr <- Call.cint p
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      tauaPtr <- Call.ioarray taua
      bPtr <- Call.ioarray b
      ldbPtr <- Call.cint ldb
      taubPtr <- Call.ioarray taub
      workPtr <- Call.ioarray work
      lworkPtr <- Call.cint lwork
      infoPtr <- Call.alloca
      liftIO $ FFI.ggqrf nPtr mPtr pPtr aPtr ldaPtr tauaPtr bPtr ldbPtr taubPtr workPtr lworkPtr infoPtr
      liftIO $ pure (,,)
         <*> Call.freezeArray taua
         <*> Call.freezeArray taub
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cggrqf.f>
ggrqf ::
   Int {- ^ m -} ->
   Int {- ^ p -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ a -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ b -} ->
   Int {- ^ lwork -} ->
   IO (Array ZeroInt (Complex Float), Array ZeroInt (Complex Float), Int)
ggrqf m p a b lwork = do
   let (aDim0,aDim1) = Call.sizes2 $ MutArray.shape a
   let (bDim0,bDim1) = Call.sizes2 $ MutArray.shape b
   let n = aDim0
   let lda = aDim1
   let ldb = bDim1
   Call.assert "ggrqf: n == bDim0" (n == bDim0)
   taua <- Call.newArray1 (minimum[m,n])
   taub <- Call.newArray1 (minimum[p,n])
   work <- Call.newArray1 (maximum[1,lwork])
   evalContT $ do
      mPtr <- Call.cint m
      pPtr <- Call.cint p
      nPtr <- Call.cint n
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      tauaPtr <- Call.ioarray taua
      bPtr <- Call.ioarray b
      ldbPtr <- Call.cint ldb
      taubPtr <- Call.ioarray taub
      workPtr <- Call.ioarray work
      lworkPtr <- Call.cint lwork
      infoPtr <- Call.alloca
      liftIO $ FFI.ggrqf mPtr pPtr nPtr aPtr ldaPtr tauaPtr bPtr ldbPtr taubPtr workPtr lworkPtr infoPtr
      liftIO $ pure (,,)
         <*> Call.freezeArray taua
         <*> Call.freezeArray taub
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgtcon.f>
gtcon ::
   Char {- ^ norm -} ->
   Array ZeroInt (Complex Float) {- ^ dl -} ->
   Array ZeroInt (Complex Float) {- ^ d -} ->
   Array ZeroInt (Complex Float) {- ^ du -} ->
   Array ZeroInt (Complex Float) {- ^ du2 -} ->
   Array ZeroInt CInt {- ^ ipiv -} ->
   Float {- ^ anorm -} ->
   IO (Float, Int)
gtcon norm dl d du du2 ipiv anorm = do
   let dlDim0 = Call.sizes1 $ Array.shape dl
   let dDim0 = Call.sizes1 $ Array.shape d
   let duDim0 = Call.sizes1 $ Array.shape du
   let du2Dim0 = Call.sizes1 $ Array.shape du2
   let ipivDim0 = Call.sizes1 $ Array.shape ipiv
   let n = dDim0
   Call.assert "gtcon: n-1 == dlDim0" (n-1 == dlDim0)
   Call.assert "gtcon: n-1 == duDim0" (n-1 == duDim0)
   Call.assert "gtcon: n-2 == du2Dim0" (n-2 == du2Dim0)
   Call.assert "gtcon: n == ipivDim0" (n == ipivDim0)
   work <- Call.newArray1 (2*n)
   evalContT $ do
      normPtr <- Call.char norm
      nPtr <- Call.cint n
      dlPtr <- Call.array dl
      dPtr <- Call.array d
      duPtr <- Call.array du
      du2Ptr <- Call.array du2
      ipivPtr <- Call.array ipiv
      anormPtr <- Call.float anorm
      rcondPtr <- Call.alloca
      workPtr <- Call.ioarray work
      infoPtr <- Call.alloca
      liftIO $ FFI.gtcon normPtr nPtr dlPtr dPtr duPtr du2Ptr ipivPtr anormPtr rcondPtr workPtr infoPtr
      liftIO $ pure (,)
         <*> peek rcondPtr
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cgtrfs.f>
gtrfs ::
   Char {- ^ trans -} ->
   Array ZeroInt (Complex Float) {- ^ dl -} ->
   Array ZeroInt (Complex Float) {- ^ d -} ->
   Array ZeroInt (Complex Float) {- ^ du -} ->
   Array ZeroInt (Complex Float) {- ^ dlf -} ->
   Array ZeroInt (Complex Float) {- ^ df -} ->
   Array ZeroInt (Complex Float) {- ^ duf -} ->
   Array ZeroInt (Complex Float) {- ^ du2 -} ->
   Array ZeroInt CInt {- ^ ipiv -} ->
   Array (ZeroInt,ZeroInt) (Complex Float) {- ^ b -} ->
   IOArray (ZeroInt,ZeroInt) (Complex Float) {- ^ x -} ->
   IO (Array ZeroInt Float, Array ZeroInt Float, Int)
gtrfs trans dl d du dlf df duf du2 ipiv b x = do
   let dlDim0 = Call.sizes1 $ Array.shape dl
   let dDim0 = Call.sizes1 $ Array.shape d
   let duDim0 = Call.sizes1 $ Array.shape du
   let dlfDim0 = Call.sizes1 $ Array.shape dlf
   let dfDim0 = Call.sizes1 $ Array.shape df
   let dufDim0 = Call.sizes1 $ Array.shape duf
   let du2Dim0 = Call.sizes1 $ Array.shape du2
   let ipivDim0 = Call.sizes1