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

import qualified Numeric.LAPACK.FFI.Float as FFI
import qualified Numeric.Netlib.CArray.Utility as Call
import Numeric.Netlib.CArray.Utility ((^!))

import Data.Array.IOCArray (IOCArray, getBounds)
import Data.Array.CArray (CArray, bounds)

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/sbbcsd.f>
bbcsd ::
   Char {- ^ jobu1 -} ->
   Char {- ^ jobu2 -} ->
   Char {- ^ jobv1t -} ->
   Char {- ^ jobv2t -} ->
   Char {- ^ trans -} ->
   Int {- ^ m -} ->
   IOCArray Int Float {- ^ theta -} ->
   IOCArray Int Float {- ^ phi -} ->
   IOCArray (Int,Int) Float {- ^ u1 -} ->
   IOCArray (Int,Int) Float {- ^ u2 -} ->
   IOCArray (Int,Int) Float {- ^ v1t -} ->
   IOCArray (Int,Int) Float {- ^ v2t -} ->
   Int {- ^ lwork -} ->
   IO (CArray Int Float, CArray Int Float, CArray Int Float, CArray Int Float, CArray Int Float, CArray Int Float, CArray Int Float, CArray Int Float, Int)
bbcsd jobu1 jobu2 jobv1t jobv2t trans m theta phi u1 u2 v1t v2t lwork = do
   thetaDim0 <- Call.sizes1 <$> getBounds theta
   phiDim0 <- Call.sizes1 <$> getBounds phi
   (u1Dim0,u1Dim1) <- Call.sizes2 <$> getBounds u1
   (u2Dim0,u2Dim1) <- Call.sizes2 <$> getBounds u2
   (v1tDim0,v1tDim1) <- Call.sizes2 <$> getBounds v1t
   (v2tDim0,v2tDim1) <- Call.sizes2 <$> getBounds 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)
   work <- Call.newArray1 (maximum[1,lwork])
   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
      workPtr <- Call.ioarray work
      lworkPtr <- Call.cint lwork
      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 workPtr lworkPtr 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/sbdsdc.f>
bdsdc ::
   Char {- ^ uplo -} ->
   Char {- ^ compq -} ->
   IOCArray Int Float {- ^ d -} ->
   IOCArray Int Float {- ^ e -} ->
   Int {- ^ ldu -} ->
   Int {- ^ ldvt -} ->
   Int {- ^ ldq -} ->
   Int {- ^ ldiq -} ->
   Int {- ^ lwork -} ->
   IO (CArray (Int,Int) Float, CArray (Int,Int) Float, CArray Int Float, CArray Int CInt, Int)
bdsdc uplo compq d e ldu ldvt ldq ldiq lwork = do
   dDim0 <- Call.sizes1 <$> getBounds d
   eDim0 <- Call.sizes1 <$> getBounds e
   let n = dDim0
   Call.assert "bdsdc: n-1 == eDim0" (n-1 == eDim0)
   u <- Call.newArray2 n ldu
   vt <- Call.newArray2 n ldvt
   q <- Call.newArray1 ldq
   iq <- Call.newArray1 ldiq
   work <- Call.newArray1 (maximum[1,lwork])
   iwork <- Call.newArray1 (8*n)
   evalContT $ do
      uploPtr <- Call.char uplo
      compqPtr <- Call.char compq
      nPtr <- Call.cint n
      dPtr <- Call.ioarray d
      ePtr <- Call.ioarray e
      uPtr <- Call.ioarray u
      lduPtr <- Call.cint ldu
      vtPtr <- Call.ioarray vt
      ldvtPtr <- Call.cint ldvt
      qPtr <- Call.ioarray q
      iqPtr <- Call.ioarray iq
      workPtr <- Call.ioarray work
      iworkPtr <- Call.ioarray iwork
      infoPtr <- Call.alloca
      liftIO $ FFI.bdsdc uploPtr compqPtr nPtr dPtr ePtr uPtr lduPtr vtPtr ldvtPtr qPtr iqPtr workPtr iworkPtr infoPtr
      liftIO $ pure (,,,,)
         <*> Call.freezeArray u
         <*> Call.freezeArray vt
         <*> Call.freezeArray q
         <*> Call.freezeArray iq
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/sbdsqr.f>
bdsqr ::
   Char {- ^ uplo -} ->
   Int {- ^ nru -} ->
   IOCArray Int Float {- ^ d -} ->
   IOCArray Int Float {- ^ e -} ->
   IOCArray (Int,Int) Float {- ^ vt -} ->
   IOCArray (Int,Int) Float {- ^ u -} ->
   IOCArray (Int,Int) Float {- ^ c -} ->
   IO (Int)
bdsqr uplo nru d e vt u c = do
   dDim0 <- Call.sizes1 <$> getBounds d
   eDim0 <- Call.sizes1 <$> getBounds e
   (vtDim0,vtDim1) <- Call.sizes2 <$> getBounds vt
   (uDim0,uDim1) <- Call.sizes2 <$> getBounds u
   (cDim0,cDim1) <- Call.sizes2 <$> getBounds 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)
   work <- 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
      workPtr <- Call.ioarray work
      infoPtr <- Call.alloca
      liftIO $ FFI.bdsqr uploPtr nPtr ncvtPtr nruPtr nccPtr dPtr ePtr vtPtr ldvtPtr uPtr lduPtr cPtr ldcPtr workPtr infoPtr
      liftIO $ fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/sdisna.f>
disna ::
   Char {- ^ job -} ->
   Int {- ^ m -} ->
   Int {- ^ n -} ->
   CArray Int Float {- ^ d -} ->
   Int {- ^ sepSize -} ->
   IO (CArray Int Float, Int)
disna job m n d sepSize = do
   let dDim0 = Call.sizes1 $ bounds d
   let _dSize = dDim0
   sep <- Call.newArray1 sepSize
   evalContT $ do
      jobPtr <- Call.char job
      mPtr <- Call.cint m
      nPtr <- Call.cint n
      dPtr <- Call.array d
      sepPtr <- Call.ioarray sep
      infoPtr <- Call.alloca
      liftIO $ FFI.disna jobPtr mPtr nPtr dPtr sepPtr infoPtr
      liftIO $ pure (,)
         <*> Call.freezeArray sep
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/sgbbrd.f>
gbbrd ::
   Char {- ^ vect -} ->
   Int {- ^ m -} ->
   Int {- ^ kl -} ->
   Int {- ^ ku -} ->
   IOCArray (Int,Int) Float {- ^ ab -} ->
   Int {- ^ ldq -} ->
   Int {- ^ ldpt -} ->
   IOCArray (Int,Int) Float {- ^ c -} ->
   IO (CArray Int Float, CArray Int Float, CArray (Int,Int) Float, CArray (Int,Int) Float, Int)
gbbrd vect m kl ku ab ldq ldpt c = do
   (abDim0,abDim1) <- Call.sizes2 <$> getBounds ab
   (cDim0,cDim1) <- Call.sizes2 <$> getBounds 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 (2*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
      infoPtr <- Call.alloca
      liftIO $ FFI.gbbrd vectPtr mPtr nPtr nccPtr klPtr kuPtr abPtr ldabPtr dPtr ePtr qPtr ldqPtr ptPtr ldptPtr cPtr ldcPtr workPtr 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/sgbcon.f>
gbcon ::
   Char {- ^ norm -} ->
   Int {- ^ kl -} ->
   Int {- ^ ku -} ->
   CArray (Int,Int) Float {- ^ ab -} ->
   CArray Int CInt {- ^ ipiv -} ->
   Float {- ^ anorm -} ->
   IO (Float, Int)
gbcon norm kl ku ab ipiv anorm = do
   let (abDim0,abDim1) = Call.sizes2 $ bounds ab
   let ipivDim0 = Call.sizes1 $ bounds ipiv
   let n = abDim0
   let ldab = abDim1
   Call.assert "gbcon: n == ipivDim0" (n == ipivDim0)
   work <- Call.newArray1 (3*n)
   iwork <- 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
      iworkPtr <- Call.ioarray iwork
      infoPtr <- Call.alloca
      liftIO $ FFI.gbcon normPtr nPtr klPtr kuPtr abPtr ldabPtr ipivPtr anormPtr rcondPtr workPtr iworkPtr infoPtr
      liftIO $ pure (,)
         <*> peek rcondPtr
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/sgbequ.f>
gbequ ::
   Int {- ^ m -} ->
   Int {- ^ kl -} ->
   Int {- ^ ku -} ->
   CArray (Int,Int) Float {- ^ ab -} ->
   IO (CArray Int Float, CArray Int Float, Float, Float, Float, Int)
gbequ m kl ku ab = do
   let (abDim0,abDim1) = Call.sizes2 $ bounds 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/sgbequb.f>
gbequb ::
   Int {- ^ m -} ->
   Int {- ^ kl -} ->
   Int {- ^ ku -} ->
   CArray (Int,Int) Float {- ^ ab -} ->
   IO (CArray Int Float, CArray Int Float, Float, Float, Float, Int)
gbequb m kl ku ab = do
   let (abDim0,abDim1) = Call.sizes2 $ bounds 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/sgbrfs.f>
gbrfs ::
   Char {- ^ trans -} ->
   Int {- ^ kl -} ->
   Int {- ^ ku -} ->
   CArray (Int,Int) Float {- ^ ab -} ->
   CArray (Int,Int) Float {- ^ afb -} ->
   CArray Int CInt {- ^ ipiv -} ->
   CArray (Int,Int) Float {- ^ b -} ->
   IOCArray (Int,Int) Float {- ^ x -} ->
   IO (CArray Int Float, CArray Int Float, Int)
gbrfs trans kl ku ab afb ipiv b x = do
   let (abDim0,abDim1) = Call.sizes2 $ bounds ab
   let (afbDim0,afbDim1) = Call.sizes2 $ bounds afb
   let ipivDim0 = Call.sizes1 $ bounds ipiv
   let (bDim0,bDim1) = Call.sizes2 $ bounds b
   (xDim0,xDim1) <- Call.sizes2 <$> getBounds 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 (3*n)
   iwork <- 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
      iworkPtr <- Call.ioarray iwork
      infoPtr <- Call.alloca
      liftIO $ FFI.gbrfs transPtr nPtr klPtr kuPtr nrhsPtr abPtr ldabPtr afbPtr ldafbPtr ipivPtr bPtr ldbPtr xPtr ldxPtr ferrPtr berrPtr workPtr iworkPtr 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/sgbsv.f>
gbsv ::
   Int {- ^ kl -} ->
   Int {- ^ ku -} ->
   IOCArray (Int,Int) Float {- ^ ab -} ->
   IOCArray (Int,Int) Float {- ^ b -} ->
   IO (CArray Int CInt, Int)
gbsv kl ku ab b = do
   (abDim0,abDim1) <- Call.sizes2 <$> getBounds ab
   (bDim0,bDim1) <- Call.sizes2 <$> getBounds 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/sgbsvx.f>
gbsvx ::
   Char {- ^ fact -} ->
   Char {- ^ trans -} ->
   Int {- ^ kl -} ->
   Int {- ^ ku -} ->
   IOCArray (Int,Int) Float {- ^ ab -} ->
   IOCArray (Int,Int) Float {- ^ afb -} ->
   IOCArray Int CInt {- ^ ipiv -} ->
   Char {- ^ equed -} ->
   IOCArray Int Float {- ^ r -} ->
   IOCArray Int Float {- ^ c -} ->
   IOCArray (Int,Int) Float {- ^ b -} ->
   Int {- ^ ldx -} ->
   IO (Char, CArray (Int,Int) Float, Float, CArray Int Float, CArray Int Float, Int)
gbsvx fact trans kl ku ab afb ipiv equed r c b ldx = do
   (abDim0,abDim1) <- Call.sizes2 <$> getBounds ab
   (afbDim0,afbDim1) <- Call.sizes2 <$> getBounds afb
   ipivDim0 <- Call.sizes1 <$> getBounds ipiv
   rDim0 <- Call.sizes1 <$> getBounds r
   cDim0 <- Call.sizes1 <$> getBounds c
   (bDim0,bDim1) <- Call.sizes2 <$> getBounds 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 (3*n)
   iwork <- 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
      iworkPtr <- Call.ioarray iwork
      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 iworkPtr 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/sgbtf2.f>
gbtf2 ::
   Int {- ^ m -} ->
   Int {- ^ kl -} ->
   Int {- ^ ku -} ->
   IOCArray (Int,Int) Float {- ^ ab -} ->
   IO (CArray Int CInt, Int)
gbtf2 m kl ku ab = do
   (abDim0,abDim1) <- Call.sizes2 <$> getBounds 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/sgbtrf.f>
gbtrf ::
   Int {- ^ m -} ->
   Int {- ^ kl -} ->
   Int {- ^ ku -} ->
   IOCArray (Int,Int) Float {- ^ ab -} ->
   IO (CArray Int CInt, Int)
gbtrf m kl ku ab = do
   (abDim0,abDim1) <- Call.sizes2 <$> getBounds 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/sgbtrs.f>
gbtrs ::
   Char {- ^ trans -} ->
   Int {- ^ kl -} ->
   Int {- ^ ku -} ->
   CArray (Int,Int) Float {- ^ ab -} ->
   CArray Int CInt {- ^ ipiv -} ->
   IOCArray (Int,Int) Float {- ^ b -} ->
   IO (Int)
gbtrs trans kl ku ab ipiv b = do
   let (abDim0,abDim1) = Call.sizes2 $ bounds ab
   let ipivDim0 = Call.sizes1 $ bounds ipiv
   (bDim0,bDim1) <- Call.sizes2 <$> getBounds 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/sgebak.f>
gebak ::
   Char {- ^ job -} ->
   Char {- ^ side -} ->
   Int {- ^ ilo -} ->
   Int {- ^ ihi -} ->
   CArray Int Float {- ^ scale -} ->
   IOCArray (Int,Int) Float {- ^ v -} ->
   IO (Int)
gebak job side ilo ihi scale v = do
   let scaleDim0 = Call.sizes1 $ bounds scale
   (vDim0,vDim1) <- Call.sizes2 <$> getBounds 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/sgebal.f>
gebal ::
   Char {- ^ job -} ->
   IOCArray (Int,Int) Float {- ^ a -} ->
   IO (Int, Int, CArray Int Float, Int)
gebal job a = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds 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/sgebd2.f>
gebd2 ::
   Int {- ^ m -} ->
   IOCArray (Int,Int) Float {- ^ a -} ->
   IO (CArray Int Float, CArray Int Float, CArray Int Float, CArray Int Float, Int)
gebd2 m a = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds 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/sgebrd.f>
gebrd ::
   Int {- ^ m -} ->
   IOCArray (Int,Int) Float {- ^ a -} ->
   Int {- ^ lwork -} ->
   IO (CArray Int Float, CArray Int Float, CArray Int Float, CArray Int Float, Int)
gebrd m a lwork = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds 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/sgecon.f>
gecon ::
   Char {- ^ norm -} ->
   CArray (Int,Int) Float {- ^ a -} ->
   Float {- ^ anorm -} ->
   IO (Float, Int)
gecon norm a anorm = do
   let (aDim0,aDim1) = Call.sizes2 $ bounds a
   let n = aDim0
   let lda = aDim1
   work <- Call.newArray1 (4*n)
   iwork <- Call.newArray1 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
      iworkPtr <- Call.ioarray iwork
      infoPtr <- Call.alloca
      liftIO $ FFI.gecon normPtr nPtr aPtr ldaPtr anormPtr rcondPtr workPtr iworkPtr infoPtr
      liftIO $ pure (,)
         <*> peek rcondPtr
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/sgeequ.f>
geequ ::
   Int {- ^ m -} ->
   CArray (Int,Int) Float {- ^ a -} ->
   IO (CArray Int Float, CArray Int Float, Float, Float, Float, Int)
geequ m a = do
   let (aDim0,aDim1) = Call.sizes2 $ bounds 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/sgeequb.f>
geequb ::
   Int {- ^ m -} ->
   CArray (Int,Int) Float {- ^ a -} ->
   IO (CArray Int Float, CArray Int Float, Float, Float, Float, Int)
geequb m a = do
   let (aDim0,aDim1) = Call.sizes2 $ bounds 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/sgees.f>
gees ::
   Char {- ^ jobvs -} ->
   Char {- ^ sort -} ->
   FunPtr (Ptr Float -> Ptr Float -> IO Bool) {- ^ select -} ->
   IOCArray (Int,Int) Float {- ^ a -} ->
   Int {- ^ ldvs -} ->
   Int {- ^ lwork -} ->
   IO (Int, CArray Int Float, CArray Int Float, CArray (Int,Int) Float, Int)
gees jobvs sort select a ldvs lwork = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds a
   let n = aDim0
   let lda = aDim1
   wr <- Call.newArray1 n
   wi <- Call.newArray1 n
   vs <- Call.newArray2 n ldvs
   work <- Call.newArray1 (maximum[1,lwork])
   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
      wrPtr <- Call.ioarray wr
      wiPtr <- Call.ioarray wi
      vsPtr <- Call.ioarray vs
      ldvsPtr <- Call.cint ldvs
      workPtr <- Call.ioarray work
      lworkPtr <- Call.cint lwork
      bworkPtr <- Call.ioarray bwork
      infoPtr <- Call.alloca
      liftIO $ FFI.gees jobvsPtr sortPtr selectPtr nPtr aPtr ldaPtr sdimPtr wrPtr wiPtr vsPtr ldvsPtr workPtr lworkPtr bworkPtr infoPtr
      liftIO $ pure (,,,,)
         <*> fmap fromIntegral (peek sdimPtr)
         <*> Call.freezeArray wr
         <*> Call.freezeArray wi
         <*> Call.freezeArray vs
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/sgeesx.f>
geesx ::
   Char {- ^ jobvs -} ->
   Char {- ^ sort -} ->
   FunPtr (Ptr Float -> Ptr Float -> IO Bool) {- ^ select -} ->
   Char {- ^ sense -} ->
   IOCArray (Int,Int) Float {- ^ a -} ->
   Int {- ^ ldvs -} ->
   Int {- ^ lwork -} ->
   Int {- ^ liwork -} ->
   IO (Int, CArray Int Float, CArray Int Float, CArray (Int,Int) Float, Float, Float, Int)
geesx jobvs sort select sense a ldvs lwork liwork = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds a
   let n = aDim0
   let lda = aDim1
   wr <- Call.newArray1 n
   wi <- Call.newArray1 n
   vs <- Call.newArray2 n ldvs
   work <- Call.newArray1 (maximum[1,lwork])
   iwork <- Call.newArray1 (maximum[1,liwork])
   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
      wrPtr <- Call.ioarray wr
      wiPtr <- Call.ioarray wi
      vsPtr <- Call.ioarray vs
      ldvsPtr <- Call.cint ldvs
      rcondePtr <- Call.alloca
      rcondvPtr <- Call.alloca
      workPtr <- Call.ioarray work
      lworkPtr <- Call.cint lwork
      iworkPtr <- Call.ioarray iwork
      liworkPtr <- Call.cint liwork
      bworkPtr <- Call.ioarray bwork
      infoPtr <- Call.alloca
      liftIO $ FFI.geesx jobvsPtr sortPtr selectPtr sensePtr nPtr aPtr ldaPtr sdimPtr wrPtr wiPtr vsPtr ldvsPtr rcondePtr rcondvPtr workPtr lworkPtr iworkPtr liworkPtr bworkPtr infoPtr
      liftIO $ pure (,,,,,,)
         <*> fmap fromIntegral (peek sdimPtr)
         <*> Call.freezeArray wr
         <*> Call.freezeArray wi
         <*> 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/sgeev.f>
geev ::
   Char {- ^ jobvl -} ->
   Char {- ^ jobvr -} ->
   IOCArray (Int,Int) Float {- ^ a -} ->
   Int {- ^ ldvl -} ->
   Int {- ^ ldvr -} ->
   Int {- ^ lwork -} ->
   IO (CArray Int Float, CArray Int Float, CArray (Int,Int) Float, CArray (Int,Int) Float, Int)
geev jobvl jobvr a ldvl ldvr lwork = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds a
   let n = aDim0
   let lda = aDim1
   wr <- Call.newArray1 n
   wi <- Call.newArray1 n
   vl <- Call.newArray2 n ldvl
   vr <- Call.newArray2 n ldvr
   work <- Call.newArray1 (maximum[1,lwork])
   evalContT $ do
      jobvlPtr <- Call.char jobvl
      jobvrPtr <- Call.char jobvr
      nPtr <- Call.cint n
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      wrPtr <- Call.ioarray wr
      wiPtr <- Call.ioarray wi
      vlPtr <- Call.ioarray vl
      ldvlPtr <- Call.cint ldvl
      vrPtr <- Call.ioarray vr
      ldvrPtr <- Call.cint ldvr
      workPtr <- Call.ioarray work
      lworkPtr <- Call.cint lwork
      infoPtr <- Call.alloca
      liftIO $ FFI.geev jobvlPtr jobvrPtr nPtr aPtr ldaPtr wrPtr wiPtr vlPtr ldvlPtr vrPtr ldvrPtr workPtr lworkPtr infoPtr
      liftIO $ pure (,,,,)
         <*> Call.freezeArray wr
         <*> Call.freezeArray wi
         <*> Call.freezeArray vl
         <*> Call.freezeArray vr
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/sgeevx.f>
geevx ::
   Char {- ^ balanc -} ->
   Char {- ^ jobvl -} ->
   Char {- ^ jobvr -} ->
   Char {- ^ sense -} ->
   IOCArray (Int,Int) Float {- ^ a -} ->
   Int {- ^ ldvl -} ->
   Int {- ^ ldvr -} ->
   Int {- ^ lwork -} ->
   IO (CArray Int Float, CArray Int Float, CArray (Int,Int) Float, CArray (Int,Int) Float, Int, Int, CArray Int Float, Float, CArray Int Float, CArray Int Float, Int)
geevx balanc jobvl jobvr sense a ldvl ldvr lwork = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds a
   let n = aDim0
   let lda = aDim1
   wr <- Call.newArray1 n
   wi <- 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])
   iwork <- Call.newArray1 (2*n-2)
   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
      wrPtr <- Call.ioarray wr
      wiPtr <- Call.ioarray wi
      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
      iworkPtr <- Call.ioarray iwork
      infoPtr <- Call.alloca
      liftIO $ FFI.geevx balancPtr jobvlPtr jobvrPtr sensePtr nPtr aPtr ldaPtr wrPtr wiPtr vlPtr ldvlPtr vrPtr ldvrPtr iloPtr ihiPtr scalePtr abnrmPtr rcondePtr rcondvPtr workPtr lworkPtr iworkPtr infoPtr
      liftIO $ pure (,,,,,,,,,,)
         <*> Call.freezeArray wr
         <*> Call.freezeArray wi
         <*> 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/sgehd2.f>
gehd2 ::
   Int {- ^ ilo -} ->
   Int {- ^ ihi -} ->
   IOCArray (Int,Int) Float {- ^ a -} ->
   IO (CArray Int Float, Int)
gehd2 ilo ihi a = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds 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/sgehrd.f>
gehrd ::
   Int {- ^ ilo -} ->
   Int {- ^ ihi -} ->
   IOCArray (Int,Int) Float {- ^ a -} ->
   Int {- ^ lwork -} ->
   IO (CArray Int Float, Int)
gehrd ilo ihi a lwork = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds 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/sgejsv.f>
gejsv ::
   Char {- ^ joba -} ->
   Char {- ^ jobu -} ->
   Char {- ^ jobv -} ->
   Char {- ^ jobr -} ->
   Char {- ^ jobt -} ->
   Char {- ^ jobp -} ->
   Int {- ^ m -} ->
   IOCArray (Int,Int) Float {- ^ a -} ->
   Int {- ^ ldu -} ->
   Int {- ^ ldv -} ->
   Int {- ^ lwork -} ->
   IO (CArray Int Float, CArray (Int,Int) Float, CArray (Int,Int) Float, Int)
gejsv joba jobu jobv jobr jobt jobp m a ldu ldv lwork = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds a
   let n = aDim0
   let lda = aDim1
   sva <- Call.newArray1 n
   u <- Call.newArray2 n ldu
   v <- Call.newArray2 n ldv
   work <- Call.newArray1 lwork
   iwork <- Call.newArray1 (m+3*n)
   evalContT $ do
      jobaPtr <- Call.char joba
      jobuPtr <- Call.char jobu
      jobvPtr <- Call.char jobv
      jobrPtr <- Call.char jobr
      jobtPtr <- Call.char jobt
      jobpPtr <- Call.char jobp
      mPtr <- Call.cint m
      nPtr <- Call.cint n
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      svaPtr <- Call.ioarray sva
      uPtr <- Call.ioarray u
      lduPtr <- Call.cint ldu
      vPtr <- Call.ioarray v
      ldvPtr <- Call.cint ldv
      workPtr <- Call.ioarray work
      lworkPtr <- Call.cint lwork
      iworkPtr <- Call.ioarray iwork
      infoPtr <- Call.alloca
      liftIO $ FFI.gejsv jobaPtr jobuPtr jobvPtr jobrPtr jobtPtr jobpPtr mPtr nPtr aPtr ldaPtr svaPtr uPtr lduPtr vPtr ldvPtr workPtr lworkPtr iworkPtr infoPtr
      liftIO $ pure (,,,)
         <*> Call.freezeArray sva
         <*> Call.freezeArray u
         <*> Call.freezeArray v
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/sgelq2.f>
gelq2 ::
   Int {- ^ m -} ->
   IOCArray (Int,Int) Float {- ^ a -} ->
   IO (CArray Int Float, Int)
gelq2 m a = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds 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/sgelqf.f>
gelqf ::
   Int {- ^ m -} ->
   IOCArray (Int,Int) Float {- ^ a -} ->
   Int {- ^ lwork -} ->
   IO (CArray Int Float, Int)
gelqf m a lwork = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds 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/sgels.f>
gels ::
   Char {- ^ trans -} ->
   Int {- ^ m -} ->
   IOCArray (Int,Int) Float {- ^ a -} ->
   IOCArray (Int,Int) Float {- ^ b -} ->
   Int {- ^ lwork -} ->
   IO (Int)
gels trans m a b lwork = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds a
   (bDim0,bDim1) <- Call.sizes2 <$> getBounds 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/sgelsd.f>
gelsd ::
   Int {- ^ m -} ->
   IOCArray (Int,Int) Float {- ^ a -} ->
   IOCArray (Int,Int) Float {- ^ b -} ->
   Float {- ^ rcond -} ->
   Int {- ^ lwork -} ->
   Int {- ^ liwork -} ->
   IO (CArray Int Float, Int, Int)
gelsd m a b rcond lwork liwork = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds a
   (bDim0,bDim1) <- Call.sizes2 <$> getBounds 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])
   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
      iworkPtr <- Call.ioarray iwork
      infoPtr <- Call.alloca
      liftIO $ FFI.gelsd mPtr nPtr nrhsPtr aPtr ldaPtr bPtr ldbPtr sPtr rcondPtr rankPtr workPtr lworkPtr 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/sgelss.f>
gelss ::
   Int {- ^ m -} ->
   IOCArray (Int,Int) Float {- ^ a -} ->
   IOCArray (Int,Int) Float {- ^ b -} ->
   Float {- ^ rcond -} ->
   Int {- ^ lwork -} ->
   IO (CArray Int Float, Int, Int)
gelss m a b rcond lwork = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds a
   (bDim0,bDim1) <- Call.sizes2 <$> getBounds 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])
   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
      infoPtr <- Call.alloca
      liftIO $ FFI.gelss mPtr nPtr nrhsPtr aPtr ldaPtr bPtr ldbPtr sPtr rcondPtr rankPtr workPtr lworkPtr 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/sgelsy.f>
gelsy ::
   Int {- ^ m -} ->
   IOCArray (Int,Int) Float {- ^ a -} ->
   IOCArray (Int,Int) Float {- ^ b -} ->
   IOCArray Int CInt {- ^ jpvt -} ->
   Float {- ^ rcond -} ->
   Int {- ^ lwork -} ->
   IO (Int, Int)
gelsy m a b jpvt rcond lwork = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds a
   (bDim0,bDim1) <- Call.sizes2 <$> getBounds b
   jpvtDim0 <- Call.sizes1 <$> getBounds 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])
   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
      infoPtr <- Call.alloca
      liftIO $ FFI.gelsy mPtr nPtr nrhsPtr aPtr ldaPtr bPtr ldbPtr jpvtPtr rcondPtr rankPtr workPtr lworkPtr 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/sgeql2.f>
geql2 ::
   Int {- ^ m -} ->
   IOCArray (Int,Int) Float {- ^ a -} ->
   IO (CArray Int Float, Int)
geql2 m a = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds 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/sgeqlf.f>
geqlf ::
   Int {- ^ m -} ->
   IOCArray (Int,Int) Float {- ^ a -} ->
   Int {- ^ lwork -} ->
   IO (CArray Int Float, Int)
geqlf m a lwork = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds 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/sgeqp3.f>
geqp3 ::
   Int {- ^ m -} ->
   IOCArray (Int,Int) Float {- ^ a -} ->
   IOCArray Int CInt {- ^ jpvt -} ->
   Int {- ^ lwork -} ->
   IO (CArray Int Float, Int)
geqp3 m a jpvt lwork = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds a
   jpvtDim0 <- Call.sizes1 <$> getBounds 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])
   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
      infoPtr <- Call.alloca
      liftIO $ FFI.geqp3 mPtr nPtr aPtr ldaPtr jpvtPtr 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/sgeqr2.f>
geqr2 ::
   Int {- ^ m -} ->
   IOCArray (Int,Int) Float {- ^ a -} ->
   IO (CArray Int Float, Int)
geqr2 m a = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds 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/sgeqr2p.f>
geqr2p ::
   Int {- ^ m -} ->
   IOCArray (Int,Int) Float {- ^ a -} ->
   IO (CArray Int Float, Int)
geqr2p m a = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds 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/sgeqrf.f>
geqrf ::
   Int {- ^ m -} ->
   IOCArray (Int,Int) Float {- ^ a -} ->
   Int {- ^ lwork -} ->
   IO (CArray Int Float, Int)
geqrf m a lwork = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds 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/sgeqrfp.f>
geqrfp ::
   Int {- ^ m -} ->
   IOCArray (Int,Int) Float {- ^ a -} ->
   Int {- ^ lwork -} ->
   IO (CArray Int Float, Int)
geqrfp m a lwork = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds 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/sgerfs.f>
gerfs ::
   Char {- ^ trans -} ->
   CArray (Int,Int) Float {- ^ a -} ->
   CArray (Int,Int) Float {- ^ af -} ->
   CArray Int CInt {- ^ ipiv -} ->
   CArray (Int,Int) Float {- ^ b -} ->
   IOCArray (Int,Int) Float {- ^ x -} ->
   IO (CArray Int Float, CArray Int Float, Int)
gerfs trans a af ipiv b x = do
   let (aDim0,aDim1) = Call.sizes2 $ bounds a
   let (afDim0,afDim1) = Call.sizes2 $ bounds af
   let ipivDim0 = Call.sizes1 $ bounds ipiv
   let (bDim0,bDim1) = Call.sizes2 $ bounds b
   (xDim0,xDim1) <- Call.sizes2 <$> getBounds 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 (3*n)
   iwork <- 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
      iworkPtr <- Call.ioarray iwork
      infoPtr <- Call.alloca
      liftIO $ FFI.gerfs transPtr nPtr nrhsPtr aPtr ldaPtr afPtr ldafPtr ipivPtr bPtr ldbPtr xPtr ldxPtr ferrPtr berrPtr workPtr iworkPtr 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/sgerq2.f>
gerq2 ::
   Int {- ^ m -} ->
   IOCArray (Int,Int) Float {- ^ a -} ->
   IO (CArray Int Float, Int)
gerq2 m a = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds 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/sgerqf.f>
gerqf ::
   Int {- ^ m -} ->
   IOCArray (Int,Int) Float {- ^ a -} ->
   Int {- ^ lwork -} ->
   IO (CArray Int Float, Int)
gerqf m a lwork = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds 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/sgesc2.f>
gesc2 ::
   CArray (Int,Int) Float {- ^ a -} ->
   IOCArray Int Float {- ^ rhs -} ->
   CArray Int CInt {- ^ ipiv -} ->
   CArray Int CInt {- ^ jpiv -} ->
   IO (Float)
gesc2 a rhs ipiv jpiv = do
   let (aDim0,aDim1) = Call.sizes2 $ bounds a
   rhsDim0 <- Call.sizes1 <$> getBounds rhs
   let ipivDim0 = Call.sizes1 $ bounds ipiv
   let jpivDim0 = Call.sizes1 $ bounds jpiv
   let n = aDim0
   let lda = aDim1
   Call.assert "gesc2: n == rhsDim0" (n == 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/sgesdd.f>
gesdd ::
   Char {- ^ jobz -} ->
   Int {- ^ m -} ->
   IOCArray (Int,Int) Float {- ^ a -} ->
   Int {- ^ ucol -} ->
   Int {- ^ ldu -} ->
   Int {- ^ ldvt -} ->
   Int {- ^ lwork -} ->
   IO (CArray Int Float, CArray (Int,Int) Float, CArray (Int,Int) Float, Int)
gesdd jobz m a ucol ldu ldvt lwork = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds 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])
   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
      iworkPtr <- Call.ioarray iwork
      infoPtr <- Call.alloca
      liftIO $ FFI.gesdd jobzPtr mPtr nPtr aPtr ldaPtr sPtr uPtr lduPtr vtPtr ldvtPtr workPtr lworkPtr 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/sgesv.f>
gesv ::
   IOCArray (Int,Int) Float {- ^ a -} ->
   IOCArray (Int,Int) Float {- ^ b -} ->
   IO (CArray Int CInt, Int)
gesv a b = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds a
   (bDim0,bDim1) <- Call.sizes2 <$> getBounds 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/sgesvd.f>
gesvd ::
   Char {- ^ jobu -} ->
   Char {- ^ jobvt -} ->
   Int {- ^ m -} ->
   IOCArray (Int,Int) Float {- ^ a -} ->
   Int {- ^ ucol -} ->
   Int {- ^ ldu -} ->
   Int {- ^ ldvt -} ->
   Int {- ^ lwork -} ->
   IO (CArray Int Float, CArray (Int,Int) Float, CArray (Int,Int) Float, Int)
gesvd jobu jobvt m a ucol ldu ldvt lwork = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds 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])
   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
      infoPtr <- Call.alloca
      liftIO $ FFI.gesvd jobuPtr jobvtPtr mPtr nPtr aPtr ldaPtr sPtr uPtr lduPtr vtPtr ldvtPtr workPtr lworkPtr 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/sgesvj.f>
gesvj ::
   Char {- ^ joba -} ->
   Char {- ^ jobu -} ->
   Char {- ^ jobv -} ->
   Int {- ^ m -} ->
   IOCArray (Int,Int) Float {- ^ a -} ->
   Int {- ^ mv -} ->
   IOCArray (Int,Int) Float {- ^ v -} ->
   IOCArray Int Float {- ^ work -} ->
   IO (CArray Int Float, Int)
gesvj joba jobu jobv m a mv v work = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds a
   (vDim0,vDim1) <- Call.sizes2 <$> getBounds v
   workDim0 <- Call.sizes1 <$> getBounds work
   let n = aDim0
   let lda = aDim1
   let ldv = vDim1
   let lwork = workDim0
   Call.assert "gesvj: n == vDim0" (n == vDim0)
   sva <- Call.newArray1 n
   evalContT $ do
      jobaPtr <- Call.char joba
      jobuPtr <- Call.char jobu
      jobvPtr <- Call.char jobv
      mPtr <- Call.cint m
      nPtr <- Call.cint n
      aPtr <- Call.ioarray a
      ldaPtr <- Call.cint lda
      svaPtr <- Call.ioarray sva
      mvPtr <- Call.cint mv
      vPtr <- Call.ioarray v
      ldvPtr <- Call.cint ldv
      workPtr <- Call.ioarray work
      lworkPtr <- Call.cint lwork
      infoPtr <- Call.alloca
      liftIO $ FFI.gesvj jobaPtr jobuPtr jobvPtr mPtr nPtr aPtr ldaPtr svaPtr mvPtr vPtr ldvPtr workPtr lworkPtr infoPtr
      liftIO $ pure (,)
         <*> Call.freezeArray sva
         <*> fmap fromIntegral (peek infoPtr)

-- | <http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/sgesvx.f>
gesvx ::
   Char {- ^ fact -} ->
   Char {- ^ trans -} ->
   IOCArray (Int,Int) Float {- ^ a -} ->
   IOCArray (Int,Int) Float {- ^ af -} ->
   IOCArray Int CInt {- ^ ipiv -} ->
   Char {- ^ equed -} ->
   IOCArray Int Float {- ^ r -} ->
   IOCArray Int Float {- ^ c -} ->
   IOCArray (Int,Int) Float {- ^ b -} ->
   Int {- ^ ldx -} ->
   IO (Char, CArray (Int,Int) Float, Float, CArray Int Float, CArray Int Float, Int)
gesvx fact trans a af ipiv equed r c b ldx = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds a
   (afDim0,afDim1) <- Call.sizes2 <$> getBounds af
   ipivDim0 <- Call.sizes1 <$> getBounds ipiv
   rDim0 <- Call.sizes1 <$> getBounds r
   cDim0 <- Call.sizes1 <$> getBounds c
   (bDim0,bDim1) <- Call.sizes2 <$> getBounds 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 (4*n)
   iwork <- Call.newArray1 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
      iworkPtr <- Call.ioarray iwork
      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 iworkPtr 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/sgetc2.f>
getc2 ::
   IOCArray (Int,Int) Float {- ^ a -} ->
   IO (CArray Int CInt, CArray Int CInt, Int)
getc2 a = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds 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/sgetf2.f>
getf2 ::
   Int {- ^ m -} ->
   IOCArray (Int,Int) Float {- ^ a -} ->
   IO (CArray Int CInt, Int)
getf2 m a = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds 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/sgetrf.f>
getrf ::
   Int {- ^ m -} ->
   IOCArray (Int,Int) Float {- ^ a -} ->
   IO (CArray Int CInt, Int)
getrf m a = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds 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/sgetri.f>
getri ::
   IOCArray (Int,Int) Float {- ^ a -} ->
   CArray Int CInt {- ^ ipiv -} ->
   Int {- ^ lwork -} ->
   IO (Int)
getri a ipiv lwork = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds a
   let ipivDim0 = Call.sizes1 $ bounds 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/sgetrs.f>
getrs ::
   Char {- ^ trans -} ->
   CArray (Int,Int) Float {- ^ a -} ->
   CArray Int CInt {- ^ ipiv -} ->
   IOCArray (Int,Int) Float {- ^ b -} ->
   IO (Int)
getrs trans a ipiv b = do
   let (aDim0,aDim1) = Call.sizes2 $ bounds a
   let ipivDim0 = Call.sizes1 $ bounds ipiv
   (bDim0,bDim1) <- Call.sizes2 <$> getBounds 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/sggbak.f>
ggbak ::
   Char {- ^ job -} ->
   Char {- ^ side -} ->
   Int {- ^ ilo -} ->
   Int {- ^ ihi -} ->
   CArray Int Float {- ^ lscale -} ->
   CArray Int Float {- ^ rscale -} ->
   IOCArray (Int,Int) Float {- ^ v -} ->
   IO (Int)
ggbak job side ilo ihi lscale rscale v = do
   let lscaleDim0 = Call.sizes1 $ bounds lscale
   let rscaleDim0 = Call.sizes1 $ bounds rscale
   (vDim0,vDim1) <- Call.sizes2 <$> getBounds 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/sggbal.f>
ggbal ::
   Char {- ^ job -} ->
   IOCArray (Int,Int) Float {- ^ a -} ->
   IOCArray (Int,Int) Float {- ^ b -} ->
   Int {- ^ lwork -} ->
   IO (Int, Int, CArray Int Float, CArray Int Float, Int)
ggbal job a b lwork = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds a
   (bDim0,bDim1) <- Call.sizes2 <$> getBounds 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/sgges.f>
gges ::
   Char {- ^ jobvsl -} ->
   Char {- ^ jobvsr -} ->
   Char {- ^ sort -} ->
   FunPtr (Ptr Float -> Ptr Float -> Ptr Float -> IO Bool) {- ^ selctg -} ->
   IOCArray (Int,Int) Float {- ^ a -} ->
   IOCArray (Int,Int) Float {- ^ b -} ->
   Int {- ^ ldvsl -} ->
   Int {- ^ ldvsr -} ->
   Int {- ^ lwork -} ->
   IO (Int, CArray Int Float, CArray Int Float, CArray Int Float, CArray (Int,Int) Float, CArray (Int,Int) Float, Int)
gges jobvsl jobvsr sort selctg a b ldvsl ldvsr lwork = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds a
   (bDim0,bDim1) <- Call.sizes2 <$> getBounds b
   let n = aDim0
   let lda = aDim1
   let ldb = bDim1
   Call.assert "gges: n == bDim0" (n == bDim0)
   alphar <- Call.newArray1 n
   alphai <- Call.newArray1 n
   beta <- Call.newArray1 n
   vsl <- Call.newArray2 n ldvsl
   vsr <- Call.newArray2 n ldvsr
   work <- Call.newArray1 (maximum[1,lwork])
   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
      alpharPtr <- Call.ioarray alphar
      alphaiPtr <- Call.ioarray alphai
      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
      bworkPtr <- Call.ioarray bwork
      infoPtr <- Call.alloca
      liftIO $ FFI.gges jobvslPtr jobvsrPtr sortPtr selctgPtr nPtr aPtr ldaPtr bPtr ldbPtr sdimPtr alpharPtr alphaiPtr betaPtr vslPtr ldvslPtr vsrPtr ldvsrPtr workPtr lworkPtr bworkPtr infoPtr
      liftIO $ pure (,,,,,,)
         <*> fmap fromIntegral (peek sdimPtr)
         <*> Call.freezeArray alphar
         <*> Call.freezeArray alphai
         <*> 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/sggesx.f>
ggesx ::
   Char {- ^ jobvsl -} ->
   Char {- ^ jobvsr -} ->
   Char {- ^ sort -} ->
   FunPtr (Ptr Float -> Ptr Float -> Ptr Float -> IO Bool) {- ^ selctg -} ->
   Char {- ^ sense -} ->
   IOCArray (Int,Int) Float {- ^ a -} ->
   IOCArray (Int,Int) Float {- ^ b -} ->
   Int {- ^ ldvsl -} ->
   Int {- ^ ldvsr -} ->
   Int {- ^ lwork -} ->
   Int {- ^ liwork -} ->
   IO (Int, CArray Int Float, CArray Int Float, CArray Int Float, CArray (Int,Int) Float, CArray (Int,Int) Float, CArray Int Float, CArray Int Float, Int)
ggesx jobvsl jobvsr sort selctg sense a b ldvsl ldvsr lwork liwork = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds a
   (bDim0,bDim1) <- Call.sizes2 <$> getBounds b
   let n = aDim0
   let lda = aDim1
   let ldb = bDim1
   Call.assert "ggesx: n == bDim0" (n == bDim0)
   alphar <- Call.newArray1 n
   alphai <- 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])
   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
      alpharPtr <- Call.ioarray alphar
      alphaiPtr <- Call.ioarray alphai
      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
      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 alpharPtr alphaiPtr betaPtr vslPtr ldvslPtr vsrPtr ldvsrPtr rcondePtr rcondvPtr workPtr lworkPtr iworkPtr liworkPtr bworkPtr infoPtr
      liftIO $ pure (,,,,,,,,)
         <*> fmap fromIntegral (peek sdimPtr)
         <*> Call.freezeArray alphar
         <*> Call.freezeArray alphai
         <*> 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/sggev.f>
ggev ::
   Char {- ^ jobvl -} ->
   Char {- ^ jobvr -} ->
   IOCArray (Int,Int) Float {- ^ a -} ->
   IOCArray (Int,Int) Float {- ^ b -} ->
   Int {- ^ ldvl -} ->
   Int {- ^ ldvr -} ->
   Int {- ^ lwork -} ->
   IO (CArray Int Float, CArray Int Float, CArray Int Float, CArray (Int,Int) Float, CArray (Int,Int) Float, Int)
ggev jobvl jobvr a b ldvl ldvr lwork = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds a
   (bDim0,bDim1) <- Call.sizes2 <$> getBounds b
   let n = aDim0
   let lda = aDim1
   let ldb = bDim1
   Call.assert "ggev: n == bDim0" (n == bDim0)
   alphar <- Call.newArray1 n
   alphai <- Call.newArray1 n
   beta <- Call.newArray1 n
   vl <- Call.newArray2 n ldvl
   vr <- Call.newArray2 n ldvr
   work <- Call.newArray1 (maximum[1,lwork])
   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
      alpharPtr <- Call.ioarray alphar
      alphaiPtr <- Call.ioarray alphai
      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
      infoPtr <- Call.alloca
      liftIO $ FFI.ggev jobvlPtr jobvrPtr nPtr aPtr ldaPtr bPtr ldbPtr alpharPtr alphaiPtr betaPtr vlPtr ldvlPtr vrPtr ldvrPtr workPtr lworkPtr infoPtr
      liftIO $ pure (,,,,,)
         <*> Call.freezeArray alphar
         <*> Call.freezeArray alphai
         <*> 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/sggevx.f>
ggevx ::
   Char {- ^ balanc -} ->
   Char {- ^ jobvl -} ->
   Char {- ^ jobvr -} ->
   Char {- ^ sense -} ->
   IOCArray (Int,Int) Float {- ^ a -} ->
   IOCArray (Int,Int) Float {- ^ b -} ->
   Int {- ^ ldvl -} ->
   Int {- ^ ldvr -} ->
   Int {- ^ lwork -} ->
   IO (CArray Int Float, CArray Int Float, CArray Int Float, CArray (Int,Int) Float, CArray (Int,Int) Float, Int, Int, CArray Int Float, CArray Int Float, Float, Float, CArray Int Float, CArray Int Float, Int)
ggevx balanc jobvl jobvr sense a b ldvl ldvr lwork = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds a
   (bDim0,bDim1) <- Call.sizes2 <$> getBounds b
   let n = aDim0
   let lda = aDim1
   let ldb = bDim1
   Call.assert "ggevx: n == bDim0" (n == bDim0)
   alphar <- Call.newArray1 n
   alphai <- 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])
   iwork <- Call.newArray1 (n+6)
   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
      alpharPtr <- Call.ioarray alphar
      alphaiPtr <- Call.ioarray alphai
      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
      iworkPtr <- Call.ioarray iwork
      bworkPtr <- Call.ioarray bwork
      infoPtr <- Call.alloca
      liftIO $ FFI.ggevx balancPtr jobvlPtr jobvrPtr sensePtr nPtr aPtr ldaPtr bPtr ldbPtr alpharPtr alphaiPtr betaPtr vlPtr ldvlPtr vrPtr ldvrPtr iloPtr ihiPtr lscalePtr rscalePtr abnrmPtr bbnrmPtr rcondePtr rcondvPtr workPtr lworkPtr iworkPtr bworkPtr infoPtr
      liftIO $ pure (,,,,,,,,,,,,,)
         <*> Call.freezeArray alphar
         <*> Call.freezeArray alphai
         <*> 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/sggglm.f>
ggglm ::
   IOCArray (Int,Int) Float {- ^ a -} ->
   IOCArray (Int,Int) Float {- ^ b -} ->
   IOCArray Int Float {- ^ d -} ->
   Int {- ^ lwork -} ->
   IO (CArray Int Float, CArray Int Float, Int)
ggglm a b d lwork = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds a
   (bDim0,bDim1) <- Call.sizes2 <$> getBounds b
   dDim0 <- Call.sizes1 <$> getBounds 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/sgghrd.f>
gghrd ::
   Char {- ^ compq -} ->
   Char {- ^ compz -} ->
   Int {- ^ ilo -} ->
   Int {- ^ ihi -} ->
   IOCArray (Int,Int) Float {- ^ a -} ->
   IOCArray (Int,Int) Float {- ^ b -} ->
   IOCArray (Int,Int) Float {- ^ q -} ->
   IOCArray (Int,Int) Float {- ^ z -} ->
   IO (Int)
gghrd compq compz ilo ihi a b q z = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds a
   (bDim0,bDim1) <- Call.sizes2 <$> getBounds b
   (qDim0,qDim1) <- Call.sizes2 <$> getBounds q
   (zDim0,zDim1) <- Call.sizes2 <$> getBounds 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/sgglse.f>
gglse ::
   IOCArray (Int,Int) Float {- ^ a -} ->
   IOCArray (Int,Int) Float {- ^ b -} ->
   IOCArray Int Float {- ^ c -} ->
   IOCArray Int Float {- ^ d -} ->
   Int {- ^ lwork -} ->
   IO (CArray Int Float, Int)
gglse a b c d lwork = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds a
   (bDim0,bDim1) <- Call.sizes2 <$> getBounds b
   cDim0 <- Call.sizes1 <$> getBounds c
   dDim0 <- Call.sizes1 <$> getBounds 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/sggqrf.f>
ggqrf ::
   Int {- ^ n -} ->
   IOCArray (Int,Int) Float {- ^ a -} ->
   IOCArray (Int,Int) Float {- ^ b -} ->
   Int {- ^ lwork -} ->
   IO (CArray Int Float, CArray Int Float, Int)
ggqrf n a b lwork = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds a
   (bDim0,bDim1) <- Call.sizes2 <$> getBounds 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/sggrqf.f>
ggrqf ::
   Int {- ^ m -} ->
   Int {- ^ p -} ->
   IOCArray (Int,Int) Float {- ^ a -} ->
   IOCArray (Int,Int) Float {- ^ b -} ->
   Int {- ^ lwork -} ->
   IO (CArray Int Float, CArray Int Float, Int)
ggrqf m p a b lwork = do
   (aDim0,aDim1) <- Call.sizes2 <$> getBounds a
   (bDim0,bDim1) <- Call.sizes2 <$> getBounds 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 <-<