module Numeric.LAPACK.Permutation (
   Plain.Permutation,
   Plain.Shape(Shape), Plain.Element(Element),
   Plain.size,
   Plain.identity,
   Mod.Inversion(NonInverted,Inverted),
   Plain.fromPivots,
   Plain.toPivots,
   toMatrix,
   Plain.Sign(Positive,Negative),
   Plain.determinant,
   Plain.numberFromSign,
   Plain.transpose,
   Plain.inversionFromTransposition,
   Plain.multiply,
   apply,
   ) where

import qualified Numeric.LAPACK.Permutation.Private as Plain
import qualified Numeric.LAPACK.Matrix.Array as ArrMatrix
import qualified Numeric.LAPACK.Matrix.Modifier as Mod
import qualified Numeric.LAPACK.Matrix.Extent.Private as Extent
import Numeric.LAPACK.Permutation.Private (Permutation)
import Numeric.LAPACK.Matrix.Array (Full, Square)

import qualified Numeric.Netlib.Class as Class

import qualified Data.Array.Comfort.Shape as Shape


toMatrix :: (Shape.C sh, Class.Floating a) => Permutation sh -> Square sh a
toMatrix :: Permutation sh -> Square sh a
toMatrix = Array (Square sh) a -> Square sh a
forall shA a. Array shA a -> ArrayMatrix shA a
ArrMatrix.lift0 (Array (Square sh) a -> Square sh a)
-> (Permutation sh -> Array (Square sh) a)
-> Permutation sh
-> Square sh a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Permutation sh -> Array (Square sh) a
forall sh a. (C sh, Floating a) => Permutation sh -> Square sh a
Plain.toMatrix

apply ::
   (Extent.C vert, Extent.C horiz,
    Shape.C height, Eq height, Shape.C width, Class.Floating a) =>
   Mod.Inversion -> Permutation height ->
   Full vert horiz height width a ->
   Full vert horiz height width a
apply :: Inversion
-> Permutation height
-> Full vert horiz height width a
-> Full vert horiz height width a
apply Inversion
inverted = (Array (Full vert horiz height width) a
 -> Array (Full vert horiz height width) a)
-> Full vert horiz height width a -> Full vert horiz height width a
forall shA a shB b.
(Array shA a -> Array shB b)
-> ArrayMatrix shA a -> ArrayMatrix shB b
ArrMatrix.lift1 ((Array (Full vert horiz height width) a
  -> Array (Full vert horiz height width) a)
 -> Full vert horiz height width a
 -> Full vert horiz height width a)
-> (Permutation height
    -> Array (Full vert horiz height width) a
    -> Array (Full vert horiz height width) a)
-> Permutation height
-> Full vert horiz height width a
-> Full vert horiz height width a
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Inversion
-> Permutation height
-> Array (Full vert horiz height width) a
-> Array (Full vert horiz height width) a
forall vert horiz height width a.
(C vert, C horiz, C height, Eq height, C width, Floating a) =>
Inversion
-> Permutation height
-> Full vert horiz height width a
-> Full vert horiz height width a
Plain.apply Inversion
inverted