module Numeric.LAPACK.Permutation (
   Plain.Permutation,
   Plain.Shape(Shape), Plain.Element(Element),
   Plain.size,
   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 = ArrMatrix.lift0 . 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 inverted = ArrMatrix.lift1 . Plain.apply inverted