lapack 0.4 → 0.4.1
raw patch · 41 files changed
+1087/−769 lines, 41 filesdep ~randomdep ~transformersPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: random, transformers
API changes (from Hackage documentation)
- Numeric.LAPACK.Matrix.Array: instance (Numeric.LAPACK.Matrix.Array.MapExtent pack property lower upper, xl GHC.Types.~ (), xu GHC.Types.~ ()) => Numeric.LAPACK.Matrix.Type.MapExtent (Numeric.LAPACK.Matrix.Array.Array pack property) xl xu lower upper
- Numeric.LAPACK.Matrix.Array: instance (Numeric.LAPACK.Matrix.Extent.Private.Measure meas, Numeric.LAPACK.Matrix.Extent.Private.C vert, Numeric.LAPACK.Matrix.Extent.Private.C horiz, Data.Array.Comfort.Shape.C height, Data.Array.Comfort.Shape.C width, Foreign.Storable.Storable a, GHC.Show.Show height, GHC.Show.Show width, GHC.Show.Show a) => GHC.Show.Show (Numeric.LAPACK.Matrix.Type.Matrix (Numeric.LAPACK.Matrix.Array.Array pack prop) xl xu lower upper meas vert horiz height width a)
- Numeric.LAPACK.Matrix.Array: instance (Numeric.LAPACK.Matrix.Layout.Private.Packing pack, Numeric.LAPACK.Matrix.Shape.Omni.TriDiag diag, xl GHC.Types.~ (), xu GHC.Types.~ ()) => Numeric.LAPACK.Matrix.Type.MultiplySame (Numeric.LAPACK.Matrix.Array.Array pack diag) xl xu
- Numeric.LAPACK.Matrix.Array: instance (Type.Data.Bool.C neg, Type.Data.Bool.C zero, Type.Data.Bool.C pos) => Numeric.LAPACK.Matrix.Array.Additive (Numeric.LAPACK.Matrix.Shape.Omni.Hermitian neg zero pos)
- Numeric.LAPACK.Matrix.Array: instance (Type.Data.Bool.C neg, Type.Data.Bool.C zero, neg GHC.Types.~ pos) => Numeric.LAPACK.Matrix.Array.Subtractive (Numeric.LAPACK.Matrix.Shape.Omni.Hermitian neg zero pos)
- Numeric.LAPACK.Matrix.Array: instance (Type.Data.Num.Unary.Natural sub, Type.Data.Num.Unary.Natural super) => Numeric.LAPACK.Matrix.Array.MapExtent Numeric.LAPACK.Matrix.Layout.Private.Packed Numeric.LAPACK.Matrix.Shape.Omni.Arbitrary (Numeric.LAPACK.Matrix.Layout.Private.Bands sub) (Numeric.LAPACK.Matrix.Layout.Private.Bands super)
- Numeric.LAPACK.Matrix.Array: instance (zero GHC.Types.~ Type.Data.Bool.True, neg GHC.Types.~ pos, Type.Data.Bool.C pos) => Numeric.LAPACK.Matrix.Array.Homogeneous (Numeric.LAPACK.Matrix.Shape.Omni.Hermitian neg zero pos)
- Numeric.LAPACK.Matrix.Array: instance Numeric.LAPACK.Matrix.Array.Additive Numeric.LAPACK.Matrix.Shape.Omni.Arbitrary
- Numeric.LAPACK.Matrix.Array: instance Numeric.LAPACK.Matrix.Array.Additive Numeric.LAPACK.Matrix.Shape.Omni.Symmetric
- Numeric.LAPACK.Matrix.Array: instance Numeric.LAPACK.Matrix.Array.Homogeneous Numeric.LAPACK.Matrix.Shape.Omni.Arbitrary
- Numeric.LAPACK.Matrix.Array: instance Numeric.LAPACK.Matrix.Array.Homogeneous Numeric.LAPACK.Matrix.Shape.Omni.Symmetric
- Numeric.LAPACK.Matrix.Array: instance Numeric.LAPACK.Matrix.Array.MapExtent Numeric.LAPACK.Matrix.Layout.Private.Unpacked Numeric.LAPACK.Matrix.Shape.Omni.Arbitrary Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Layout.Private.Filled
- Numeric.LAPACK.Matrix.Array: instance Numeric.LAPACK.Matrix.Array.Scale Numeric.LAPACK.Matrix.Shape.Omni.Arbitrary
- Numeric.LAPACK.Matrix.Array: instance Numeric.LAPACK.Matrix.Array.Scale Numeric.LAPACK.Matrix.Shape.Omni.Symmetric
- Numeric.LAPACK.Matrix.Array: instance Numeric.LAPACK.Matrix.Array.Subtractive Numeric.LAPACK.Matrix.Shape.Omni.Arbitrary
- Numeric.LAPACK.Matrix.Array: instance Numeric.LAPACK.Matrix.Array.Subtractive Numeric.LAPACK.Matrix.Shape.Omni.Symmetric
- Numeric.LAPACK.Matrix.Array: instance Numeric.LAPACK.Matrix.Type.Box (Numeric.LAPACK.Matrix.Array.Array pack property)
- Numeric.LAPACK.Matrix.Array: instance Numeric.LAPACK.Matrix.Type.FormatMatrix (Numeric.LAPACK.Matrix.Array.Array pack property)
- Numeric.LAPACK.Matrix.Array: instance Numeric.LAPACK.Matrix.Type.NFData (Numeric.LAPACK.Matrix.Array.Array pack property)
- Numeric.LAPACK.Matrix.Array: instance Numeric.LAPACK.Matrix.Type.ToQuadratic (Numeric.LAPACK.Matrix.Array.Array pack property)
- Numeric.LAPACK.Matrix.Array: instance Numeric.LAPACK.Matrix.Type.Transpose (Numeric.LAPACK.Matrix.Array.Array pack property)
- Numeric.LAPACK.Matrix.Function: instance (neg GHC.Types.~ Type.Data.Bool.False, Type.Data.Bool.C zero, Type.Data.Bool.C pos) => Numeric.LAPACK.Matrix.Function.SqRt (Numeric.LAPACK.Matrix.Shape.Omni.Hermitian neg zero pos)
- Numeric.LAPACK.Matrix.Function: instance (neg GHC.Types.~ Type.Data.Bool.True, zero GHC.Types.~ Type.Data.Bool.True, pos GHC.Types.~ Type.Data.Bool.True) => Numeric.LAPACK.Matrix.Function.Exp (Numeric.LAPACK.Matrix.Shape.Omni.Hermitian neg zero pos)
- Numeric.LAPACK.Matrix.Function: instance (neg GHC.Types.~ Type.Data.Bool.True, zero GHC.Types.~ Type.Data.Bool.True, pos GHC.Types.~ Type.Data.Bool.True) => Numeric.LAPACK.Matrix.Function.LiftReal (Numeric.LAPACK.Matrix.Shape.Omni.Hermitian neg zero pos)
- Numeric.LAPACK.Matrix.Function: instance (neg GHC.Types.~ Type.Data.Bool.True, zero GHC.Types.~ Type.Data.Bool.True, pos GHC.Types.~ Type.Data.Bool.True) => Numeric.LAPACK.Matrix.Function.Log (Numeric.LAPACK.Matrix.Shape.Omni.Hermitian neg zero pos)
- Numeric.LAPACK.Matrix.Shape.Omni: instance (Numeric.LAPACK.Matrix.Extent.Private.Shape GHC.Types.~ meas, Numeric.LAPACK.Matrix.Extent.Private.Small GHC.Types.~ vert, Numeric.LAPACK.Matrix.Extent.Private.Small GHC.Types.~ horiz) => Numeric.LAPACK.Matrix.Shape.Omni.Cons Numeric.LAPACK.Matrix.Layout.Private.Packed Numeric.LAPACK.Matrix.Shape.Omni.Symmetric Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Layout.Private.Filled meas vert horiz
- Numeric.LAPACK.Matrix.Shape.Omni: instance (Numeric.LAPACK.Matrix.Layout.Private.Packing pack, Numeric.LAPACK.Matrix.Shape.Omni.TriDiag diag, height GHC.Types.~ width) => Numeric.LAPACK.Matrix.Shape.Omni.FromPlain pack diag Numeric.LAPACK.Matrix.Layout.Private.Empty Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Extent.Private.Shape Numeric.LAPACK.Matrix.Extent.Private.Small Numeric.LAPACK.Matrix.Extent.Private.Small height width
- Numeric.LAPACK.Matrix.Shape.Omni: instance (Numeric.LAPACK.Matrix.Layout.Private.Packing pack, Numeric.LAPACK.Matrix.Shape.Omni.TriDiag diag, height GHC.Types.~ width) => Numeric.LAPACK.Matrix.Shape.Omni.FromPlain pack diag Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Layout.Private.Empty Numeric.LAPACK.Matrix.Extent.Private.Shape Numeric.LAPACK.Matrix.Extent.Private.Small Numeric.LAPACK.Matrix.Extent.Private.Small height width
- Numeric.LAPACK.Matrix.Shape.Omni: instance (Numeric.LAPACK.Matrix.Layout.Private.Packing pack, Numeric.LAPACK.Matrix.Shape.Omni.TriDiag diag, height GHC.Types.~ width) => Numeric.LAPACK.Matrix.Shape.Omni.ToPlain pack diag Numeric.LAPACK.Matrix.Layout.Private.Empty Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Extent.Private.Shape Numeric.LAPACK.Matrix.Extent.Private.Small Numeric.LAPACK.Matrix.Extent.Private.Small height width
- Numeric.LAPACK.Matrix.Shape.Omni: instance (Numeric.LAPACK.Matrix.Layout.Private.Packing pack, Numeric.LAPACK.Matrix.Shape.Omni.TriDiag diag, height GHC.Types.~ width) => Numeric.LAPACK.Matrix.Shape.Omni.ToPlain pack diag Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Layout.Private.Empty Numeric.LAPACK.Matrix.Extent.Private.Shape Numeric.LAPACK.Matrix.Extent.Private.Small Numeric.LAPACK.Matrix.Extent.Private.Small height width
- Numeric.LAPACK.Matrix.Shape.Omni: instance (Numeric.LAPACK.Matrix.Layout.Private.Packing pack, Type.Data.Bool.C neg, Type.Data.Bool.C zero, Type.Data.Bool.C pos, height GHC.Types.~ width) => Numeric.LAPACK.Matrix.Shape.Omni.FromPlain pack (Numeric.LAPACK.Matrix.Shape.Omni.Hermitian neg zero pos) Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Extent.Private.Shape Numeric.LAPACK.Matrix.Extent.Private.Small Numeric.LAPACK.Matrix.Extent.Private.Small height width
- Numeric.LAPACK.Matrix.Shape.Omni: instance (Numeric.LAPACK.Matrix.Layout.Private.Packing pack, Type.Data.Bool.C neg, Type.Data.Bool.C zero, Type.Data.Bool.C pos, height GHC.Types.~ width) => Numeric.LAPACK.Matrix.Shape.Omni.ToPlain pack (Numeric.LAPACK.Matrix.Shape.Omni.Hermitian neg zero pos) Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Extent.Private.Shape Numeric.LAPACK.Matrix.Extent.Private.Small Numeric.LAPACK.Matrix.Extent.Private.Small height width
- Numeric.LAPACK.Matrix.Shape.Omni: instance (Numeric.LAPACK.Matrix.Layout.Private.Packing pack, height GHC.Types.~ width) => Numeric.LAPACK.Matrix.Shape.Omni.FromPlain pack Numeric.LAPACK.Matrix.Shape.Omni.Symmetric Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Extent.Private.Shape Numeric.LAPACK.Matrix.Extent.Private.Small Numeric.LAPACK.Matrix.Extent.Private.Small height width
- Numeric.LAPACK.Matrix.Shape.Omni: instance (Numeric.LAPACK.Matrix.Layout.Private.Packing pack, height GHC.Types.~ width) => Numeric.LAPACK.Matrix.Shape.Omni.ToPlain pack Numeric.LAPACK.Matrix.Shape.Omni.Symmetric Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Extent.Private.Shape Numeric.LAPACK.Matrix.Extent.Private.Small Numeric.LAPACK.Matrix.Extent.Private.Small height width
- Numeric.LAPACK.Matrix.Shape.Omni: instance (Numeric.LAPACK.Matrix.Shape.Omni.BandedTriangular sub super, Numeric.LAPACK.Matrix.Shape.Omni.BandedTriangular super sub, Numeric.LAPACK.Matrix.Extent.Private.Shape GHC.Types.~ meas, Numeric.LAPACK.Matrix.Extent.Private.Small GHC.Types.~ vert, Numeric.LAPACK.Matrix.Extent.Private.Small GHC.Types.~ horiz) => Numeric.LAPACK.Matrix.Shape.Omni.Cons Numeric.LAPACK.Matrix.Layout.Private.Packed Numeric.LAPACK.Matrix.Shape.Omni.Unit (Numeric.LAPACK.Matrix.Layout.Private.Bands sub) (Numeric.LAPACK.Matrix.Layout.Private.Bands super) meas vert horiz
- Numeric.LAPACK.Matrix.Shape.Omni: instance (Numeric.LAPACK.Matrix.Shape.Omni.BandedTriangular sub super, Numeric.LAPACK.Matrix.Shape.Omni.BandedTriangular super sub, height GHC.Types.~ width) => Numeric.LAPACK.Matrix.Shape.Omni.FromPlain Numeric.LAPACK.Matrix.Layout.Private.Packed Numeric.LAPACK.Matrix.Shape.Omni.Unit (Numeric.LAPACK.Matrix.Layout.Private.Bands sub) (Numeric.LAPACK.Matrix.Layout.Private.Bands super) Numeric.LAPACK.Matrix.Extent.Private.Shape Numeric.LAPACK.Matrix.Extent.Private.Small Numeric.LAPACK.Matrix.Extent.Private.Small height width
- Numeric.LAPACK.Matrix.Shape.Omni: instance (Numeric.LAPACK.Matrix.Shape.Omni.BandedTriangular sub super, Numeric.LAPACK.Matrix.Shape.Omni.BandedTriangular super sub, height GHC.Types.~ width) => Numeric.LAPACK.Matrix.Shape.Omni.ToPlain Numeric.LAPACK.Matrix.Layout.Private.Packed Numeric.LAPACK.Matrix.Shape.Omni.Unit (Numeric.LAPACK.Matrix.Layout.Private.Bands sub) (Numeric.LAPACK.Matrix.Layout.Private.Bands super) Numeric.LAPACK.Matrix.Extent.Private.Shape Numeric.LAPACK.Matrix.Extent.Private.Small Numeric.LAPACK.Matrix.Extent.Private.Small height width
- Numeric.LAPACK.Matrix.Shape.Omni: instance (Numeric.LAPACK.Matrix.Shape.Omni.TriDiag diag, Numeric.LAPACK.Matrix.Extent.Private.Shape GHC.Types.~ meas, Numeric.LAPACK.Matrix.Extent.Private.Small GHC.Types.~ vert, Numeric.LAPACK.Matrix.Extent.Private.Small GHC.Types.~ horiz) => Numeric.LAPACK.Matrix.Shape.Omni.Cons Numeric.LAPACK.Matrix.Layout.Private.Packed diag Numeric.LAPACK.Matrix.Layout.Private.Empty Numeric.LAPACK.Matrix.Layout.Private.Filled meas vert horiz
- Numeric.LAPACK.Matrix.Shape.Omni: instance (Numeric.LAPACK.Matrix.Shape.Omni.TriDiag diag, Numeric.LAPACK.Matrix.Extent.Private.Shape GHC.Types.~ meas, Numeric.LAPACK.Matrix.Extent.Private.Small GHC.Types.~ vert, Numeric.LAPACK.Matrix.Extent.Private.Small GHC.Types.~ horiz) => Numeric.LAPACK.Matrix.Shape.Omni.Cons Numeric.LAPACK.Matrix.Layout.Private.Packed diag Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Layout.Private.Empty meas vert horiz
- Numeric.LAPACK.Matrix.Shape.Omni: instance (Type.Data.Bool.C neg, Type.Data.Bool.C zero, Type.Data.Bool.C pos, Numeric.LAPACK.Matrix.Extent.Private.Shape GHC.Types.~ meas, Numeric.LAPACK.Matrix.Extent.Private.Small GHC.Types.~ vert, Numeric.LAPACK.Matrix.Extent.Private.Small GHC.Types.~ horiz) => Numeric.LAPACK.Matrix.Shape.Omni.Cons Numeric.LAPACK.Matrix.Layout.Private.Packed (Numeric.LAPACK.Matrix.Shape.Omni.Hermitian neg zero pos) Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Layout.Private.Filled meas vert horiz
- Numeric.LAPACK.Matrix.Shape.Omni: instance (Type.Data.Bool.C neg, Type.Data.Bool.C zero, Type.Data.Bool.C pos, Type.Data.Num.Unary.Natural sub, sub GHC.Types.~ super, Numeric.LAPACK.Matrix.Extent.Private.Shape GHC.Types.~ meas, Numeric.LAPACK.Matrix.Extent.Private.Small GHC.Types.~ vert, Numeric.LAPACK.Matrix.Extent.Private.Small GHC.Types.~ horiz) => Numeric.LAPACK.Matrix.Shape.Omni.Cons Numeric.LAPACK.Matrix.Layout.Private.Packed (Numeric.LAPACK.Matrix.Shape.Omni.Hermitian neg zero pos) (Numeric.LAPACK.Matrix.Layout.Private.Bands sub) (Numeric.LAPACK.Matrix.Layout.Private.Bands super) meas vert horiz
- Numeric.LAPACK.Matrix.Shape.Omni: instance (Type.Data.Bool.C neg, Type.Data.Bool.C zero, Type.Data.Bool.C pos, sub GHC.Types.~ super, Type.Data.Num.Unary.Natural super) => Numeric.LAPACK.Matrix.Shape.Omni.Quadratic Numeric.LAPACK.Matrix.Layout.Private.Packed (Numeric.LAPACK.Matrix.Shape.Omni.Hermitian neg zero pos) (Numeric.LAPACK.Matrix.Layout.Private.Bands sub) (Numeric.LAPACK.Matrix.Layout.Private.Bands super)
- Numeric.LAPACK.Matrix.Shape.Omni: instance (Type.Data.Num.Unary.Natural sub, sub GHC.Types.~ super, height GHC.Types.~ width, Type.Data.Bool.C neg, Type.Data.Bool.C zero, Type.Data.Bool.C pos) => Numeric.LAPACK.Matrix.Shape.Omni.FromPlain Numeric.LAPACK.Matrix.Layout.Private.Packed (Numeric.LAPACK.Matrix.Shape.Omni.Hermitian neg zero pos) (Numeric.LAPACK.Matrix.Layout.Private.Bands sub) (Numeric.LAPACK.Matrix.Layout.Private.Bands super) Numeric.LAPACK.Matrix.Extent.Private.Shape Numeric.LAPACK.Matrix.Extent.Private.Small Numeric.LAPACK.Matrix.Extent.Private.Small height width
- Numeric.LAPACK.Matrix.Shape.Omni: instance (Type.Data.Num.Unary.Natural sub, sub GHC.Types.~ super, height GHC.Types.~ width, Type.Data.Bool.C neg, Type.Data.Bool.C zero, Type.Data.Bool.C pos) => Numeric.LAPACK.Matrix.Shape.Omni.ToPlain Numeric.LAPACK.Matrix.Layout.Private.Packed (Numeric.LAPACK.Matrix.Shape.Omni.Hermitian neg zero pos) (Numeric.LAPACK.Matrix.Layout.Private.Bands sub) (Numeric.LAPACK.Matrix.Layout.Private.Bands super) Numeric.LAPACK.Matrix.Extent.Private.Shape Numeric.LAPACK.Matrix.Extent.Private.Small Numeric.LAPACK.Matrix.Extent.Private.Small height width
- Numeric.LAPACK.Matrix.Shape.Omni: instance (offDiag GHC.Types.~ Type.Data.Num.Unary.Literal.U0) => Numeric.LAPACK.Matrix.Shape.Omni.PowerStrip (Numeric.LAPACK.Matrix.Layout.Private.Bands offDiag)
- Numeric.LAPACK.Shape: instance GHC.Ix.Ix n => Numeric.LAPACK.Shape.Permutable (Data.Array.Comfort.Shape.Range n)
+ Numeric.LAPACK.Matrix: class Unpack typ
+ Numeric.LAPACK.Matrix.Array: identityFromShape :: (C sh, Floating a) => Quadratic pack property lower upper sh -> Quadratic pack property lower upper sh a
+ Numeric.LAPACK.Matrix.Diagonal: fromVector :: (C sh, Storable a) => Order -> Vector sh a -> Diagonal sh a
+ Numeric.LAPACK.Matrix.Function: instance (neg Data.Type.Equality.~ Type.Data.Bool.False, Type.Data.Bool.C zero, Type.Data.Bool.C pos) => Numeric.LAPACK.Matrix.Function.SqRt (Numeric.LAPACK.Matrix.Shape.Omni.Hermitian neg zero pos)
+ Numeric.LAPACK.Matrix.Function: instance (neg Data.Type.Equality.~ Type.Data.Bool.True, zero Data.Type.Equality.~ Type.Data.Bool.True, pos Data.Type.Equality.~ Type.Data.Bool.True) => Numeric.LAPACK.Matrix.Function.Exp (Numeric.LAPACK.Matrix.Shape.Omni.Hermitian neg zero pos)
+ Numeric.LAPACK.Matrix.Function: instance (neg Data.Type.Equality.~ Type.Data.Bool.True, zero Data.Type.Equality.~ Type.Data.Bool.True, pos Data.Type.Equality.~ Type.Data.Bool.True) => Numeric.LAPACK.Matrix.Function.LiftReal (Numeric.LAPACK.Matrix.Shape.Omni.Hermitian neg zero pos)
+ Numeric.LAPACK.Matrix.Function: instance (neg Data.Type.Equality.~ Type.Data.Bool.True, zero Data.Type.Equality.~ Type.Data.Bool.True, pos Data.Type.Equality.~ Type.Data.Bool.True) => Numeric.LAPACK.Matrix.Function.Log (Numeric.LAPACK.Matrix.Shape.Omni.Hermitian neg zero pos)
+ Numeric.LAPACK.Matrix.Shape.Omni: instance (Numeric.LAPACK.Matrix.Extent.Private.Shape Data.Type.Equality.~ meas, Numeric.LAPACK.Matrix.Extent.Private.Small Data.Type.Equality.~ vert, Numeric.LAPACK.Matrix.Extent.Private.Small Data.Type.Equality.~ horiz) => Numeric.LAPACK.Matrix.Shape.Omni.Cons Numeric.LAPACK.Matrix.Layout.Private.Packed Numeric.LAPACK.Matrix.Shape.Omni.Symmetric Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Layout.Private.Filled meas vert horiz
+ Numeric.LAPACK.Matrix.Shape.Omni: instance (Numeric.LAPACK.Matrix.Layout.Private.Packing pack, Numeric.LAPACK.Matrix.Shape.Omni.TriDiag diag, height Data.Type.Equality.~ width) => Numeric.LAPACK.Matrix.Shape.Omni.FromPlain pack diag Numeric.LAPACK.Matrix.Layout.Private.Empty Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Extent.Private.Shape Numeric.LAPACK.Matrix.Extent.Private.Small Numeric.LAPACK.Matrix.Extent.Private.Small height width
+ Numeric.LAPACK.Matrix.Shape.Omni: instance (Numeric.LAPACK.Matrix.Layout.Private.Packing pack, Numeric.LAPACK.Matrix.Shape.Omni.TriDiag diag, height Data.Type.Equality.~ width) => Numeric.LAPACK.Matrix.Shape.Omni.FromPlain pack diag Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Layout.Private.Empty Numeric.LAPACK.Matrix.Extent.Private.Shape Numeric.LAPACK.Matrix.Extent.Private.Small Numeric.LAPACK.Matrix.Extent.Private.Small height width
+ Numeric.LAPACK.Matrix.Shape.Omni: instance (Numeric.LAPACK.Matrix.Layout.Private.Packing pack, Numeric.LAPACK.Matrix.Shape.Omni.TriDiag diag, height Data.Type.Equality.~ width) => Numeric.LAPACK.Matrix.Shape.Omni.ToPlain pack diag Numeric.LAPACK.Matrix.Layout.Private.Empty Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Extent.Private.Shape Numeric.LAPACK.Matrix.Extent.Private.Small Numeric.LAPACK.Matrix.Extent.Private.Small height width
+ Numeric.LAPACK.Matrix.Shape.Omni: instance (Numeric.LAPACK.Matrix.Layout.Private.Packing pack, Numeric.LAPACK.Matrix.Shape.Omni.TriDiag diag, height Data.Type.Equality.~ width) => Numeric.LAPACK.Matrix.Shape.Omni.ToPlain pack diag Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Layout.Private.Empty Numeric.LAPACK.Matrix.Extent.Private.Shape Numeric.LAPACK.Matrix.Extent.Private.Small Numeric.LAPACK.Matrix.Extent.Private.Small height width
+ Numeric.LAPACK.Matrix.Shape.Omni: instance (Numeric.LAPACK.Matrix.Layout.Private.Packing pack, Type.Data.Bool.C neg, Type.Data.Bool.C zero, Type.Data.Bool.C pos, height Data.Type.Equality.~ width) => Numeric.LAPACK.Matrix.Shape.Omni.FromPlain pack (Numeric.LAPACK.Matrix.Shape.Omni.Hermitian neg zero pos) Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Extent.Private.Shape Numeric.LAPACK.Matrix.Extent.Private.Small Numeric.LAPACK.Matrix.Extent.Private.Small height width
+ Numeric.LAPACK.Matrix.Shape.Omni: instance (Numeric.LAPACK.Matrix.Layout.Private.Packing pack, Type.Data.Bool.C neg, Type.Data.Bool.C zero, Type.Data.Bool.C pos, height Data.Type.Equality.~ width) => Numeric.LAPACK.Matrix.Shape.Omni.ToPlain pack (Numeric.LAPACK.Matrix.Shape.Omni.Hermitian neg zero pos) Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Extent.Private.Shape Numeric.LAPACK.Matrix.Extent.Private.Small Numeric.LAPACK.Matrix.Extent.Private.Small height width
+ Numeric.LAPACK.Matrix.Shape.Omni: instance (Numeric.LAPACK.Matrix.Layout.Private.Packing pack, height Data.Type.Equality.~ width) => Numeric.LAPACK.Matrix.Shape.Omni.FromPlain pack Numeric.LAPACK.Matrix.Shape.Omni.Symmetric Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Extent.Private.Shape Numeric.LAPACK.Matrix.Extent.Private.Small Numeric.LAPACK.Matrix.Extent.Private.Small height width
+ Numeric.LAPACK.Matrix.Shape.Omni: instance (Numeric.LAPACK.Matrix.Layout.Private.Packing pack, height Data.Type.Equality.~ width) => Numeric.LAPACK.Matrix.Shape.Omni.ToPlain pack Numeric.LAPACK.Matrix.Shape.Omni.Symmetric Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Extent.Private.Shape Numeric.LAPACK.Matrix.Extent.Private.Small Numeric.LAPACK.Matrix.Extent.Private.Small height width
+ Numeric.LAPACK.Matrix.Shape.Omni: instance (Numeric.LAPACK.Matrix.Shape.Omni.BandedTriangular sub super, Numeric.LAPACK.Matrix.Shape.Omni.BandedTriangular super sub, Numeric.LAPACK.Matrix.Extent.Private.Shape Data.Type.Equality.~ meas, Numeric.LAPACK.Matrix.Extent.Private.Small Data.Type.Equality.~ vert, Numeric.LAPACK.Matrix.Extent.Private.Small Data.Type.Equality.~ horiz) => Numeric.LAPACK.Matrix.Shape.Omni.Cons Numeric.LAPACK.Matrix.Layout.Private.Packed Numeric.LAPACK.Matrix.Shape.Omni.Unit (Numeric.LAPACK.Matrix.Layout.Private.Bands sub) (Numeric.LAPACK.Matrix.Layout.Private.Bands super) meas vert horiz
+ Numeric.LAPACK.Matrix.Shape.Omni: instance (Numeric.LAPACK.Matrix.Shape.Omni.BandedTriangular sub super, Numeric.LAPACK.Matrix.Shape.Omni.BandedTriangular super sub, height Data.Type.Equality.~ width) => Numeric.LAPACK.Matrix.Shape.Omni.FromPlain Numeric.LAPACK.Matrix.Layout.Private.Packed Numeric.LAPACK.Matrix.Shape.Omni.Unit (Numeric.LAPACK.Matrix.Layout.Private.Bands sub) (Numeric.LAPACK.Matrix.Layout.Private.Bands super) Numeric.LAPACK.Matrix.Extent.Private.Shape Numeric.LAPACK.Matrix.Extent.Private.Small Numeric.LAPACK.Matrix.Extent.Private.Small height width
+ Numeric.LAPACK.Matrix.Shape.Omni: instance (Numeric.LAPACK.Matrix.Shape.Omni.BandedTriangular sub super, Numeric.LAPACK.Matrix.Shape.Omni.BandedTriangular super sub, height Data.Type.Equality.~ width) => Numeric.LAPACK.Matrix.Shape.Omni.ToPlain Numeric.LAPACK.Matrix.Layout.Private.Packed Numeric.LAPACK.Matrix.Shape.Omni.Unit (Numeric.LAPACK.Matrix.Layout.Private.Bands sub) (Numeric.LAPACK.Matrix.Layout.Private.Bands super) Numeric.LAPACK.Matrix.Extent.Private.Shape Numeric.LAPACK.Matrix.Extent.Private.Small Numeric.LAPACK.Matrix.Extent.Private.Small height width
+ Numeric.LAPACK.Matrix.Shape.Omni: instance (Numeric.LAPACK.Matrix.Shape.Omni.TriDiag diag, Numeric.LAPACK.Matrix.Extent.Private.Shape Data.Type.Equality.~ meas, Numeric.LAPACK.Matrix.Extent.Private.Small Data.Type.Equality.~ vert, Numeric.LAPACK.Matrix.Extent.Private.Small Data.Type.Equality.~ horiz) => Numeric.LAPACK.Matrix.Shape.Omni.Cons Numeric.LAPACK.Matrix.Layout.Private.Packed diag Numeric.LAPACK.Matrix.Layout.Private.Empty Numeric.LAPACK.Matrix.Layout.Private.Filled meas vert horiz
+ Numeric.LAPACK.Matrix.Shape.Omni: instance (Numeric.LAPACK.Matrix.Shape.Omni.TriDiag diag, Numeric.LAPACK.Matrix.Extent.Private.Shape Data.Type.Equality.~ meas, Numeric.LAPACK.Matrix.Extent.Private.Small Data.Type.Equality.~ vert, Numeric.LAPACK.Matrix.Extent.Private.Small Data.Type.Equality.~ horiz) => Numeric.LAPACK.Matrix.Shape.Omni.Cons Numeric.LAPACK.Matrix.Layout.Private.Packed diag Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Layout.Private.Empty meas vert horiz
+ Numeric.LAPACK.Matrix.Shape.Omni: instance (Type.Data.Bool.C neg, Type.Data.Bool.C zero, Type.Data.Bool.C pos, Numeric.LAPACK.Matrix.Extent.Private.Shape Data.Type.Equality.~ meas, Numeric.LAPACK.Matrix.Extent.Private.Small Data.Type.Equality.~ vert, Numeric.LAPACK.Matrix.Extent.Private.Small Data.Type.Equality.~ horiz) => Numeric.LAPACK.Matrix.Shape.Omni.Cons Numeric.LAPACK.Matrix.Layout.Private.Packed (Numeric.LAPACK.Matrix.Shape.Omni.Hermitian neg zero pos) Numeric.LAPACK.Matrix.Layout.Private.Filled Numeric.LAPACK.Matrix.Layout.Private.Filled meas vert horiz
+ Numeric.LAPACK.Matrix.Shape.Omni: instance (Type.Data.Bool.C neg, Type.Data.Bool.C zero, Type.Data.Bool.C pos, Type.Data.Num.Unary.Natural sub, sub Data.Type.Equality.~ super, Numeric.LAPACK.Matrix.Extent.Private.Shape Data.Type.Equality.~ meas, Numeric.LAPACK.Matrix.Extent.Private.Small Data.Type.Equality.~ vert, Numeric.LAPACK.Matrix.Extent.Private.Small Data.Type.Equality.~ horiz) => Numeric.LAPACK.Matrix.Shape.Omni.Cons Numeric.LAPACK.Matrix.Layout.Private.Packed (Numeric.LAPACK.Matrix.Shape.Omni.Hermitian neg zero pos) (Numeric.LAPACK.Matrix.Layout.Private.Bands sub) (Numeric.LAPACK.Matrix.Layout.Private.Bands super) meas vert horiz
+ Numeric.LAPACK.Matrix.Shape.Omni: instance (Type.Data.Bool.C neg, Type.Data.Bool.C zero, Type.Data.Bool.C pos, sub Data.Type.Equality.~ super, Type.Data.Num.Unary.Natural super) => Numeric.LAPACK.Matrix.Shape.Omni.Quadratic Numeric.LAPACK.Matrix.Layout.Private.Packed (Numeric.LAPACK.Matrix.Shape.Omni.Hermitian neg zero pos) (Numeric.LAPACK.Matrix.Layout.Private.Bands sub) (Numeric.LAPACK.Matrix.Layout.Private.Bands super)
+ Numeric.LAPACK.Matrix.Shape.Omni: instance (Type.Data.Num.Unary.Natural sub, sub Data.Type.Equality.~ super, height Data.Type.Equality.~ width, Type.Data.Bool.C neg, Type.Data.Bool.C zero, Type.Data.Bool.C pos) => Numeric.LAPACK.Matrix.Shape.Omni.FromPlain Numeric.LAPACK.Matrix.Layout.Private.Packed (Numeric.LAPACK.Matrix.Shape.Omni.Hermitian neg zero pos) (Numeric.LAPACK.Matrix.Layout.Private.Bands sub) (Numeric.LAPACK.Matrix.Layout.Private.Bands super) Numeric.LAPACK.Matrix.Extent.Private.Shape Numeric.LAPACK.Matrix.Extent.Private.Small Numeric.LAPACK.Matrix.Extent.Private.Small height width
+ Numeric.LAPACK.Matrix.Shape.Omni: instance (Type.Data.Num.Unary.Natural sub, sub Data.Type.Equality.~ super, height Data.Type.Equality.~ width, Type.Data.Bool.C neg, Type.Data.Bool.C zero, Type.Data.Bool.C pos) => Numeric.LAPACK.Matrix.Shape.Omni.ToPlain Numeric.LAPACK.Matrix.Layout.Private.Packed (Numeric.LAPACK.Matrix.Shape.Omni.Hermitian neg zero pos) (Numeric.LAPACK.Matrix.Layout.Private.Bands sub) (Numeric.LAPACK.Matrix.Layout.Private.Bands super) Numeric.LAPACK.Matrix.Extent.Private.Shape Numeric.LAPACK.Matrix.Extent.Private.Small Numeric.LAPACK.Matrix.Extent.Private.Small height width
+ Numeric.LAPACK.Matrix.Shape.Omni: instance (offDiag Data.Type.Equality.~ Type.Data.Num.Unary.Literal.U0) => Numeric.LAPACK.Matrix.Shape.Omni.PowerStrip (Numeric.LAPACK.Matrix.Layout.Private.Bands offDiag)
+ Numeric.LAPACK.Matrix.Square: split :: (C sizeA, C sizeB, Floating a) => Square (sizeA ::+ sizeB) a -> (Square sizeA a, General sizeA sizeB a, General sizeB sizeA a, Square sizeB a)
+ Numeric.LAPACK.Shape: instance GHC.Arr.Ix n => Numeric.LAPACK.Shape.Permutable (Data.Array.Comfort.Shape.Range n)
- Numeric.LAPACK.Matrix: toFull :: (Measure meas, C vert, C horiz) => (C height, C width, Floating a) => ArrayMatrix pack property lower upper meas vert horiz height width a -> Full meas vert horiz height width a
+ Numeric.LAPACK.Matrix: toFull :: Unpack typ => (Strip lower, Strip upper) => (Measure meas, C vert, C horiz) => (C height, C width, Floating a) => Matrix typ xl xu lower upper meas vert horiz height width a -> Full meas vert horiz height width a
Files
- Changes.md +16/−5
- lapack.cabal +7/−6
- src/Numeric/LAPACK/Linear/LowerUpper.hs +2/−2
- src/Numeric/LAPACK/Linear/Plain.hs +1/−1
- src/Numeric/LAPACK/Matrix.hs +4/−3
- src/Numeric/LAPACK/Matrix/Array.hs +4/−683
- src/Numeric/LAPACK/Matrix/Array/Banded.hs +2/−2
- src/Numeric/LAPACK/Matrix/Array/Basic.hs +2/−2
- src/Numeric/LAPACK/Matrix/Array/Divide.hs +2/−2
- src/Numeric/LAPACK/Matrix/Array/Hermitian.hs +1/−1
- src/Numeric/LAPACK/Matrix/Array/Indexed.hs +2/−2
- src/Numeric/LAPACK/Matrix/Array/Mosaic.hs +2/−2
- src/Numeric/LAPACK/Matrix/Array/Multiply.hs +2/−2
- src/Numeric/LAPACK/Matrix/Array/Private.hs +686/−0
- src/Numeric/LAPACK/Matrix/Array/Unpacked.hs +7/−1
- src/Numeric/LAPACK/Matrix/Banded.hs +2/−2
- src/Numeric/LAPACK/Matrix/BandedHermitian.hs +2/−2
- src/Numeric/LAPACK/Matrix/BandedHermitianPositiveDefinite.hs +2/−2
- src/Numeric/LAPACK/Matrix/Block.hs +232/−0
- src/Numeric/LAPACK/Matrix/Class.hs +36/−3
- src/Numeric/LAPACK/Matrix/Diagonal.hs +6/−3
- src/Numeric/LAPACK/Matrix/Divide.hs +2/−2
- src/Numeric/LAPACK/Matrix/Full.hs +2/−2
- src/Numeric/LAPACK/Matrix/Function.hs +7/−7
- src/Numeric/LAPACK/Matrix/Hermitian.hs +2/−2
- src/Numeric/LAPACK/Matrix/HermitianPositiveDefinite.hs +2/−2
- src/Numeric/LAPACK/Matrix/Indexed.hs +1/−1
- src/Numeric/LAPACK/Matrix/Multiply.hs +2/−2
- src/Numeric/LAPACK/Matrix/Permutation.hs +1/−1
- src/Numeric/LAPACK/Matrix/Quadratic.hs +2/−2
- src/Numeric/LAPACK/Matrix/Square.hs +19/−5
- src/Numeric/LAPACK/Matrix/Square/Basic.hs +7/−0
- src/Numeric/LAPACK/Matrix/Superscript.hs +1/−1
- src/Numeric/LAPACK/Matrix/Symmetric.hs +2/−2
- src/Numeric/LAPACK/Matrix/Triangular.hs +2/−2
- src/Numeric/LAPACK/Matrix/Type.hs +6/−3
- src/Numeric/LAPACK/Orthogonal.hs +2/−2
- src/Numeric/LAPACK/Orthogonal/Householder.hs +2/−2
- src/Numeric/LAPACK/Orthogonal/Plain.hs +1/−1
- src/Numeric/LAPACK/Permutation.hs +2/−2
- src/Numeric/LAPACK/Singular.hs +2/−2
Changes.md view
@@ -19,16 +19,27 @@ * `LiberalSquare`: only the sizes of height and width match - * `Square.eigensystem`:- Use liberal square as transformation matrix,- such that the eigenvalue array has `ShapeInt` shape.- The dimension of the input square matrix does not make sense- as shape for the eigenvalue array.+ * `Hermitian`: Definiteness properties in the type + * `eigensystem`, `Householder.fromMatrix`, `LowerUpper.fromMatrix` etc.:+ We use the new class `Shape.Permutable`+ for shapes where permutation of indices seems to make sense.+ We tried using liberal squares matrix factors,+ but this would require extra parameters and consistency checks+ for the shapes of the factor matrices.+ * `Square.fromGeneral` -> `fromFull` * `Orthogonal.affineKernelFromSpan` -> `affineFiberFromFrame`, `Orthogonal.affineSpanFromKernel` -> `affineFrameFromFiber`++ * `Matrix.Function`:+ New module providing generalized algebraic and transcendent functions+ like `sqrt`, `exp`, `log`.++ * `Matrix.Superscript`:+ Experimental module for eye-candy notation+ `a#^T` for transposition and `a#^Inv` for inverse. ## 0.3.2
lapack.cabal view
@@ -1,6 +1,6 @@ Cabal-Version: 2.2 Name: lapack-Version: 0.4+Version: 0.4.1 License: BSD-3-Clause License-File: LICENSE Author: Henning Thielemann <haskell@henning-thielemann.de>@@ -53,7 +53,7 @@ test-module.list Source-Repository this- Tag: 0.4+ Tag: 0.4.1 Type: darcs Location: https://hub.darcs.net/thielema/lapack/ @@ -79,7 +79,7 @@ boxes >=0.1.5 && <0.2, deepseq >=1.3 && <1.5, lazyio >=0.1 && <0.2,- transformers >=0.4 && <0.6,+ transformers >=0.4 && <0.7, tfp >=1.0.2 && <1.1, fixed-length >=0.2 && <0.3, semigroups >=0.18.3 && <1.0,@@ -93,14 +93,13 @@ GHC-Options: -Wall Hs-Source-Dirs: src Exposed-Modules:- Numeric.LAPACK.Matrix.Shape.Omni- Numeric.LAPACK.Matrix Numeric.LAPACK.Matrix.Special Numeric.LAPACK.Matrix.Superscript Numeric.LAPACK.Matrix.Array Numeric.LAPACK.Matrix.Extent Numeric.LAPACK.Matrix.Shape+ Numeric.LAPACK.Matrix.Shape.Omni Numeric.LAPACK.Matrix.Layout Numeric.LAPACK.Matrix.Full Numeric.LAPACK.Matrix.Square@@ -135,6 +134,7 @@ Numeric.LAPACK.Linear.Private Numeric.LAPACK.Split Numeric.LAPACK.Permutation.Private+ Numeric.LAPACK.Matrix.Block Numeric.LAPACK.Matrix.Square.Basic Numeric.LAPACK.Matrix.Square.Linear Numeric.LAPACK.Matrix.Square.Eigen@@ -180,6 +180,7 @@ Numeric.LAPACK.Matrix.Array.Basic Numeric.LAPACK.Matrix.Array.Divide Numeric.LAPACK.Matrix.Array.Multiply+ Numeric.LAPACK.Matrix.Array.Private Numeric.LAPACK.Matrix.Lazy.UpperTriangular Numeric.LAPACK.Matrix.ModifierTyped Numeric.LAPACK.Matrix.Modifier@@ -200,7 +201,7 @@ comfort-array, data-ref >=0.0.1 && <0.1, unique-logic-tf >=0.5.1 && <0.6,- random >=1.1 && <1.2,+ random >=1.1 && <1.3, doctest-exitcode-stdio >=0.0 && <0.1, quickcheck-transformer >=0.3 && <0.4, QuickCheck >=2.5 && <3,
src/Numeric/LAPACK/Linear/LowerUpper.hs view
@@ -37,12 +37,12 @@ import qualified Numeric.LAPACK.Matrix.Array.Unpacked as Unpacked import qualified Numeric.LAPACK.Matrix.Array.Mosaic as Tri-import qualified Numeric.LAPACK.Matrix.Array as ArrMatrix+import qualified Numeric.LAPACK.Matrix.Array.Private as ArrMatrix import qualified Numeric.LAPACK.Matrix.Extent.Private as Extent import qualified Numeric.LAPACK.Matrix.Permutation as PermMatrix import qualified Numeric.LAPACK.Matrix as Matrix import qualified Numeric.LAPACK.Shape as ExtShape-import Numeric.LAPACK.Matrix.Array (Full)+import Numeric.LAPACK.Matrix.Array.Private (Full) import Numeric.LAPACK.Matrix.Modifier (Transposition, Conjugation, Inversion) import qualified Numeric.Netlib.Class as Class
src/Numeric/LAPACK/Linear/Plain.hs view
@@ -39,7 +39,7 @@ import qualified Numeric.LAPACK.Matrix.Type as Matrix import qualified Numeric.LAPACK.Matrix.Banded.Basic as Banded import qualified Numeric.LAPACK.Matrix.Basic as Basic-import qualified Numeric.LAPACK.Matrix.Array as ArrMatrix+import qualified Numeric.LAPACK.Matrix.Array.Private as ArrMatrix import qualified Numeric.LAPACK.Matrix.Layout as LayoutPub import qualified Numeric.LAPACK.Matrix.Layout.Private as Layout import qualified Numeric.LAPACK.Matrix.Extent.Strict as ExtentStrict
src/Numeric/LAPACK/Matrix.hs view
@@ -26,7 +26,8 @@ caseTallWide, fromScalar, toScalar, fromList,- Matrix.mapExtent, fromFull, OmniMatrix.toFull, OmniMatrix.unpack,+ MatrixClass.Unpack, MatrixClass.toFull, OmniMatrix.unpack,+ Matrix.mapExtent, fromFull, asGeneral, asTall, asWide, tallFromGeneral, wideFromGeneral, generalizeTall, generalizeWide,@@ -118,7 +119,7 @@ import qualified Numeric.LAPACK.Matrix.Extent as Extent import qualified Numeric.LAPACK.Matrix.Basic as Basic import qualified Numeric.LAPACK.Matrix.Array.Basic as OmniMatrix-import qualified Numeric.LAPACK.Matrix.Array as ArrMatrix+import qualified Numeric.LAPACK.Matrix.Array.Private as ArrMatrix import qualified Numeric.LAPACK.Matrix.Type as Matrix import qualified Numeric.LAPACK.Matrix.Plain as Plain import qualified Numeric.LAPACK.Matrix.Modifier as Mod@@ -131,7 +132,7 @@ import qualified Numeric.LAPACK.Vector as Vector import qualified Numeric.LAPACK.Shape as ExtShape import Numeric.LAPACK.Matrix.Layout.Private (Order)-import Numeric.LAPACK.Matrix.Array (Full, General, Tall, Wide)+import Numeric.LAPACK.Matrix.Array.Private (Full, General, Tall, Wide) import Numeric.LAPACK.Matrix.Private (ShapeInt, shapeInt) import Numeric.LAPACK.Vector (Vector) import Numeric.LAPACK.Scalar (RealOf)
src/Numeric/LAPACK/Matrix/Array.hs view
@@ -1,686 +1,7 @@-{-# LANGUAGE TypeFamilies #-}-{-# LANGUAGE EmptyDataDecls #-}-{-# LANGUAGE MultiParamTypeClasses #-}-{-# LANGUAGE GADTs #-}-{-# LANGUAGE FlexibleInstances #-}-{-# LANGUAGE StandaloneDeriving #-} module Numeric.LAPACK.Matrix.Array (- Matrix(Array),- ArrayMatrix,- Array,- OmniArray,- PlainArray,-- Full,- General,- Tall,- Wide,- LiberalSquare,- Square,- SquareMeas,- Quadratic,- FullQuadratic,- QuadraticMeas,-- plainShape,- shape,- extent,- subBandsSingleton,- superBandsSingleton,- packTag,- diagTag,-- asPacked,- asUnpacked,- requirePacking,-- reshape,- mapShape,- unwrap,- toVector,- fromVector,- lift0,- lift1,- lift2,- lift3,- lift4,- unlift1,- unlift2,- unliftRow,- unliftColumn,- unpackedToVector,- liftUnpacked0,- liftUnpacked1,- liftUnpacked2,- liftUnpacked3,- liftOmni1,- liftOmni2,-- Homogeneous, Scale, zero, negate, scaleReal, scale, scaleRealReal, (.*#),- order, forceOrder, adaptOrder,- Additive, add, (#+#),- Subtractive, sub, (#-#),-- MapExtent, mapExtent,+ module Numeric.LAPACK.Matrix.Array.Private,+ OmniMatrix.identityFromShape, ) where -import qualified Numeric.LAPACK.Matrix.Plain.Class as ArrClass-import qualified Numeric.LAPACK.Matrix.Type as Matrix-import qualified Numeric.LAPACK.Matrix.BandedHermitian.Basic as BandedHermitian-import qualified Numeric.LAPACK.Matrix.Banded.Basic as Banded-import qualified Numeric.LAPACK.Matrix.Triangular.Basic as Triangular-import qualified Numeric.LAPACK.Matrix.Mosaic.Basic as Mosaic-import qualified Numeric.LAPACK.Matrix.Plain as Plain-import qualified Numeric.LAPACK.Matrix.Basic as Basic-import qualified Numeric.LAPACK.Matrix.Shape.Omni as Omni-import qualified Numeric.LAPACK.Matrix.Shape as MatrixShape-import qualified Numeric.LAPACK.Matrix.Layout.Private as Layout-import qualified Numeric.LAPACK.Matrix.Extent.Private as Extent-import qualified Numeric.LAPACK.Matrix.Extent.Strict as ExtentStrict-import qualified Numeric.LAPACK.Vector as Vector-import Numeric.LAPACK.Matrix.Plain.Format (formatArray)-import Numeric.LAPACK.Matrix.Shape.Omni (Omni, Arbitrary)-import Numeric.LAPACK.Matrix.Layout.Private (Filled, Bands, Packed, Unpacked)-import Numeric.LAPACK.Matrix.Extent.Private (Extent, Shape, Size, Big, Small)-import Numeric.LAPACK.Matrix.Type (Matrix)-import Numeric.LAPACK.Vector (Vector)-import Numeric.LAPACK.Scalar (RealOf)--import qualified Type.Data.Num.Unary as Unary-import qualified Type.Data.Bool as TBool-import Type.Data.Bool (True)--import qualified Numeric.Netlib.Class as Class--import qualified Control.DeepSeq as DeepSeq--import qualified Data.Array.Comfort.Storable.Unchecked as Array-import qualified Data.Array.Comfort.Storable as CheckedArray-import qualified Data.Array.Comfort.Shape as Shape-import Data.Function.HT (Id)--import Foreign.Storable (Storable)--import Prelude hiding (negate)---type OmniArray pack prop lower upper meas vert horiz height width a =- Array.Array (Omni pack prop lower upper meas vert horiz height width) a--data Array pack property-data instance- Matrix (Array pack prop) xl xu- lower upper meas vert horiz height width a where- Array ::- OmniArray pack prop lower upper meas vert horiz height width a ->- Matrix (Array pack prop) () () lower upper meas vert horiz height width a--deriving instance- (Extent.Measure meas, Extent.C vert, Extent.C horiz,- Shape.C height, Shape.C width, Storable a,- Show height, Show width, Show a) =>- Show (Matrix (Array pack prop) xl xu- lower upper meas vert horiz height width a)--type ArrayMatrix pack property = Matrix (Array pack property) () ()-type UnpackedMatrix property = ArrayMatrix Unpacked property---type Full meas vert horiz height width =- UnpackedMatrix Arbitrary Filled Filled meas vert horiz height width-type General height width = Full Size Big Big height width-type Tall height width = Full Size Big Small height width-type Wide height width = Full Size Small Big height width-type LiberalSquare height width = SquareMeas Size height width-type Square sh = SquareMeas Shape sh sh-type SquareMeas meas height width = Full meas Small Small height width--type Quadratic pack property lower upper sh =- QuadraticMeas pack property lower upper Shape sh sh-type FullQuadratic pack property sh = Quadratic pack property Filled Filled sh--type QuadraticMeas pack property lower upper meas height width =- ArrayMatrix pack property lower upper meas Small Small height width---instance Matrix.NFData (Array pack property) where- rnf (Array arr) = DeepSeq.rnf arr--instance Matrix.Box (Array pack property) where- extent (Array arr) = Omni.extent $ Array.shape arr--instance Matrix.Transpose (Array pack property) where- transpose a@(Array _) =- case shape a of- Omni.Full _ -> liftUnpacked1 Basic.transpose a- Omni.UpperTriangular _ -> lift1 Mosaic.transpose a- Omni.LowerTriangular _ -> lift1 Mosaic.transpose a- Omni.Symmetric _ -> a- Omni.Hermitian _ -> lift1 Vector.conjugate a- Omni.Banded _ -> lift1 Banded.transpose a- Omni.UnitBandedTriangular _ -> lift1 Banded.transpose a- Omni.BandedHermitian _ -> lift1 Vector.conjugate a---asPacked ::- Id (ArrayMatrix Packed property lower upper meas vert horiz height width a)-asPacked = id--asUnpacked ::- Id (ArrayMatrix Unpacked property lower upper meas vert horiz height width a)-asUnpacked = id--requirePacking ::- Layout.PackingSingleton pack ->- Id (ArrayMatrix pack property lower upper meas vert horiz height width a)-requirePacking _ = id---plainShape ::- (Omni.ToPlain pack property lower upper meas vert horiz height width) =>- ArrayMatrix pack property lower upper meas vert horiz height width a ->- Omni.Plain pack property lower upper meas vert horiz height width-plainShape = Omni.toPlain . shape--shape ::- ArrayMatrix pack property lower upper meas vert horiz height width a ->- Omni pack property lower upper meas vert horiz height width-shape (Array a) = Array.shape a--extent ::- (Extent.Measure meas, Extent.C vert, Extent.C horiz) =>- ArrayMatrix pack property lower upper meas vert horiz height width a ->- Extent meas vert horiz height width-extent = Omni.extent . shape---subBandsSingleton ::- (Unary.Natural sub) =>- ArrayMatrix pack property- (Layout.Bands sub) upper meas vert horiz height width a ->- Unary.HeadSingleton sub-subBandsSingleton _ = Unary.headSingleton--superBandsSingleton ::- (Unary.Natural super) =>- ArrayMatrix pack property- lower (Layout.Bands super) meas vert horiz height width a ->- Unary.HeadSingleton super-superBandsSingleton _ = Unary.headSingleton---reshape ::- (Extent.Measure measA, Extent.C vertA, Extent.C horizA) =>- (Extent.Measure measB, Extent.C vertB, Extent.C horizB) =>- (Shape.C heightA, Shape.C widthA) =>- (Shape.C heightB, Shape.C widthB) =>- Omni packB propB lowerB upperB measB vertB horizB heightB widthB ->- ArrayMatrix packA propA lowerA upperA measA vertA horizA heightA widthA a ->- ArrayMatrix packB propB lowerB upperB measB vertB horizB heightB widthB a-reshape = liftOmni1 . CheckedArray.reshape--mapShape ::- (Extent.Measure measA, Extent.C vertA, Extent.C horizA) =>- (Extent.Measure measB, Extent.C vertB, Extent.C horizB) =>- (Shape.C heightA, Shape.C widthA) =>- (Shape.C heightB, Shape.C widthB) =>- (Omni packA propA lowerA upperA measA vertA horizA heightA widthA ->- Omni packB propB lowerB upperB measB vertB horizB heightB widthB) ->- ArrayMatrix packA propA lowerA upperA measA vertA horizA heightA widthA a ->- ArrayMatrix packB propB lowerB upperB measB vertB horizB heightB widthB a-mapShape = liftOmni1 . CheckedArray.mapShape---type PlainArray pack prop lower upper meas vert horiz height width =- Array.Array (Omni.Plain pack prop lower upper meas vert horiz height width)--toVector ::- (Omni.ToPlain pack property lower upper meas vert horiz height width) =>- ArrayMatrix pack property lower upper meas vert horiz height width a ->- PlainArray pack property lower upper meas vert horiz height width a-toVector (Array a) = Array.mapShape Omni.toPlain a--unwrap ::- ArrayMatrix pack property lower upper meas vert horiz height width a ->- OmniArray pack property lower upper meas vert horiz height width a-unwrap (Array a) = a--fromVector ::- (Omni.FromPlain pack prop lower upper meas vert horiz height width) =>- (Omni.Plain pack prop lower upper meas vert horiz height width ~ shape) =>- (Extent.Measure meas, Extent.C vert, Extent.C horiz) =>- (Shape.C height, Shape.C width, Class.Floating a) =>- Array.Array shape a ->- ArrayMatrix pack prop lower upper meas vert horiz height width a-fromVector arr =- let omni = Omni.fromPlain $ Array.shape arr- in case ArrClass.check omni arr of- Nothing -> Array $ Array.reshape omni arr- Just msg -> error $ "Matrix.Array.fromVector: " ++ msg---{- |-'lift0' is a synonym for 'fromVector' but lacks the admissibility check.-You may thus fool the type tags.-This applies to the other lift functions, too.--}-lift0 ::- (Omni.FromPlain pack prop lower upper meas vert horiz height width) =>- PlainArray pack prop lower upper meas vert horiz height width a ->- ArrayMatrix pack prop lower upper meas vert horiz height width a-lift0 = Array . Array.mapShape Omni.fromPlain--lift1 ::- (Omni.ToPlain packA propA lowerA upperA measA vertA horizA heightA widthA) =>- (Omni.FromPlain packB propB lowerB upperB measB vertB horizB heightB widthB)- =>- (PlainArray packA propA lowerA upperA measA vertA horizA heightA widthA a ->- PlainArray packB propB lowerB upperB measB vertB horizB heightB widthB b) ->- ArrayMatrix packA propA lowerA upperA measA vertA horizA heightA widthA a ->- ArrayMatrix packB propB lowerB upperB measB vertB horizB heightB widthB b-lift1 f = lift0 . f . toVector--lift2 ::- (Omni.ToPlain packA propA lowerA upperA measA vertA horizA heightA widthA) =>- (Omni.ToPlain packB propB lowerB upperB measB vertB horizB heightB widthB) =>- (Omni.FromPlain packC propC lowerC upperC measC vertC horizC heightC widthC)- =>- (PlainArray packA propA lowerA upperA measA vertA horizA heightA widthA a ->- PlainArray packB propB lowerB upperB measB vertB horizB heightB widthB b ->- PlainArray packC propC lowerC upperC measC vertC horizC heightC widthC c) ->- ArrayMatrix packA propA lowerA upperA measA vertA horizA heightA widthA a ->- ArrayMatrix packB propB lowerB upperB measB vertB horizB heightB widthB b ->- ArrayMatrix packC propC lowerC upperC measC vertC horizC heightC widthC c-lift2 f = lift1 . f . toVector--lift3 ::- (Omni.ToPlain packA propA lowerA upperA measA vertA horizA heightA widthA) =>- (Omni.ToPlain packB propB lowerB upperB measB vertB horizB heightB widthB) =>- (Omni.ToPlain packC propC lowerC upperC measC vertC horizC heightC widthC) =>- (Omni.FromPlain packD propD lowerD upperD measD vertD horizD heightD widthD)- =>- (PlainArray packA propA lowerA upperA measA vertA horizA heightA widthA a ->- PlainArray packB propB lowerB upperB measB vertB horizB heightB widthB b ->- PlainArray packC propC lowerC upperC measC vertC horizC heightC widthC c ->- PlainArray packD propD lowerD upperD measD vertD horizD heightD widthD d) ->- ArrayMatrix packA propA lowerA upperA measA vertA horizA heightA widthA a ->- ArrayMatrix packB propB lowerB upperB measB vertB horizB heightB widthB b ->- ArrayMatrix packC propC lowerC upperC measC vertC horizC heightC widthC c ->- ArrayMatrix packD propD lowerD upperD measD vertD horizD heightD widthD d-lift3 f = lift2 . f . toVector--lift4 ::- (Omni.ToPlain packA propA lowerA upperA measA vertA horizA heightA widthA) =>- (Omni.ToPlain packB propB lowerB upperB measB vertB horizB heightB widthB) =>- (Omni.ToPlain packC propC lowerC upperC measC vertC horizC heightC widthC) =>- (Omni.ToPlain packD propD lowerD upperD measD vertD horizD heightD widthD) =>- (Omni.FromPlain packE propE lowerE upperE measE vertE horizE heightE widthE)- =>- (PlainArray packA propA lowerA upperA measA vertA horizA heightA widthA a ->- PlainArray packB propB lowerB upperB measB vertB horizB heightB widthB b ->- PlainArray packC propC lowerC upperC measC vertC horizC heightC widthC c ->- PlainArray packD propD lowerD upperD measD vertD horizD heightD widthD d ->- PlainArray packE propE lowerE upperE measE vertE horizE heightE widthE e) ->- ArrayMatrix packA propA lowerA upperA measA vertA horizA heightA widthA a ->- ArrayMatrix packB propB lowerB upperB measB vertB horizB heightB widthB b ->- ArrayMatrix packC propC lowerC upperC measC vertC horizC heightC widthC c ->- ArrayMatrix packD propD lowerD upperD measD vertD horizD heightD widthD d ->- ArrayMatrix packE propE lowerE upperE measE vertE horizE heightE widthE e-lift4 f = lift3 . f . toVector---unlift1 ::- (Omni.FromPlain packA propA lowerA upperA measA vertA horizA heightA widthA)- =>- (Omni.ToPlain packB propB lowerB upperB measB vertB horizB heightB widthB) =>- (ArrayMatrix packA propA lowerA upperA measA vertA horizA heightA widthA a ->- ArrayMatrix packB propB lowerB upperB measB vertB horizB heightB widthB b) ->- (PlainArray packA propA lowerA upperA measA vertA horizA heightA widthA a ->- PlainArray packB propB lowerB upperB measB vertB horizB heightB widthB b)-unlift1 f = toVector . f . lift0--unlift2 ::- (Omni.FromPlain packA propA lowerA upperA measA vertA horizA heightA widthA,- Omni.FromPlain packB propB lowerB upperB measB vertB horizB heightB widthB)- =>- (Omni.ToPlain packC propC lowerC upperC measC vertC horizC heightC widthC) =>- (ArrayMatrix packA propA lowerA upperA measA vertA horizA heightA widthA a ->- ArrayMatrix packB propB lowerB upperB measB vertB horizB heightB widthB b ->- ArrayMatrix packC propC lowerC upperC measC vertC horizC heightC widthC c) ->- (PlainArray packA propA lowerA upperA measA vertA horizA heightA widthA a ->- PlainArray packB propB lowerB upperB measB vertB horizB heightB widthB b ->- PlainArray packC propC lowerC upperC measC vertC horizC heightC widthC c)-unlift2 f = unlift1 . f . lift0---type FullArray meas vert horiz height width =- Array.Array (Layout.Full meas vert horiz height width)--unpackedToVector ::- (Omni.Property property, Omni.Strip lower, Omni.Strip upper) =>- UnpackedMatrix property lower upper meas vert horiz height width a ->- FullArray meas vert horiz height width a-unpackedToVector = Array.mapShape Omni.toFull . unwrap--liftUnpacked0 ::- (Omni.Property propertyA, Omni.Strip lowerA, Omni.Strip upperA) =>- (FullArray measA vertA horizA heightA widthA a) ->- UnpackedMatrix propertyA lowerA upperA measA vertA horizA heightA widthA a-liftUnpacked0 = Array . Array.mapShape Omni.fromFull--liftUnpacked1 ::- (Omni.Property propertyA, Omni.Strip lowerA, Omni.Strip upperA) =>- (Omni.Property propertyB, Omni.Strip lowerB, Omni.Strip upperB) =>- (FullArray measA vertA horizA heightA widthA a ->- FullArray measB vertB horizB heightB widthB b) ->- UnpackedMatrix propertyA lowerA upperA measA vertA horizA heightA widthA a ->- UnpackedMatrix propertyB lowerB upperB measB vertB horizB heightB widthB b-liftUnpacked1 f = liftUnpacked0 . f . unpackedToVector--liftUnpacked2 ::- (Omni.Property propertyA, Omni.Strip lowerA, Omni.Strip upperA) =>- (Omni.Property propertyB, Omni.Strip lowerB, Omni.Strip upperB) =>- (Omni.Property propertyC, Omni.Strip lowerC, Omni.Strip upperC) =>- (FullArray measA vertA horizA heightA widthA a ->- FullArray measB vertB horizB heightB widthB b ->- FullArray measC vertC horizC heightC widthC c) ->- UnpackedMatrix propertyA lowerA upperA measA vertA horizA heightA widthA a ->- UnpackedMatrix propertyB lowerB upperB measB vertB horizB heightB widthB b ->- UnpackedMatrix propertyC lowerC upperC measC vertC horizC heightC widthC c-liftUnpacked2 f = liftUnpacked1 . f . unpackedToVector--liftUnpacked3 ::- (Omni.Property propertyA, Omni.Strip lowerA, Omni.Strip upperA) =>- (Omni.Property propertyB, Omni.Strip lowerB, Omni.Strip upperB) =>- (Omni.Property propertyC, Omni.Strip lowerC, Omni.Strip upperC) =>- (Omni.Property propertyD, Omni.Strip lowerD, Omni.Strip upperD) =>- (FullArray measA vertA horizA heightA widthA a ->- FullArray measB vertB horizB heightB widthB b ->- FullArray measC vertC horizC heightC widthC c ->- FullArray measD vertD horizD heightD widthD d) ->- UnpackedMatrix propertyA lowerA upperA measA vertA horizA heightA widthA a ->- UnpackedMatrix propertyB lowerB upperB measB vertB horizB heightB widthB b ->- UnpackedMatrix propertyC lowerC upperC measC vertC horizC heightC widthC c ->- UnpackedMatrix propertyD lowerD upperD measD vertD horizD heightD widthD d-liftUnpacked3 f = liftUnpacked2 . f . unpackedToVector---unliftRow ::- Layout.Order ->- (General () height0 a -> General () height1 b) ->- Vector height0 a -> Vector height1 b-unliftRow order_ = Basic.unliftRow order_ . unlift1--unliftColumn ::- Layout.Order ->- (General height0 () a -> General height1 () b) ->- Vector height0 a -> Vector height1 b-unliftColumn order_ = Basic.unliftColumn order_ . unlift1---instance Matrix.FormatMatrix (Array pack property) where- formatMatrix fmt a@(Array _) =- case shape a of- Omni.Full fullShape ->- formatArray fmt $ Array.reshape fullShape $ unwrap a- Omni.UpperTriangular _ -> formatArray fmt $ toVector a- Omni.LowerTriangular _ -> formatArray fmt $ toVector a- Omni.Symmetric _ -> formatArray fmt $ toVector a- Omni.Hermitian _ -> formatArray fmt $ toVector a- Omni.Banded _ -> formatArray fmt $ toVector a- Omni.UnitBandedTriangular _ -> formatArray fmt $ toVector a- Omni.BandedHermitian _ -> formatArray fmt $ toVector a---packTag ::- (Layout.Packing pack) =>- ArrayMatrix pack diag lower upper meas vert horiz height width a ->- Layout.PackingSingleton pack-packTag _ = Layout.autoPacking--diagTag ::- (Omni.TriDiag diag) =>- ArrayMatrix pack diag lower upper meas vert horiz height width a ->- Omni.DiagSingleton diag-diagTag _ = Omni.autoDiag--instance- (Layout.Packing pack, Omni.TriDiag diag, xl ~ (), xu ~ ()) =>- Matrix.MultiplySame (Array pack diag) xl xu where- multiplySame a =- case Omni.powerSingleton $ shape a of- Omni.PowerIdentity -> \b ->- if Matrix.squareSize a == Matrix.squareSize b- then b- else error "multiplySame Identity: shape mismatch"- Omni.PowerUpperTriangular ->- lift2 (Triangular.multiply $ diagTag a) a- Omni.PowerLowerTriangular ->- lift2 (Triangular.multiply $ diagTag a) a- Omni.PowerDiagonal ->- case (diagTag a, shape a) of- (MatrixShape.Unit, Omni.UnitBandedTriangular _) ->- lift2 Banded.multiply a- (MatrixShape.Arbitrary, Omni.Banded _) ->- lift2 Banded.multiply a- (_, Omni.Full _) -> liftUnpacked2 Basic.multiply a- Omni.PowerSymmetric ->- case diagTag a of _ -> error "Symmetric forbidden"- Omni.PowerHermitian ->- case diagTag a of _ -> error "Hermitian forbidden"- Omni.PowerFull -> liftUnpacked2 Basic.multiply a---{--ToDo: implement using Array.Omni.identityOrderAux.-however, we must prevent module cycle--instance- (meas ~ Extent.Shape, vert ~ Extent.Small, horiz ~ Extent.Small,- height ~ width, Shape.Static width) =>- Matrix.StaticIdentity- (Array pack property lower upper meas vert horiz height width) where- staticIdentity =- OmniBasic.identityOrder Layout.RowMajor Shape.static--}---class (Omni.Property property) => Homogeneous property where-instance Homogeneous Arbitrary where-instance Homogeneous Omni.Symmetric where-instance (zero ~ True, neg ~ pos, TBool.C pos) =>- Homogeneous (Omni.Hermitian neg zero pos) where--zero ::- (Homogeneous property) =>- (Extent.Measure meas, Extent.C vert, Extent.C horiz) =>- (Shape.C height, Shape.C width, Class.Floating a) =>- Omni pack property lower upper meas vert horiz height width ->- ArrayMatrix pack property lower upper meas vert horiz height width a-zero = Array . Vector.zero--negate ::- (Homogeneous property) =>- (Extent.Measure meas, Extent.C vert, Extent.C horiz) =>- (Shape.C height, Shape.C width, Class.Floating a) =>- ArrayMatrix pack property lower upper meas vert horiz height width a ->- ArrayMatrix pack property lower upper meas vert horiz height width a-negate (Array a) = Array $ Vector.negate a--scaleReal ::- (Homogeneous property) =>- (Extent.Measure meas, Extent.C vert, Extent.C horiz) =>- (Shape.C height, Shape.C width, Class.Floating a) =>- RealOf a ->- ArrayMatrix pack property lower upper meas vert horiz height width a ->- ArrayMatrix pack property lower upper meas vert horiz height width a-scaleReal a (Array v) = Array $ Vector.scaleReal a v--newtype ScaleReal f a = ScaleReal {getScaleReal :: a -> f a -> f a}--scaleRealReal ::- (Homogeneous property) =>- (Extent.Measure meas, Extent.C vert, Extent.C horiz) =>- (Shape.C height, Shape.C width, Class.Real a) =>- a ->- ArrayMatrix pack property lower upper meas vert horiz height width a ->- ArrayMatrix pack property lower upper meas vert horiz height width a-scaleRealReal =- getScaleReal $ Class.switchReal (ScaleReal scaleReal) (ScaleReal scaleReal)---class (Homogeneous property) => Scale property where-instance Scale Arbitrary where-instance Scale Omni.Symmetric where--scale, (.*#) ::- (Extent.Measure meas, Extent.C vert, Extent.C horiz) =>- (Scale property, Shape.C height, Shape.C width, Class.Floating a) =>- a ->- ArrayMatrix pack property lower upper meas vert horiz height width a ->- ArrayMatrix pack property lower upper meas vert horiz height width a-scale a (Array v) = Array $ Vector.scale a v-(.*#) = scale--infixl 7 .*#---order ::- ArrayMatrix pack property lower upper meas vert horiz height width a ->- Layout.Order-order = Omni.order . shape--forceOrder ::- (Extent.Measure meas, Extent.C vert, Extent.C horiz) =>- (Shape.C height, Shape.C width, Class.Floating a) =>- Layout.Order ->- ArrayMatrix pack property lower upper meas vert horiz height width a ->- ArrayMatrix pack property lower upper meas vert horiz height width a-forceOrder order_ a =- case shape a of- Omni.UpperTriangular _ -> lift1 (Triangular.forceOrder order_) a- Omni.LowerTriangular _ -> lift1 (Triangular.forceOrder order_) a- Omni.Full _ -> liftUnpacked1 (Basic.forceOrder order_) a- Omni.Symmetric _ -> lift1 (Triangular.forceOrder order_) a- Omni.Hermitian _ -> lift1 (Triangular.forceOrder order_) a- Omni.Banded _ -> lift1 (Banded.forceOrder order_) a- Omni.BandedHermitian _ -> lift1 (BandedHermitian.forceOrder order_) a- Omni.UnitBandedTriangular _ -> lift1 (Banded.forceOrder order_) a--{- |-@adaptOrder x y@ contains the data of @y@ with the layout of @x@.--}-adaptOrder ::- (Extent.Measure meas, Extent.C vert, Extent.C horiz) =>- (Shape.C height, Shape.C width, Class.Floating a) =>- ArrayMatrix pack property lower upper meas vert horiz height width a ->- ArrayMatrix pack property lower upper meas vert horiz height width a ->- ArrayMatrix pack property lower upper meas vert horiz height width a-adaptOrder = forceOrder . order---class (Omni.Property property) => Additive property where-instance Additive Arbitrary where-instance Additive Omni.Symmetric where-instance (TBool.C neg, TBool.C zero, TBool.C pos) =>- Additive (Omni.Hermitian neg zero pos) where--class (Additive property) => Subtractive property where-instance Subtractive Arbitrary where-instance Subtractive Omni.Symmetric where-instance (TBool.C neg, TBool.C zero, neg ~ pos) =>- Subtractive (Omni.Hermitian neg zero pos) where--infixl 6 #+#, #-#, `add`, `sub`--add, (#+#) ::- (Extent.Measure meas, Extent.C vert, Extent.C horiz) =>- (Additive property,- Shape.C height, Eq height, Shape.C width, Eq width, Class.Floating a) =>- ArrayMatrix pack property lower upper meas vert horiz height width a ->- ArrayMatrix pack property lower upper meas vert horiz height width a ->- ArrayMatrix pack property lower upper meas vert horiz height width a-add a b = liftOmni2 Vector.add (adaptOrder b a) b--sub, (#-#) ::- (Extent.Measure meas, Extent.C vert, Extent.C horiz) =>- (Subtractive property,- Shape.C height, Eq height, Shape.C width, Eq width, Class.Floating a) =>- ArrayMatrix pack property lower upper meas vert horiz height width a ->- ArrayMatrix pack property lower upper meas vert horiz height width a ->- ArrayMatrix pack property lower upper meas vert horiz height width a-sub a b = liftOmni2 Vector.sub (adaptOrder b a) b--(#+#) = add-(#-#) = sub---liftOmni1 ::- (OmniArray packA propA lowerA upperA measA vertA horizA heightA widthA a ->- OmniArray packB propB lowerB upperB measB vertB horizB heightB widthB b)- ->- ArrayMatrix packA propA lowerA upperA measA vertA horizA heightA widthA a ->- ArrayMatrix packB propB lowerB upperB measB vertB horizB heightB widthB b-liftOmni1 f (Array a) = Array $ f a--liftOmni2 ::- (OmniArray packA propA lowerA upperA measA vertA horizA heightA widthA a ->- OmniArray packB propB lowerB upperB measB vertB horizB heightB widthB b ->- OmniArray packC propC lowerC upperC measC vertC horizC heightC widthC c)- ->- ArrayMatrix packA propA lowerA upperA measA vertA horizA heightA widthA a ->- ArrayMatrix packB propB lowerB upperB measB vertB horizB heightB widthB b ->- ArrayMatrix packC propC lowerC upperC measC vertC horizC heightC widthC c-liftOmni2 f (Array a) (Array b) = Array $ f a b----instance Matrix.ToQuadratic (Array pack property) where- heightToQuadratic a@(Array _) =- case shape a of- Omni.Full _ ->- ($a) $ liftUnpacked1 $ Basic.mapExtent $- Extent.square . Extent.height- Omni.UpperTriangular _ -> a- Omni.LowerTriangular _ -> a- Omni.Symmetric _ -> a- Omni.Hermitian _ -> a- Omni.Banded _ ->- ($a) $ lift1 $ Banded.mapExtentSizes $ Extent.square . Extent.height- Omni.UnitBandedTriangular _ -> a- Omni.BandedHermitian _ -> a- widthToQuadratic a@(Array _) =- case shape a of- Omni.Full _ ->- ($a) $ liftUnpacked1 $ Basic.mapExtent $- Extent.square . Extent.width- Omni.UpperTriangular _ -> a- Omni.LowerTriangular _ -> a- Omni.Symmetric _ -> a- Omni.Hermitian _ -> a- Omni.Banded _ ->- ($a) $ lift1 $ Banded.mapExtentSizes $ Extent.square . Extent.width- Omni.UnitBandedTriangular _ -> a- Omni.BandedHermitian _ -> a---instance- (MapExtent pack property lower upper, xl ~ (), xu ~ ()) =>- Matrix.MapExtent (Array pack property) xl xu lower upper where- mapExtent = mapExtent--class MapExtent pack property lower upper where- mapExtent ::- (Extent.Measure measA, Extent.C vertA, Extent.C horizA) =>- (Extent.Measure measB, Extent.C vertB, Extent.C horizB) =>- ExtentStrict.Map measA vertA horizA measB vertB horizB height width ->- ArrayMatrix pack property lower upper measA vertA horizA height width a ->- ArrayMatrix pack property lower upper measB vertB horizB height width a--instance MapExtent Unpacked Arbitrary Filled Filled where- mapExtent = lift1 . Plain.mapExtent . ExtentStrict.apply--instance- (Unary.Natural sub, Unary.Natural super) =>- MapExtent Packed Arbitrary (Bands sub) (Bands super) where- mapExtent = lift1 . Banded.mapExtent . ExtentStrict.apply+import qualified Numeric.LAPACK.Matrix.Array.Basic as OmniMatrix+import Numeric.LAPACK.Matrix.Array.Private
src/Numeric/LAPACK/Matrix/Array/Banded.hs view
@@ -1,8 +1,8 @@ module Numeric.LAPACK.Matrix.Array.Banded where -import qualified Numeric.LAPACK.Matrix.Array as ArrMatrix+import qualified Numeric.LAPACK.Matrix.Array.Private as ArrMatrix import qualified Numeric.LAPACK.Matrix.Shape.Omni as Omni-import Numeric.LAPACK.Matrix.Array (ArrayMatrix)+import Numeric.LAPACK.Matrix.Array.Private (ArrayMatrix) import Numeric.LAPACK.Matrix.Shape.Omni (Unit, Arbitrary) import Numeric.LAPACK.Matrix.Layout.Private (Bands, Packed) import Numeric.LAPACK.Matrix.Extent.Private (Size, Big)
src/Numeric/LAPACK/Matrix/Array/Basic.hs view
@@ -9,14 +9,14 @@ import qualified Numeric.LAPACK.Matrix.Symmetric.Unified as Symmetric import qualified Numeric.LAPACK.Matrix.Square.Basic as Square -import qualified Numeric.LAPACK.Matrix.Array as ArrMatrix+import qualified Numeric.LAPACK.Matrix.Array.Private as ArrMatrix import qualified Numeric.LAPACK.Matrix.Shape as MatrixShape import qualified Numeric.LAPACK.Matrix.Shape.Omni as Omni import qualified Numeric.LAPACK.Matrix.Layout.Private as Layout import qualified Numeric.LAPACK.Matrix.Extent as Extent import qualified Numeric.LAPACK.Vector as Vector import qualified Numeric.LAPACK.Scalar as Scalar-import Numeric.LAPACK.Matrix.Array (ArrayMatrix, Quadratic)+import Numeric.LAPACK.Matrix.Array.Private (ArrayMatrix, Quadratic) import Numeric.LAPACK.Vector (Vector) import qualified Numeric.Netlib.Class as Class
src/Numeric/LAPACK/Matrix/Array/Divide.hs view
@@ -14,7 +14,7 @@ import qualified Numeric.LAPACK.Matrix.Banded as Banded import qualified Numeric.LAPACK.Matrix.Array.Basic as OmniMatrix-import qualified Numeric.LAPACK.Matrix.Array as ArrMatrix+import qualified Numeric.LAPACK.Matrix.Array.Private as ArrMatrix import qualified Numeric.LAPACK.Matrix.Shape.Omni as Omni import qualified Numeric.LAPACK.Matrix.Shape as MatrixShape import qualified Numeric.LAPACK.Matrix.Layout.Private as Layout@@ -22,7 +22,7 @@ import qualified Numeric.LAPACK.Vector as Vector import qualified Numeric.LAPACK.Scalar as Scalar import Numeric.LAPACK.Matrix.Array.Multiply (Factor(..), factorSingleton)-import Numeric.LAPACK.Matrix.Array (Full, Quadratic, QuadraticMeas)+import Numeric.LAPACK.Matrix.Array.Private (Full, Quadratic, QuadraticMeas) import qualified Numeric.Netlib.Class as Class
src/Numeric/LAPACK/Matrix/Array/Hermitian.hs view
@@ -14,7 +14,7 @@ ) where import qualified Numeric.LAPACK.Matrix.Shape.Omni as Omni-import Numeric.LAPACK.Matrix.Array (Matrix(Array), Quadratic)+import Numeric.LAPACK.Matrix.Array.Private (Matrix(Array), Quadratic) import Numeric.LAPACK.Matrix.Layout.Private (Packed) import qualified Type.Data.Bool as TBool
src/Numeric/LAPACK/Matrix/Array/Indexed.hs view
@@ -2,11 +2,11 @@ {-# LANGUAGE GADTs #-} module Numeric.LAPACK.Matrix.Array.Indexed where -import qualified Numeric.LAPACK.Matrix.Array as ArrMatrix+import qualified Numeric.LAPACK.Matrix.Array.Private as ArrMatrix import qualified Numeric.LAPACK.Matrix.Shape.Omni as Omni import qualified Numeric.LAPACK.Matrix.Layout.Private as Layout import qualified Numeric.LAPACK.Matrix.Extent as Extent-import Numeric.LAPACK.Matrix.Array (ArrayMatrix)+import Numeric.LAPACK.Matrix.Array.Private (ArrayMatrix) import Numeric.LAPACK.Scalar (conjugate, zero) import qualified Numeric.Netlib.Class as Class
src/Numeric/LAPACK/Matrix/Array/Mosaic.hs view
@@ -2,11 +2,11 @@ module Numeric.LAPACK.Matrix.Array.Mosaic where import qualified Numeric.LAPACK.Matrix.Mosaic.Basic as Mosaic-import qualified Numeric.LAPACK.Matrix.Array as ArrMatrix+import qualified Numeric.LAPACK.Matrix.Array.Private as ArrMatrix import qualified Numeric.LAPACK.Matrix.Shape.Omni as Omni import qualified Numeric.LAPACK.Matrix.Layout.Private as Layout import qualified Numeric.LAPACK.Matrix.Extent.Private as Extent-import Numeric.LAPACK.Matrix.Array (Square, Quadratic, FullQuadratic)+import Numeric.LAPACK.Matrix.Array.Private (Square, Quadratic, FullQuadratic) import Numeric.LAPACK.Matrix.Shape.Omni (Arbitrary, Unit) import Numeric.LAPACK.Matrix.Layout.Private (Empty, Filled, Bands, Packed, Unpacked)
src/Numeric/LAPACK/Matrix/Array/Multiply.hs view
@@ -17,7 +17,7 @@ import qualified Numeric.LAPACK.Matrix.Type as Matrix import qualified Numeric.LAPACK.Matrix.Array.Basic as OmniMatrix import qualified Numeric.LAPACK.Matrix.Array.Unpacked as Unpacked-import qualified Numeric.LAPACK.Matrix.Array as ArrMatrix+import qualified Numeric.LAPACK.Matrix.Array.Private as ArrMatrix import qualified Numeric.LAPACK.Matrix.Shape as MatrixShape import qualified Numeric.LAPACK.Matrix.Layout.Private as Layout import qualified Numeric.LAPACK.Matrix.Shape.Omni as Omni@@ -29,7 +29,7 @@ import Numeric.LAPACK.Matrix.Layout.Private (Filled, Empty, Bands, Packed, Unpacked, UnaryProxy, natFromProxy) import Numeric.LAPACK.Matrix.Array.Banded (Banded)-import Numeric.LAPACK.Matrix.Array (ArrayMatrix, diagTag)+import Numeric.LAPACK.Matrix.Array.Private (ArrayMatrix, diagTag) import Numeric.LAPACK.Matrix.Type (Matrix) import Numeric.LAPACK.Matrix.Modifier (Transposition(NonTransposed,Transposed)) import Numeric.LAPACK.Matrix.Shape.Omni (StripSingleton(StripBands, StripFilled))
+ src/Numeric/LAPACK/Matrix/Array/Private.hs view
@@ -0,0 +1,686 @@+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE EmptyDataDecls #-}+{-# LANGUAGE MultiParamTypeClasses #-}+{-# LANGUAGE GADTs #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE StandaloneDeriving #-}+module Numeric.LAPACK.Matrix.Array.Private (+ Matrix(Array),+ ArrayMatrix,+ Array,+ OmniArray,+ PlainArray,++ Full,+ General,+ Tall,+ Wide,+ LiberalSquare,+ Square,+ SquareMeas,+ Quadratic,+ FullQuadratic,+ QuadraticMeas,++ plainShape,+ shape,+ extent,+ subBandsSingleton,+ superBandsSingleton,+ packTag,+ diagTag,++ asPacked,+ asUnpacked,+ requirePacking,++ reshape,+ mapShape,+ unwrap,+ toVector,+ fromVector,+ lift0,+ lift1,+ lift2,+ lift3,+ lift4,+ unlift1,+ unlift2,+ unliftRow,+ unliftColumn,+ unpackedToVector,+ liftUnpacked0,+ liftUnpacked1,+ liftUnpacked2,+ liftUnpacked3,+ liftOmni1,+ liftOmni2,++ Homogeneous, Scale, zero, negate, scaleReal, scale, scaleRealReal, (.*#),+ order, forceOrder, adaptOrder,+ Additive, add, (#+#),+ Subtractive, sub, (#-#),++ MapExtent, mapExtent,+ ) where++import qualified Numeric.LAPACK.Matrix.Plain.Class as ArrClass+import qualified Numeric.LAPACK.Matrix.Type as Matrix+import qualified Numeric.LAPACK.Matrix.BandedHermitian.Basic as BandedHermitian+import qualified Numeric.LAPACK.Matrix.Banded.Basic as Banded+import qualified Numeric.LAPACK.Matrix.Triangular.Basic as Triangular+import qualified Numeric.LAPACK.Matrix.Mosaic.Basic as Mosaic+import qualified Numeric.LAPACK.Matrix.Plain as Plain+import qualified Numeric.LAPACK.Matrix.Basic as Basic+import qualified Numeric.LAPACK.Matrix.Shape.Omni as Omni+import qualified Numeric.LAPACK.Matrix.Shape as MatrixShape+import qualified Numeric.LAPACK.Matrix.Layout.Private as Layout+import qualified Numeric.LAPACK.Matrix.Extent.Private as Extent+import qualified Numeric.LAPACK.Matrix.Extent.Strict as ExtentStrict+import qualified Numeric.LAPACK.Vector as Vector+import Numeric.LAPACK.Matrix.Plain.Format (formatArray)+import Numeric.LAPACK.Matrix.Shape.Omni (Omni, Arbitrary)+import Numeric.LAPACK.Matrix.Layout.Private (Filled, Bands, Packed, Unpacked)+import Numeric.LAPACK.Matrix.Extent.Private (Extent, Shape, Size, Big, Small)+import Numeric.LAPACK.Matrix.Type (Matrix)+import Numeric.LAPACK.Vector (Vector)+import Numeric.LAPACK.Scalar (RealOf)++import qualified Type.Data.Num.Unary as Unary+import qualified Type.Data.Bool as TBool+import Type.Data.Bool (True)++import qualified Numeric.Netlib.Class as Class++import qualified Control.DeepSeq as DeepSeq++import qualified Data.Array.Comfort.Storable.Unchecked as Array+import qualified Data.Array.Comfort.Storable as CheckedArray+import qualified Data.Array.Comfort.Shape as Shape+import Data.Function.HT (Id)++import Foreign.Storable (Storable)++import Prelude hiding (negate)+++type OmniArray pack prop lower upper meas vert horiz height width a =+ Array.Array (Omni pack prop lower upper meas vert horiz height width) a++data Array pack property+data instance+ Matrix (Array pack prop) xl xu+ lower upper meas vert horiz height width a where+ Array ::+ OmniArray pack prop lower upper meas vert horiz height width a ->+ Matrix (Array pack prop) () () lower upper meas vert horiz height width a++deriving instance+ (Extent.Measure meas, Extent.C vert, Extent.C horiz,+ Shape.C height, Shape.C width, Storable a,+ Show height, Show width, Show a) =>+ Show (Matrix (Array pack prop) xl xu+ lower upper meas vert horiz height width a)++type ArrayMatrix pack property = Matrix (Array pack property) () ()+type UnpackedMatrix property = ArrayMatrix Unpacked property+++type Full meas vert horiz height width =+ UnpackedMatrix Arbitrary Filled Filled meas vert horiz height width+type General height width = Full Size Big Big height width+type Tall height width = Full Size Big Small height width+type Wide height width = Full Size Small Big height width+type LiberalSquare height width = SquareMeas Size height width+type Square sh = SquareMeas Shape sh sh+type SquareMeas meas height width = Full meas Small Small height width++type Quadratic pack property lower upper sh =+ QuadraticMeas pack property lower upper Shape sh sh+type FullQuadratic pack property sh = Quadratic pack property Filled Filled sh++type QuadraticMeas pack property lower upper meas height width =+ ArrayMatrix pack property lower upper meas Small Small height width+++instance Matrix.NFData (Array pack property) where+ rnf (Array arr) = DeepSeq.rnf arr++instance Matrix.Box (Array pack property) where+ extent (Array arr) = Omni.extent $ Array.shape arr++instance Matrix.Transpose (Array pack property) where+ transpose a@(Array _) =+ case shape a of+ Omni.Full _ -> liftUnpacked1 Basic.transpose a+ Omni.UpperTriangular _ -> lift1 Mosaic.transpose a+ Omni.LowerTriangular _ -> lift1 Mosaic.transpose a+ Omni.Symmetric _ -> a+ Omni.Hermitian _ -> lift1 Vector.conjugate a+ Omni.Banded _ -> lift1 Banded.transpose a+ Omni.UnitBandedTriangular _ -> lift1 Banded.transpose a+ Omni.BandedHermitian _ -> lift1 Vector.conjugate a+++asPacked ::+ Id (ArrayMatrix Packed property lower upper meas vert horiz height width a)+asPacked = id++asUnpacked ::+ Id (ArrayMatrix Unpacked property lower upper meas vert horiz height width a)+asUnpacked = id++requirePacking ::+ Layout.PackingSingleton pack ->+ Id (ArrayMatrix pack property lower upper meas vert horiz height width a)+requirePacking _ = id+++plainShape ::+ (Omni.ToPlain pack property lower upper meas vert horiz height width) =>+ ArrayMatrix pack property lower upper meas vert horiz height width a ->+ Omni.Plain pack property lower upper meas vert horiz height width+plainShape = Omni.toPlain . shape++shape ::+ ArrayMatrix pack property lower upper meas vert horiz height width a ->+ Omni pack property lower upper meas vert horiz height width+shape (Array a) = Array.shape a++extent ::+ (Extent.Measure meas, Extent.C vert, Extent.C horiz) =>+ ArrayMatrix pack property lower upper meas vert horiz height width a ->+ Extent meas vert horiz height width+extent = Omni.extent . shape+++subBandsSingleton ::+ (Unary.Natural sub) =>+ ArrayMatrix pack property+ (Layout.Bands sub) upper meas vert horiz height width a ->+ Unary.HeadSingleton sub+subBandsSingleton _ = Unary.headSingleton++superBandsSingleton ::+ (Unary.Natural super) =>+ ArrayMatrix pack property+ lower (Layout.Bands super) meas vert horiz height width a ->+ Unary.HeadSingleton super+superBandsSingleton _ = Unary.headSingleton+++reshape ::+ (Extent.Measure measA, Extent.C vertA, Extent.C horizA) =>+ (Extent.Measure measB, Extent.C vertB, Extent.C horizB) =>+ (Shape.C heightA, Shape.C widthA) =>+ (Shape.C heightB, Shape.C widthB) =>+ Omni packB propB lowerB upperB measB vertB horizB heightB widthB ->+ ArrayMatrix packA propA lowerA upperA measA vertA horizA heightA widthA a ->+ ArrayMatrix packB propB lowerB upperB measB vertB horizB heightB widthB a+reshape = liftOmni1 . CheckedArray.reshape++mapShape ::+ (Extent.Measure measA, Extent.C vertA, Extent.C horizA) =>+ (Extent.Measure measB, Extent.C vertB, Extent.C horizB) =>+ (Shape.C heightA, Shape.C widthA) =>+ (Shape.C heightB, Shape.C widthB) =>+ (Omni packA propA lowerA upperA measA vertA horizA heightA widthA ->+ Omni packB propB lowerB upperB measB vertB horizB heightB widthB) ->+ ArrayMatrix packA propA lowerA upperA measA vertA horizA heightA widthA a ->+ ArrayMatrix packB propB lowerB upperB measB vertB horizB heightB widthB a+mapShape = liftOmni1 . CheckedArray.mapShape+++type PlainArray pack prop lower upper meas vert horiz height width =+ Array.Array (Omni.Plain pack prop lower upper meas vert horiz height width)++toVector ::+ (Omni.ToPlain pack property lower upper meas vert horiz height width) =>+ ArrayMatrix pack property lower upper meas vert horiz height width a ->+ PlainArray pack property lower upper meas vert horiz height width a+toVector (Array a) = Array.mapShape Omni.toPlain a++unwrap ::+ ArrayMatrix pack property lower upper meas vert horiz height width a ->+ OmniArray pack property lower upper meas vert horiz height width a+unwrap (Array a) = a++fromVector ::+ (Omni.FromPlain pack prop lower upper meas vert horiz height width) =>+ (Omni.Plain pack prop lower upper meas vert horiz height width ~ shape) =>+ (Extent.Measure meas, Extent.C vert, Extent.C horiz) =>+ (Shape.C height, Shape.C width, Class.Floating a) =>+ Array.Array shape a ->+ ArrayMatrix pack prop lower upper meas vert horiz height width a+fromVector arr =+ let omni = Omni.fromPlain $ Array.shape arr+ in case ArrClass.check omni arr of+ Nothing -> Array $ Array.reshape omni arr+ Just msg -> error $ "Matrix.Array.fromVector: " ++ msg+++{- |+'lift0' is a synonym for 'fromVector' but lacks the admissibility check.+You may thus fool the type tags.+This applies to the other lift functions, too.+-}+lift0 ::+ (Omni.FromPlain pack prop lower upper meas vert horiz height width) =>+ PlainArray pack prop lower upper meas vert horiz height width a ->+ ArrayMatrix pack prop lower upper meas vert horiz height width a+lift0 = Array . Array.mapShape Omni.fromPlain++lift1 ::+ (Omni.ToPlain packA propA lowerA upperA measA vertA horizA heightA widthA) =>+ (Omni.FromPlain packB propB lowerB upperB measB vertB horizB heightB widthB)+ =>+ (PlainArray packA propA lowerA upperA measA vertA horizA heightA widthA a ->+ PlainArray packB propB lowerB upperB measB vertB horizB heightB widthB b) ->+ ArrayMatrix packA propA lowerA upperA measA vertA horizA heightA widthA a ->+ ArrayMatrix packB propB lowerB upperB measB vertB horizB heightB widthB b+lift1 f = lift0 . f . toVector++lift2 ::+ (Omni.ToPlain packA propA lowerA upperA measA vertA horizA heightA widthA) =>+ (Omni.ToPlain packB propB lowerB upperB measB vertB horizB heightB widthB) =>+ (Omni.FromPlain packC propC lowerC upperC measC vertC horizC heightC widthC)+ =>+ (PlainArray packA propA lowerA upperA measA vertA horizA heightA widthA a ->+ PlainArray packB propB lowerB upperB measB vertB horizB heightB widthB b ->+ PlainArray packC propC lowerC upperC measC vertC horizC heightC widthC c) ->+ ArrayMatrix packA propA lowerA upperA measA vertA horizA heightA widthA a ->+ ArrayMatrix packB propB lowerB upperB measB vertB horizB heightB widthB b ->+ ArrayMatrix packC propC lowerC upperC measC vertC horizC heightC widthC c+lift2 f = lift1 . f . toVector++lift3 ::+ (Omni.ToPlain packA propA lowerA upperA measA vertA horizA heightA widthA) =>+ (Omni.ToPlain packB propB lowerB upperB measB vertB horizB heightB widthB) =>+ (Omni.ToPlain packC propC lowerC upperC measC vertC horizC heightC widthC) =>+ (Omni.FromPlain packD propD lowerD upperD measD vertD horizD heightD widthD)+ =>+ (PlainArray packA propA lowerA upperA measA vertA horizA heightA widthA a ->+ PlainArray packB propB lowerB upperB measB vertB horizB heightB widthB b ->+ PlainArray packC propC lowerC upperC measC vertC horizC heightC widthC c ->+ PlainArray packD propD lowerD upperD measD vertD horizD heightD widthD d) ->+ ArrayMatrix packA propA lowerA upperA measA vertA horizA heightA widthA a ->+ ArrayMatrix packB propB lowerB upperB measB vertB horizB heightB widthB b ->+ ArrayMatrix packC propC lowerC upperC measC vertC horizC heightC widthC c ->+ ArrayMatrix packD propD lowerD upperD measD vertD horizD heightD widthD d+lift3 f = lift2 . f . toVector++lift4 ::+ (Omni.ToPlain packA propA lowerA upperA measA vertA horizA heightA widthA) =>+ (Omni.ToPlain packB propB lowerB upperB measB vertB horizB heightB widthB) =>+ (Omni.ToPlain packC propC lowerC upperC measC vertC horizC heightC widthC) =>+ (Omni.ToPlain packD propD lowerD upperD measD vertD horizD heightD widthD) =>+ (Omni.FromPlain packE propE lowerE upperE measE vertE horizE heightE widthE)+ =>+ (PlainArray packA propA lowerA upperA measA vertA horizA heightA widthA a ->+ PlainArray packB propB lowerB upperB measB vertB horizB heightB widthB b ->+ PlainArray packC propC lowerC upperC measC vertC horizC heightC widthC c ->+ PlainArray packD propD lowerD upperD measD vertD horizD heightD widthD d ->+ PlainArray packE propE lowerE upperE measE vertE horizE heightE widthE e) ->+ ArrayMatrix packA propA lowerA upperA measA vertA horizA heightA widthA a ->+ ArrayMatrix packB propB lowerB upperB measB vertB horizB heightB widthB b ->+ ArrayMatrix packC propC lowerC upperC measC vertC horizC heightC widthC c ->+ ArrayMatrix packD propD lowerD upperD measD vertD horizD heightD widthD d ->+ ArrayMatrix packE propE lowerE upperE measE vertE horizE heightE widthE e+lift4 f = lift3 . f . toVector+++unlift1 ::+ (Omni.FromPlain packA propA lowerA upperA measA vertA horizA heightA widthA)+ =>+ (Omni.ToPlain packB propB lowerB upperB measB vertB horizB heightB widthB) =>+ (ArrayMatrix packA propA lowerA upperA measA vertA horizA heightA widthA a ->+ ArrayMatrix packB propB lowerB upperB measB vertB horizB heightB widthB b) ->+ (PlainArray packA propA lowerA upperA measA vertA horizA heightA widthA a ->+ PlainArray packB propB lowerB upperB measB vertB horizB heightB widthB b)+unlift1 f = toVector . f . lift0++unlift2 ::+ (Omni.FromPlain packA propA lowerA upperA measA vertA horizA heightA widthA,+ Omni.FromPlain packB propB lowerB upperB measB vertB horizB heightB widthB)+ =>+ (Omni.ToPlain packC propC lowerC upperC measC vertC horizC heightC widthC) =>+ (ArrayMatrix packA propA lowerA upperA measA vertA horizA heightA widthA a ->+ ArrayMatrix packB propB lowerB upperB measB vertB horizB heightB widthB b ->+ ArrayMatrix packC propC lowerC upperC measC vertC horizC heightC widthC c) ->+ (PlainArray packA propA lowerA upperA measA vertA horizA heightA widthA a ->+ PlainArray packB propB lowerB upperB measB vertB horizB heightB widthB b ->+ PlainArray packC propC lowerC upperC measC vertC horizC heightC widthC c)+unlift2 f = unlift1 . f . lift0+++type FullArray meas vert horiz height width =+ Array.Array (Layout.Full meas vert horiz height width)++unpackedToVector ::+ (Omni.Property property, Omni.Strip lower, Omni.Strip upper) =>+ UnpackedMatrix property lower upper meas vert horiz height width a ->+ FullArray meas vert horiz height width a+unpackedToVector = Array.mapShape Omni.toFull . unwrap++liftUnpacked0 ::+ (Omni.Property propertyA, Omni.Strip lowerA, Omni.Strip upperA) =>+ (FullArray measA vertA horizA heightA widthA a) ->+ UnpackedMatrix propertyA lowerA upperA measA vertA horizA heightA widthA a+liftUnpacked0 = Array . Array.mapShape Omni.fromFull++liftUnpacked1 ::+ (Omni.Property propertyA, Omni.Strip lowerA, Omni.Strip upperA) =>+ (Omni.Property propertyB, Omni.Strip lowerB, Omni.Strip upperB) =>+ (FullArray measA vertA horizA heightA widthA a ->+ FullArray measB vertB horizB heightB widthB b) ->+ UnpackedMatrix propertyA lowerA upperA measA vertA horizA heightA widthA a ->+ UnpackedMatrix propertyB lowerB upperB measB vertB horizB heightB widthB b+liftUnpacked1 f = liftUnpacked0 . f . unpackedToVector++liftUnpacked2 ::+ (Omni.Property propertyA, Omni.Strip lowerA, Omni.Strip upperA) =>+ (Omni.Property propertyB, Omni.Strip lowerB, Omni.Strip upperB) =>+ (Omni.Property propertyC, Omni.Strip lowerC, Omni.Strip upperC) =>+ (FullArray measA vertA horizA heightA widthA a ->+ FullArray measB vertB horizB heightB widthB b ->+ FullArray measC vertC horizC heightC widthC c) ->+ UnpackedMatrix propertyA lowerA upperA measA vertA horizA heightA widthA a ->+ UnpackedMatrix propertyB lowerB upperB measB vertB horizB heightB widthB b ->+ UnpackedMatrix propertyC lowerC upperC measC vertC horizC heightC widthC c+liftUnpacked2 f = liftUnpacked1 . f . unpackedToVector++liftUnpacked3 ::+ (Omni.Property propertyA, Omni.Strip lowerA, Omni.Strip upperA) =>+ (Omni.Property propertyB, Omni.Strip lowerB, Omni.Strip upperB) =>+ (Omni.Property propertyC, Omni.Strip lowerC, Omni.Strip upperC) =>+ (Omni.Property propertyD, Omni.Strip lowerD, Omni.Strip upperD) =>+ (FullArray measA vertA horizA heightA widthA a ->+ FullArray measB vertB horizB heightB widthB b ->+ FullArray measC vertC horizC heightC widthC c ->+ FullArray measD vertD horizD heightD widthD d) ->+ UnpackedMatrix propertyA lowerA upperA measA vertA horizA heightA widthA a ->+ UnpackedMatrix propertyB lowerB upperB measB vertB horizB heightB widthB b ->+ UnpackedMatrix propertyC lowerC upperC measC vertC horizC heightC widthC c ->+ UnpackedMatrix propertyD lowerD upperD measD vertD horizD heightD widthD d+liftUnpacked3 f = liftUnpacked2 . f . unpackedToVector+++unliftRow ::+ Layout.Order ->+ (General () height0 a -> General () height1 b) ->+ Vector height0 a -> Vector height1 b+unliftRow order_ = Basic.unliftRow order_ . unlift1++unliftColumn ::+ Layout.Order ->+ (General height0 () a -> General height1 () b) ->+ Vector height0 a -> Vector height1 b+unliftColumn order_ = Basic.unliftColumn order_ . unlift1+++instance Matrix.FormatMatrix (Array pack property) where+ formatMatrix fmt a@(Array _) =+ case shape a of+ Omni.Full fullShape ->+ formatArray fmt $ Array.reshape fullShape $ unwrap a+ Omni.UpperTriangular _ -> formatArray fmt $ toVector a+ Omni.LowerTriangular _ -> formatArray fmt $ toVector a+ Omni.Symmetric _ -> formatArray fmt $ toVector a+ Omni.Hermitian _ -> formatArray fmt $ toVector a+ Omni.Banded _ -> formatArray fmt $ toVector a+ Omni.UnitBandedTriangular _ -> formatArray fmt $ toVector a+ Omni.BandedHermitian _ -> formatArray fmt $ toVector a+++packTag ::+ (Layout.Packing pack) =>+ ArrayMatrix pack diag lower upper meas vert horiz height width a ->+ Layout.PackingSingleton pack+packTag _ = Layout.autoPacking++diagTag ::+ (Omni.TriDiag diag) =>+ ArrayMatrix pack diag lower upper meas vert horiz height width a ->+ Omni.DiagSingleton diag+diagTag _ = Omni.autoDiag++instance+ (Layout.Packing pack, Omni.TriDiag diag, xl ~ (), xu ~ ()) =>+ Matrix.MultiplySame (Array pack diag) xl xu where+ multiplySame a =+ case Omni.powerSingleton $ shape a of+ Omni.PowerIdentity -> \b ->+ if Matrix.squareSize a == Matrix.squareSize b+ then b+ else error "multiplySame Identity: shape mismatch"+ Omni.PowerUpperTriangular ->+ lift2 (Triangular.multiply $ diagTag a) a+ Omni.PowerLowerTriangular ->+ lift2 (Triangular.multiply $ diagTag a) a+ Omni.PowerDiagonal ->+ case (diagTag a, shape a) of+ (MatrixShape.Unit, Omni.UnitBandedTriangular _) ->+ lift2 Banded.multiply a+ (MatrixShape.Arbitrary, Omni.Banded _) ->+ lift2 Banded.multiply a+ (_, Omni.Full _) -> liftUnpacked2 Basic.multiply a+ Omni.PowerSymmetric ->+ case diagTag a of _ -> error "Symmetric forbidden"+ Omni.PowerHermitian ->+ case diagTag a of _ -> error "Hermitian forbidden"+ Omni.PowerFull -> liftUnpacked2 Basic.multiply a+++{-+ToDo: implement using Array.Omni.identityOrderAux.+however, we must prevent module cycle++instance+ (meas ~ Extent.Shape, vert ~ Extent.Small, horiz ~ Extent.Small,+ height ~ width, Shape.Static width) =>+ Matrix.StaticIdentity+ (Array pack property lower upper meas vert horiz height width) where+ staticIdentity =+ OmniBasic.identityOrder Layout.RowMajor Shape.static+-}+++class (Omni.Property property) => Homogeneous property where+instance Homogeneous Arbitrary where+instance Homogeneous Omni.Symmetric where+instance (zero ~ True, neg ~ pos, TBool.C pos) =>+ Homogeneous (Omni.Hermitian neg zero pos) where++zero ::+ (Homogeneous property) =>+ (Extent.Measure meas, Extent.C vert, Extent.C horiz) =>+ (Shape.C height, Shape.C width, Class.Floating a) =>+ Omni pack property lower upper meas vert horiz height width ->+ ArrayMatrix pack property lower upper meas vert horiz height width a+zero = Array . Vector.zero++negate ::+ (Homogeneous property) =>+ (Extent.Measure meas, Extent.C vert, Extent.C horiz) =>+ (Shape.C height, Shape.C width, Class.Floating a) =>+ ArrayMatrix pack property lower upper meas vert horiz height width a ->+ ArrayMatrix pack property lower upper meas vert horiz height width a+negate (Array a) = Array $ Vector.negate a++scaleReal ::+ (Homogeneous property) =>+ (Extent.Measure meas, Extent.C vert, Extent.C horiz) =>+ (Shape.C height, Shape.C width, Class.Floating a) =>+ RealOf a ->+ ArrayMatrix pack property lower upper meas vert horiz height width a ->+ ArrayMatrix pack property lower upper meas vert horiz height width a+scaleReal a (Array v) = Array $ Vector.scaleReal a v++newtype ScaleReal f a = ScaleReal {getScaleReal :: a -> f a -> f a}++scaleRealReal ::+ (Homogeneous property) =>+ (Extent.Measure meas, Extent.C vert, Extent.C horiz) =>+ (Shape.C height, Shape.C width, Class.Real a) =>+ a ->+ ArrayMatrix pack property lower upper meas vert horiz height width a ->+ ArrayMatrix pack property lower upper meas vert horiz height width a+scaleRealReal =+ getScaleReal $ Class.switchReal (ScaleReal scaleReal) (ScaleReal scaleReal)+++class (Homogeneous property) => Scale property where+instance Scale Arbitrary where+instance Scale Omni.Symmetric where++scale, (.*#) ::+ (Extent.Measure meas, Extent.C vert, Extent.C horiz) =>+ (Scale property, Shape.C height, Shape.C width, Class.Floating a) =>+ a ->+ ArrayMatrix pack property lower upper meas vert horiz height width a ->+ ArrayMatrix pack property lower upper meas vert horiz height width a+scale a (Array v) = Array $ Vector.scale a v+(.*#) = scale++infixl 7 .*#+++order ::+ ArrayMatrix pack property lower upper meas vert horiz height width a ->+ Layout.Order+order = Omni.order . shape++forceOrder ::+ (Extent.Measure meas, Extent.C vert, Extent.C horiz) =>+ (Shape.C height, Shape.C width, Class.Floating a) =>+ Layout.Order ->+ ArrayMatrix pack property lower upper meas vert horiz height width a ->+ ArrayMatrix pack property lower upper meas vert horiz height width a+forceOrder order_ a =+ case shape a of+ Omni.UpperTriangular _ -> lift1 (Triangular.forceOrder order_) a+ Omni.LowerTriangular _ -> lift1 (Triangular.forceOrder order_) a+ Omni.Full _ -> liftUnpacked1 (Basic.forceOrder order_) a+ Omni.Symmetric _ -> lift1 (Triangular.forceOrder order_) a+ Omni.Hermitian _ -> lift1 (Triangular.forceOrder order_) a+ Omni.Banded _ -> lift1 (Banded.forceOrder order_) a+ Omni.BandedHermitian _ -> lift1 (BandedHermitian.forceOrder order_) a+ Omni.UnitBandedTriangular _ -> lift1 (Banded.forceOrder order_) a++{- |+@adaptOrder x y@ contains the data of @y@ with the layout of @x@.+-}+adaptOrder ::+ (Extent.Measure meas, Extent.C vert, Extent.C horiz) =>+ (Shape.C height, Shape.C width, Class.Floating a) =>+ ArrayMatrix pack property lower upper meas vert horiz height width a ->+ ArrayMatrix pack property lower upper meas vert horiz height width a ->+ ArrayMatrix pack property lower upper meas vert horiz height width a+adaptOrder = forceOrder . order+++class (Omni.Property property) => Additive property where+instance Additive Arbitrary where+instance Additive Omni.Symmetric where+instance (TBool.C neg, TBool.C zero, TBool.C pos) =>+ Additive (Omni.Hermitian neg zero pos) where++class (Additive property) => Subtractive property where+instance Subtractive Arbitrary where+instance Subtractive Omni.Symmetric where+instance (TBool.C neg, TBool.C zero, neg ~ pos) =>+ Subtractive (Omni.Hermitian neg zero pos) where++infixl 6 #+#, #-#, `add`, `sub`++add, (#+#) ::+ (Extent.Measure meas, Extent.C vert, Extent.C horiz) =>+ (Additive property,+ Shape.C height, Eq height, Shape.C width, Eq width, Class.Floating a) =>+ ArrayMatrix pack property lower upper meas vert horiz height width a ->+ ArrayMatrix pack property lower upper meas vert horiz height width a ->+ ArrayMatrix pack property lower upper meas vert horiz height width a+add a b = liftOmni2 Vector.add (adaptOrder b a) b++sub, (#-#) ::+ (Extent.Measure meas, Extent.C vert, Extent.C horiz) =>+ (Subtractive property,+ Shape.C height, Eq height, Shape.C width, Eq width, Class.Floating a) =>+ ArrayMatrix pack property lower upper meas vert horiz height width a ->+ ArrayMatrix pack property lower upper meas vert horiz height width a ->+ ArrayMatrix pack property lower upper meas vert horiz height width a+sub a b = liftOmni2 Vector.sub (adaptOrder b a) b++(#+#) = add+(#-#) = sub+++liftOmni1 ::+ (OmniArray packA propA lowerA upperA measA vertA horizA heightA widthA a ->+ OmniArray packB propB lowerB upperB measB vertB horizB heightB widthB b)+ ->+ ArrayMatrix packA propA lowerA upperA measA vertA horizA heightA widthA a ->+ ArrayMatrix packB propB lowerB upperB measB vertB horizB heightB widthB b+liftOmni1 f (Array a) = Array $ f a++liftOmni2 ::+ (OmniArray packA propA lowerA upperA measA vertA horizA heightA widthA a ->+ OmniArray packB propB lowerB upperB measB vertB horizB heightB widthB b ->+ OmniArray packC propC lowerC upperC measC vertC horizC heightC widthC c)+ ->+ ArrayMatrix packA propA lowerA upperA measA vertA horizA heightA widthA a ->+ ArrayMatrix packB propB lowerB upperB measB vertB horizB heightB widthB b ->+ ArrayMatrix packC propC lowerC upperC measC vertC horizC heightC widthC c+liftOmni2 f (Array a) (Array b) = Array $ f a b++++instance Matrix.ToQuadratic (Array pack property) where+ heightToQuadratic a@(Array _) =+ case shape a of+ Omni.Full _ ->+ ($a) $ liftUnpacked1 $ Basic.mapExtent $+ Extent.square . Extent.height+ Omni.UpperTriangular _ -> a+ Omni.LowerTriangular _ -> a+ Omni.Symmetric _ -> a+ Omni.Hermitian _ -> a+ Omni.Banded _ ->+ ($a) $ lift1 $ Banded.mapExtentSizes $ Extent.square . Extent.height+ Omni.UnitBandedTriangular _ -> a+ Omni.BandedHermitian _ -> a+ widthToQuadratic a@(Array _) =+ case shape a of+ Omni.Full _ ->+ ($a) $ liftUnpacked1 $ Basic.mapExtent $+ Extent.square . Extent.width+ Omni.UpperTriangular _ -> a+ Omni.LowerTriangular _ -> a+ Omni.Symmetric _ -> a+ Omni.Hermitian _ -> a+ Omni.Banded _ ->+ ($a) $ lift1 $ Banded.mapExtentSizes $ Extent.square . Extent.width+ Omni.UnitBandedTriangular _ -> a+ Omni.BandedHermitian _ -> a+++instance+ (MapExtent pack property lower upper, xl ~ (), xu ~ ()) =>+ Matrix.MapExtent (Array pack property) xl xu lower upper where+ mapExtent = mapExtent++class MapExtent pack property lower upper where+ mapExtent ::+ (Extent.Measure measA, Extent.C vertA, Extent.C horizA) =>+ (Extent.Measure measB, Extent.C vertB, Extent.C horizB) =>+ ExtentStrict.Map measA vertA horizA measB vertB horizB height width ->+ ArrayMatrix pack property lower upper measA vertA horizA height width a ->+ ArrayMatrix pack property lower upper measB vertB horizB height width a++instance MapExtent Unpacked Arbitrary Filled Filled where+ mapExtent = lift1 . Plain.mapExtent . ExtentStrict.apply++instance+ (Unary.Natural sub, Unary.Natural super) =>+ MapExtent Packed Arbitrary (Bands sub) (Bands super) where+ mapExtent = lift1 . Banded.mapExtent . ExtentStrict.apply
src/Numeric/LAPACK/Matrix/Array/Unpacked.hs view
@@ -1,7 +1,7 @@ {-# LANGUAGE TypeOperators #-} module Numeric.LAPACK.Matrix.Array.Unpacked where -import qualified Numeric.LAPACK.Matrix.Array as ArrMatrix+import qualified Numeric.LAPACK.Matrix.Array.Private as ArrMatrix import qualified Numeric.LAPACK.Matrix.Square.Basic as Square import qualified Numeric.LAPACK.Matrix.Plain as Plain import qualified Numeric.LAPACK.Matrix.Basic as Basic@@ -66,6 +66,12 @@ Unpacked property lower upper meas vert horiz height width a -> Unpacked property lower Layout.Filled meas vert horiz height width a fillUpper = ArrMatrix.liftUnpacked1 id++fillBoth ::+ (Omni.Property property, Omni.Strip lower, Omni.Strip upper) =>+ Unpacked property lower upper meas vert horiz height width a ->+ Unpacked property Layout.Filled Layout.Filled meas vert horiz height width a+fillBoth = ArrMatrix.liftUnpacked1 id mapExtent ::
src/Numeric/LAPACK/Matrix/Banded.hs view
@@ -45,7 +45,7 @@ import qualified Numeric.LAPACK.Matrix.Array.Banded as Banded import qualified Numeric.LAPACK.Matrix.Array.Mosaic as Triangular-import qualified Numeric.LAPACK.Matrix.Array as ArrMatrix+import qualified Numeric.LAPACK.Matrix.Array.Private as ArrMatrix import qualified Numeric.LAPACK.Matrix.Shape as MatrixShape import qualified Numeric.LAPACK.Matrix.Shape.Omni as Omni import qualified Numeric.LAPACK.Matrix.Layout.Private as Layout@@ -53,7 +53,7 @@ import qualified Numeric.LAPACK.Matrix.Extent as Extent import qualified Numeric.LAPACK.Scalar as Scalar import Numeric.LAPACK.Matrix.Array.Banded (FlexBanded, Banded, Diagonal)-import Numeric.LAPACK.Matrix.Array (Full, diagTag)+import Numeric.LAPACK.Matrix.Array.Private (Full, diagTag) import Numeric.LAPACK.Matrix.Layout.Private (Order, UnaryProxy) import Numeric.LAPACK.Vector (Vector)
src/Numeric/LAPACK/Matrix/BandedHermitian.hs view
@@ -37,7 +37,7 @@ import qualified Numeric.LAPACK.Matrix.Array.Hermitian as Hermitian import qualified Numeric.LAPACK.Matrix.Array.Banded as Banded-import qualified Numeric.LAPACK.Matrix.Array as ArrMatrix+import qualified Numeric.LAPACK.Matrix.Array.Private as ArrMatrix import qualified Numeric.LAPACK.Matrix.Shape.Omni as Omni import qualified Numeric.LAPACK.Matrix.Shape as MatrixShape import qualified Numeric.LAPACK.Matrix.Extent as Extent@@ -45,7 +45,7 @@ import qualified Numeric.LAPACK.Shape as ExtShape import Numeric.LAPACK.Matrix.Array.Banded (Square) import Numeric.LAPACK.Matrix.Array.Mosaic (FlexHermitian)-import Numeric.LAPACK.Matrix.Array (Full)+import Numeric.LAPACK.Matrix.Array.Private (Full) import Numeric.LAPACK.Matrix.Layout.Private (Order, UnaryProxy, natFromProxy) import Numeric.LAPACK.Matrix.Modifier (Transposition(NonTransposed, Transposed)) import Numeric.LAPACK.Vector (Vector)
src/Numeric/LAPACK/Matrix/BandedHermitianPositiveDefinite.hs view
@@ -16,9 +16,9 @@ as Linear import qualified Numeric.LAPACK.Matrix.Array.Hermitian as Hermitian import qualified Numeric.LAPACK.Matrix.Array.Banded as Banded-import qualified Numeric.LAPACK.Matrix.Array as ArrMatrix+import qualified Numeric.LAPACK.Matrix.Array.Private as ArrMatrix import qualified Numeric.LAPACK.Matrix.Extent as Extent-import Numeric.LAPACK.Matrix.Array (Full)+import Numeric.LAPACK.Matrix.Array.Private (Full) import Numeric.LAPACK.Scalar (RealOf) import qualified Numeric.Netlib.Class as Class
+ src/Numeric/LAPACK/Matrix/Block.hs view
@@ -0,0 +1,232 @@+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE TypeOperators #-}+{-# LANGUAGE GADTs #-}+{-# LANGUAGE EmptyDataDecls #-}+{-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE UndecidableInstances #-}+{-# LANGUAGE MultiParamTypeClasses #-}+module Numeric.LAPACK.Matrix.Block where++import qualified Numeric.LAPACK.Matrix as Matrix+import qualified Numeric.LAPACK.Matrix.Class as MatrixClass+import qualified Numeric.LAPACK.Matrix.Divide as Divide+import qualified Numeric.LAPACK.Matrix.Multiply as Multiply+import qualified Numeric.LAPACK.Matrix.Square as Square+import qualified Numeric.LAPACK.Matrix.Array.Unpacked as Unpacked+import qualified Numeric.LAPACK.Matrix.Array.Private as ArrMatrix+import qualified Numeric.LAPACK.Matrix.Shape.Omni as Omni+import qualified Numeric.LAPACK.Matrix.Layout as Layout+import qualified Numeric.LAPACK.Matrix.Extent.Private as Extent+import qualified Numeric.Netlib.Class as Class+import Numeric.LAPACK.Matrix.Divide (determinant)+import Numeric.LAPACK.Matrix.Type (Matrix, Quadratic, extent, squareSize)+import Numeric.LAPACK.Matrix.Layout.Private (Filled)+import Numeric.LAPACK.Matrix.Extent.Private (Size, Big)+import Numeric.LAPACK.Matrix ((#*#), (#-#), (===), (|||))+import Numeric.LAPACK.Vector ((|+|))+import Numeric.LAPACK.Shape.Private (Unchecked(Unchecked), deconsUnchecked)++import qualified Data.Array.Comfort.Storable as Array+import qualified Data.Array.Comfort.Shape as Shape+import Data.Array.Comfort.Shape ((::+)((::+)))++++data Square typ00 typ01 typ10 typ11+data instance+ Matrix (Square typ00 typ01 typ10 typ11) xl xu+ lower upper meas vert horiz height width a where+ Square ::+ (Extent.Measure measOff, Extent.C vertOff, Extent.C horizOff,+ Shape.C sh0, Eq sh0, Shape.C sh1, Eq sh1) =>+ Quadratic typ00 xl00 xu00 Filled Filled sh0 a ->+ Matrix typ01 xl01 xu01 Filled Filled measOff vertOff horizOff sh0 sh1 a ->+ Matrix typ10 xl10 xu10 Filled Filled measOff horizOff vertOff sh1 sh0 a ->+ Quadratic typ11 xl11 xu11 Filled Filled sh1 a ->+ Quadratic+ (Square typ00 typ01 typ10 typ11)+ (xl00,xl10,xl01,xl11) (xu00,xu01,xu10,xu11)+ Filled Filled (sh0::+sh1) a++instance+ (Matrix.Box typ00, Matrix.Box typ11) =>+ Matrix.Box (Square typ00 typ01 typ10 typ11) where+ extent (Square a _b _c d) = Extent.square (squareSize a ::+ squareSize d)++transposeSquare ::+ (Matrix.Transpose typ00, Matrix.Transpose typ01) =>+ (Matrix.Transpose typ10, Matrix.Transpose typ11) =>+ (Class.Floating a) =>+ Matrix (Square typ00 typ01 typ10 typ11) xl xu+ lower upper meas vert horiz height width a ->+ Matrix (Square typ00 typ10 typ01 typ11) xu xl+ upper lower meas horiz vert width height a+transposeSquare (Square a b c d) =+ Square+ (Matrix.transpose a) (Matrix.transpose c)+ (Matrix.transpose b) (Matrix.transpose d)++instance+ (xl ~ (xl00,xl10,xl01,xl11),+ xu ~ (xu00,xu01,xu10,xu11),+ Multiply.MultiplyVector typ00 xl00 xu00,+ Multiply.MultiplyVector typ01 xl01 xu01,+ Multiply.MultiplyVector typ10 xl10 xu10,+ Multiply.MultiplyVector typ11 xl11 xu11) =>+ Multiply.MultiplyVector (Square typ00 typ01 typ10 typ11) xl xu where+ matrixVector (Square a b c d) x =+ let (x0,x1) = Array.split x+ in Array.append+ (Multiply.matrixVector a x0 |+| Multiply.matrixVector b x1)+ (Multiply.matrixVector c x0 |+| Multiply.matrixVector d x1)+ vectorMatrix x (Square a b c d) =+ let (x0,x1) = Array.split x+ in Array.append+ (Multiply.vectorMatrix x0 a |+| Multiply.vectorMatrix x1 c)+ (Multiply.vectorMatrix x0 b |+| Multiply.vectorMatrix x1 d)+++type TypeFull = ArrMatrix.Array Layout.Unpacked Omni.Arbitrary++schurComplement ::+ (Divide.Solve typ11 xl11 xu11,+ Omni.Strip lower, Omni.Strip upper, Class.Floating a) =>+ Quadratic+ (Square TypeFull TypeFull TypeFull typ11)+ ((),(),(),xl11) ((),(),(),xu11)+ lower upper (sh0::+sh1) a ->+ Square.Square sh0 a+schurComplement (Square a b c d) =+ Unpacked.fillBoth a+ #-#+ Square.fromFull+ (Matrix.fromFull b #*# Matrix.fromFull (Divide.solveRight d c))++{- |+Requires that the right bottom sub-matrix is invertible.+-}+instance+ (xl ~ ((),(),(),xl11),+ xu ~ ((),(),(),xu11),+ typ00 ~ TypeFull,+ typ01 ~ TypeFull,+ typ10 ~ TypeFull,+ Divide.Solve typ11 xl11 xu11,+ Divide.Determinant typ11 xl11 xu11) =>+ Divide.Determinant (Square typ00 typ01 typ10 typ11) xl xu where+ determinant sq@(Square _a _b _c d) =+ determinant d * determinant (schurComplement sq)+++withoutHeightCheck ::+ (MatrixClass.MapSize typ0, Extent.C vert0, Extent.C horiz0) =>+ (MatrixClass.MapSize typ1, Extent.C vert1, Extent.C horiz1) =>+ (MatrixClass.MapSize typ2, Extent.C vert2, Extent.C horiz2) =>+ (Matrix typ0 xl0 xu0 lower0 upper0 Size vert0 horiz0 ~ matrix0) =>+ (Matrix typ1 xl1 xu1 lower1 upper1 Size vert1 horiz1 ~ matrix1) =>+ (Matrix typ2 xl2 xu2 lower2 upper2 Size vert2 horiz2 ~ matrix2) =>+ (Shape.C height0, Shape.C width0) =>+ (Shape.C height1, Shape.C width1) =>+ (Shape.C height2, Shape.C width2) =>+ (matrix0 (Unchecked height0) width0 a0 ->+ matrix1 (Unchecked height1) width1 a1 ->+ matrix2 (Unchecked height2) width2 a2) ->+ matrix0 height0 width0 a0 ->+ matrix1 height1 width1 a1 ->+ matrix2 height2 width2 a2+withoutHeightCheck op a b =+ Matrix.mapHeight deconsUnchecked $+ Matrix.mapHeight Unchecked a `op` Matrix.mapHeight Unchecked b++withoutWidthCheck ::+ (MatrixClass.MapSize typ0, Extent.C vert0, Extent.C horiz0) =>+ (MatrixClass.MapSize typ1, Extent.C vert1, Extent.C horiz1) =>+ (MatrixClass.MapSize typ2, Extent.C vert2, Extent.C horiz2) =>+ (Matrix typ0 xl0 xu0 lower0 upper0 Size vert0 horiz0 ~ matrix0) =>+ (Matrix typ1 xl1 xu1 lower1 upper1 Size vert1 horiz1 ~ matrix1) =>+ (Matrix typ2 xl2 xu2 lower2 upper2 Size vert2 horiz2 ~ matrix2) =>+ (Shape.C height0, Shape.C width0) =>+ (Shape.C height1, Shape.C width1) =>+ (Shape.C height2, Shape.C width2) =>+ (matrix0 height0 (Unchecked width0) a0 ->+ matrix1 height1 (Unchecked width1) a1 ->+ matrix2 height2 (Unchecked width2) a2) ->+ matrix0 height0 width0 a0 ->+ matrix1 height1 width1 a1 ->+ matrix2 height2 width2 a2+withoutWidthCheck op a b =+ Matrix.mapWidth deconsUnchecked $+ Matrix.mapWidth Unchecked a `op` Matrix.mapWidth Unchecked b++{- |+Requires that the right bottom sub-matrix is invertible.+-}+instance+ (xl ~ ((),(),(),xl11),+ xu ~ ((),(),(),xu11),+ typ00 ~ TypeFull,+ typ01 ~ TypeFull,+ typ10 ~ TypeFull,+ Divide.Solve typ11 xl11 xu11) =>+ Divide.Solve (Square typ00 typ01 typ10 typ11) xl xu where+ solveRight sq@(Square _a b c d) x =+ let x0 = Matrix.takeTop $ Matrix.fromFull x+ x1 = Matrix.takeBottom $ Matrix.fromFull x+ xComplement =+ withoutWidthCheck (#-#) x0 $+ Matrix.fromFull b #*# Divide.solveRight d x1+ y = Divide.solveRight (schurComplement sq) xComplement+ in -- ToDo: does it always has correct order?+ ArrMatrix.reshape (ArrMatrix.shape x) $+ withoutWidthCheck (===) y+ (Divide.solveRight d $+ withoutWidthCheck (#-#) x1 $ Matrix.fromFull c #*# y)+ solveLeft x sq@(Square _a b c d) =+ let x0 = Matrix.takeLeft $ Matrix.fromFull x+ x1 = Matrix.takeRight $ Matrix.fromFull x+ xComplement =+ withoutHeightCheck (#-#) x0 $+ Divide.solveLeft x1 d #*# Matrix.fromFull c+ y = Divide.solveLeft xComplement (schurComplement sq)+ in -- ToDo: does it always has correct order?+ ArrMatrix.reshape (ArrMatrix.shape x) $+ withoutHeightCheck (|||) y+ (Divide.solveLeft+ (withoutHeightCheck (#-#) x1 $ y #*# Matrix.fromFull b)+ d)++{-+instance+ (xl ~ ((),(),(),xl11),+ xu ~ ((),(),(),xu11),+ typ00 ~ TypeFull,+ typ01 ~ TypeFull,+ typ10 ~ TypeFull,+ Divide.Inverse typ11 xl11 xu11) =>+ Divide.Inverse (Square typ00 typ01 typ10 typ11) xl xu where+ inverse (Square a b c d) =+ let as = a #-# b #*# Divide.solveRight d c+ bdinv = Divide.solveLeft b d+ dinvc = Divide.solveRight d c+ br = Divide.solveRight as bdinv+ cr = Divide.solveLeft dinvc as+ in Square+ (inverse as)+ (Matrix.negate br)+ (Matrix.negate cr)+ (inverse d #+# br #*# bdinv)+-}+++data Mosaic typ0 typOff typ1+data instance+ Matrix (Mosaic typ0 typOff typ1) xl xu+ lower upper meas vert horiz height width a where+ Mosaic ::+ Quadratic typ0 xl0 xu0 lower upper sh0 a ->+ Matrix typOff xlOff xuOff Filled Filled Size Big Big sh0 sh1 a ->+ Quadratic typ1 xl1 xu1 lower upper sh1 a ->+ Quadratic+ (Mosaic typ0 typOff typ1)+ (xl0,xlOff,xl1) (xu0,xuOff,xu1)+ lower upper (sh0::+sh1) a
src/Numeric/LAPACK/Matrix/Class.hs view
@@ -1,6 +1,4 @@ {-# LANGUAGE TypeFamilies #-}-{-# LANGUAGE FlexibleInstances #-}-{-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE GADTs #-} module Numeric.LAPACK.Matrix.Class ( SquareShape(toSquare, takeDiagonal, mapSquareSize, identityFrom),@@ -8,15 +6,17 @@ trace, Complex(conjugate, fromReal, toComplex), adjoint,+ Unpack(unpack), toFull, ) where import qualified Numeric.LAPACK.Matrix.Array.Basic as OmniMatrix-import qualified Numeric.LAPACK.Matrix.Array as ArrMatrix+import qualified Numeric.LAPACK.Matrix.Array.Private as ArrMatrix import qualified Numeric.LAPACK.Matrix.Type as Matrix import qualified Numeric.LAPACK.Matrix.Banded.Basic as Banded import qualified Numeric.LAPACK.Matrix.Layout.Private as Layout import qualified Numeric.LAPACK.Matrix.Extent.Private as Extent import qualified Numeric.LAPACK.Matrix.Permutation as Permutation+import qualified Numeric.LAPACK.Matrix.Shape.Omni as Omni import qualified Numeric.LAPACK.Permutation.Private as Perm import qualified Numeric.LAPACK.Permutation as PermPub import qualified Numeric.LAPACK.Vector as Vector@@ -149,3 +149,36 @@ instance MapSize (ArrMatrix.Array pack property) where mapHeight f a@(ArrMatrix.Array _) = OmniMatrix.mapHeight f a mapWidth f a@(ArrMatrix.Array _) = OmniMatrix.mapWidth f a+++class Unpack typ where+ -- In contrast to OmniMatrix.unpack it cannot maintain the matrix property.+ unpack ::+ (Omni.Strip lower, Omni.Strip upper) =>+ (Extent.Measure meas, Extent.C vert, Extent.C horiz) =>+ (Shape.C height, Shape.C width, Class.Floating a) =>+ Matrix typ xl xu lower upper meas vert horiz height width a ->+ ArrMatrix.ArrayMatrix Layout.Unpacked Omni.Arbitrary+ lower upper meas vert horiz height width a++instance (Omni.Property prop) => Unpack (ArrMatrix.Array pack prop) where+ unpack a@(ArrMatrix.Array _) =+ ArrMatrix.liftUnpacked1 id $ OmniMatrix.unpack a++instance Unpack Matrix.Scale where+ unpack (Matrix.Scale sh a) =+ ArrMatrix.liftUnpacked0 $ Banded.toFull $+ Banded.diagonal Layout.RowMajor $ Vector.constant sh a++instance Unpack Matrix.Permutation where+ unpack (Matrix.Permutation perm) =+ ArrMatrix.liftUnpacked1 id $ PermPub.toMatrix perm++toFull ::+ (Unpack typ) =>+ (Omni.Strip lower, Omni.Strip upper) =>+ (Extent.Measure meas, Extent.C vert, Extent.C horiz) =>+ (Shape.C height, Shape.C width, Class.Floating a) =>+ Matrix typ xl xu lower upper meas vert horiz height width a ->+ ArrMatrix.Full meas vert horiz height width a+toFull = OmniMatrix.toFull . unpack
src/Numeric/LAPACK/Matrix/Diagonal.hs view
@@ -3,6 +3,7 @@ module Numeric.LAPACK.Matrix.Diagonal ( Diagonal, FlexDiagonal, fromList, autoFromList,+ fromVector, lift, stack, (%%%),@@ -18,7 +19,7 @@ import qualified Numeric.LAPACK.Matrix.Quadratic as Quad import qualified Numeric.LAPACK.Matrix.Banded as Banded -import qualified Numeric.LAPACK.Matrix.Array as ArrMatrix+import qualified Numeric.LAPACK.Matrix.Array.Private as ArrMatrix import qualified Numeric.LAPACK.Matrix.Basic as FullBasic import qualified Numeric.LAPACK.Matrix.Shape.Omni as Omni import qualified Numeric.LAPACK.Matrix.Layout.Private as Layout@@ -48,8 +49,10 @@ fromList order sh = Banded.squareFromList (Proxy,Proxy) order sh autoFromList :: (Storable a) => Order -> [a] -> Diagonal ShapeInt a-autoFromList order =- ArrMatrix.Array . Array.mapShape (Omni.quadratic order) . Vector.autoFromList+autoFromList order = fromVector order . Vector.autoFromList++fromVector :: (Shape.C sh, Storable a) => Order -> Vector sh a -> Diagonal sh a+fromVector order = ArrMatrix.Array . Array.mapShape (Omni.quadratic order) takeDiagonal ::
src/Numeric/LAPACK/Matrix/Divide.hs view
@@ -8,7 +8,7 @@ import qualified Numeric.LAPACK.Matrix.Multiply as Multiply import qualified Numeric.LAPACK.Matrix.Array.Divide as ArrDivide import qualified Numeric.LAPACK.Matrix.Array.Unpacked as Unpacked-import qualified Numeric.LAPACK.Matrix.Array as ArrMatrix+import qualified Numeric.LAPACK.Matrix.Array.Private as ArrMatrix import qualified Numeric.LAPACK.Matrix.Permutation as PermMatrix import qualified Numeric.LAPACK.Matrix.Type as Matrix import qualified Numeric.LAPACK.Matrix.Shape as MatrixShape@@ -16,7 +16,7 @@ import qualified Numeric.LAPACK.Matrix.Layout.Private as Layout import qualified Numeric.LAPACK.Matrix.Extent.Private as Extent import qualified Numeric.LAPACK.Vector as Vector-import Numeric.LAPACK.Matrix.Array (Full)+import Numeric.LAPACK.Matrix.Array.Private (Full) import Numeric.LAPACK.Matrix.Type (scaleWithCheck) import Numeric.LAPACK.Matrix.Modifier (Transposition(NonTransposed,Transposed),
src/Numeric/LAPACK/Matrix/Full.hs view
@@ -13,11 +13,11 @@ ) where import qualified Numeric.LAPACK.Matrix.Array.Unpacked as Unpacked-import qualified Numeric.LAPACK.Matrix.Array as ArrMatrix+import qualified Numeric.LAPACK.Matrix.Array.Private as ArrMatrix import qualified Numeric.LAPACK.Matrix.Basic as Basic import qualified Numeric.LAPACK.Matrix.Plain as Plain import qualified Numeric.LAPACK.Matrix.Extent as Extent-import Numeric.LAPACK.Matrix.Array (Full)+import Numeric.LAPACK.Matrix.Array.Private (Full) import Numeric.LAPACK.Vector (Vector) import qualified Numeric.Netlib.Class as Class
src/Numeric/LAPACK/Matrix/Function.hs view
@@ -17,19 +17,19 @@ import qualified Numeric.LAPACK.Matrix.Quadratic as Quad import qualified Numeric.LAPACK.Matrix.Square as Square import qualified Numeric.LAPACK.Matrix.Diagonal as Diagonal-import qualified Numeric.LAPACK.Matrix.Array as ArrMatrix+import qualified Numeric.LAPACK.Matrix.Array.Private as ArrMatrix import qualified Numeric.LAPACK.Matrix.Shape.Omni as Omni import qualified Numeric.LAPACK.Matrix.Shape as MatrixShape import qualified Numeric.LAPACK.Matrix.Layout.Private as Layout import qualified Numeric.LAPACK.Matrix.Extent.Private as Extent import qualified Numeric.LAPACK.Vector as Vector import qualified Numeric.LAPACK.Scalar as Scalar-import qualified Numeric.LAPACK.Shape.Private as PrivShape+import qualified Numeric.LAPACK.Shape.Private as ShapePriv import qualified Numeric.LAPACK.Shape as ExtShape import Numeric.LAPACK.Matrix.Array.Mosaic (UnitUpperP, LowerP, UpperP, FlexUpperP, HermitianP, HermitianPosSemidefP)-import Numeric.LAPACK.Matrix.Array (Quadratic, ArrayMatrix, packTag)+import Numeric.LAPACK.Matrix.Array.Private (Quadratic, ArrayMatrix, packTag) import Numeric.LAPACK.Matrix.Square (Square) import Numeric.LAPACK.Matrix ((#!), (#+#), (#-#), (#\##), (#*\), (#*##), (##*#))@@ -607,11 +607,11 @@ applyUnchecked :: (Shape.C sh, Class.Floating a) =>- (Quadratic pack prop lower upper (PrivShape.Unchecked sh) a ->- Quadratic pack prop lower upper (PrivShape.Unchecked sh) a) ->+ (Quadratic pack prop lower upper (ShapePriv.Unchecked sh) a ->+ Quadratic pack prop lower upper (ShapePriv.Unchecked sh) a) -> Quadratic pack prop lower upper sh a -> Quadratic pack prop lower upper sh a applyUnchecked f =- Quad.mapSize PrivShape.deconsUnchecked .+ Quad.mapSize ShapePriv.deconsUnchecked . f .- Quad.mapSize PrivShape.Unchecked+ Quad.mapSize ShapePriv.Unchecked
src/Numeric/LAPACK/Matrix/Hermitian.hs view
@@ -73,7 +73,7 @@ import qualified Numeric.LAPACK.Matrix.Array.Hermitian as Hermitian import qualified Numeric.LAPACK.Matrix.Array.Unpacked as ArrUnpacked import qualified Numeric.LAPACK.Matrix.Array.Basic as OmniMatrix-import qualified Numeric.LAPACK.Matrix.Array as ArrMatrix+import qualified Numeric.LAPACK.Matrix.Array.Private as ArrMatrix import qualified Numeric.LAPACK.Matrix.Layout.Private as Layout import qualified Numeric.LAPACK.Matrix.Shape.Omni as Omni import qualified Numeric.LAPACK.Matrix.Extent as Extent@@ -85,7 +85,7 @@ Hermitian, HermitianP, HermitianPosSemidef, HermitianPosSemidefP, HermitianPosDef, SymmetricP)-import Numeric.LAPACK.Matrix.Array (Full, General, Square, packTag)+import Numeric.LAPACK.Matrix.Array.Private (Full, General, Square, packTag) import Numeric.LAPACK.Matrix.Layout.Private (Order) import Numeric.LAPACK.Matrix.Modifier (Transposition(NonTransposed, Transposed)) import Numeric.LAPACK.Matrix.Private (ShapeInt)
src/Numeric/LAPACK/Matrix/HermitianPositiveDefinite.hs view
@@ -18,11 +18,11 @@ import qualified Numeric.LAPACK.Matrix.HermitianPositiveDefinite.Linear as Linear import qualified Numeric.LAPACK.Matrix.Array.Hermitian as Hermitian-import qualified Numeric.LAPACK.Matrix.Array as ArrMatrix+import qualified Numeric.LAPACK.Matrix.Array.Private as ArrMatrix import qualified Numeric.LAPACK.Matrix.Layout.Private as Layout import qualified Numeric.LAPACK.Matrix.Extent as Extent import Numeric.LAPACK.Matrix.Array.Mosaic (HermitianPosDefP, UpperP)-import Numeric.LAPACK.Matrix.Array (Full)+import Numeric.LAPACK.Matrix.Array.Private (Full) import Numeric.LAPACK.Scalar (RealOf) import qualified Numeric.Netlib.Class as Class
src/Numeric/LAPACK/Matrix/Indexed.hs view
@@ -4,7 +4,7 @@ import qualified Numeric.LAPACK.Matrix.Array.Indexed as ArrIndexed import qualified Numeric.LAPACK.Matrix.Extent.Private as Extent-import qualified Numeric.LAPACK.Matrix.Array as ArrMatrix+import qualified Numeric.LAPACK.Matrix.Array.Private as ArrMatrix import qualified Numeric.LAPACK.Matrix.Type as Matrix import qualified Numeric.LAPACK.Permutation as Perm import Numeric.LAPACK.Matrix.Type (Matrix)
src/Numeric/LAPACK/Matrix/Multiply.hs view
@@ -7,7 +7,7 @@ import qualified Numeric.LAPACK.Matrix.Array.Multiply as Multiply import qualified Numeric.LAPACK.Matrix.Array.Unpacked as Unpacked-import qualified Numeric.LAPACK.Matrix.Array as ArrMatrix+import qualified Numeric.LAPACK.Matrix.Array.Private as ArrMatrix import qualified Numeric.LAPACK.Matrix.Permutation as PermMatrix import qualified Numeric.LAPACK.Matrix.Class as MatrixClass import qualified Numeric.LAPACK.Matrix.Type as Matrix@@ -20,7 +20,7 @@ import qualified Numeric.LAPACK.Matrix.Extent as Extent import qualified Numeric.LAPACK.Permutation.Private as Perm import qualified Numeric.LAPACK.Vector as Vector-import Numeric.LAPACK.Matrix.Array (Full)+import Numeric.LAPACK.Matrix.Array.Private (Full) import Numeric.LAPACK.Matrix.Type (Matrix, scaleWithCheck) import Numeric.LAPACK.Matrix.Modifier (Transposition(NonTransposed,Transposed)) import Numeric.LAPACK.Vector (Vector)
src/Numeric/LAPACK/Matrix/Permutation.hs view
@@ -15,7 +15,7 @@ multiplyFull, ) where -import qualified Numeric.LAPACK.Matrix.Array as ArrMatrix+import qualified Numeric.LAPACK.Matrix.Array.Private as ArrMatrix import qualified Numeric.LAPACK.Matrix.Type as Matrix import qualified Numeric.LAPACK.Matrix.Shape.Omni as Omni import qualified Numeric.LAPACK.Matrix.Layout.Private as Layout
src/Numeric/LAPACK/Matrix/Quadratic.hs view
@@ -29,13 +29,13 @@ import qualified Numeric.LAPACK.Matrix.Type as Matrix import qualified Numeric.LAPACK.Matrix.Class as MatrixClass import qualified Numeric.LAPACK.Matrix.Array.Basic as OmniMatrix-import qualified Numeric.LAPACK.Matrix.Array as ArrMatrix+import qualified Numeric.LAPACK.Matrix.Array.Private as ArrMatrix import qualified Numeric.LAPACK.Matrix.Shape as MatrixShape import qualified Numeric.LAPACK.Matrix.Shape.Omni as Omni import qualified Numeric.LAPACK.Matrix.Layout.Private as Layout import Numeric.LAPACK.Matrix.Array.Banded (FlexDiagonal) import Numeric.LAPACK.Matrix.Array.Mosaic (Symmetric)-import Numeric.LAPACK.Matrix.Array (General, Quadratic)+import Numeric.LAPACK.Matrix.Array.Private (General, Quadratic) import Numeric.LAPACK.Matrix.Shape.Omni (Arbitrary) import Numeric.LAPACK.Matrix.Layout.Private (Order) import Numeric.LAPACK.Vector (Vector)
src/Numeric/LAPACK/Matrix/Square.hs view
@@ -25,7 +25,7 @@ trace, stack, (|=|),- takeTopLeft, takeBottomRight,+ split, takeTopLeft, takeBottomRight, multiply, square,@@ -50,11 +50,11 @@ import qualified Numeric.LAPACK.Matrix.Square.Basic as Basic import qualified Numeric.LAPACK.Matrix.Basic as FullBasic -import qualified Numeric.LAPACK.Matrix.Array as ArrMatrix+import qualified Numeric.LAPACK.Matrix.Array.Private as ArrMatrix import qualified Numeric.LAPACK.Matrix.Shape.Omni as Omni import qualified Numeric.LAPACK.Matrix.Extent as Extent import qualified Numeric.LAPACK.Shape as ExtShape-import Numeric.LAPACK.Matrix.Array+import Numeric.LAPACK.Matrix.Array.Private (Full, General, Square, SquareMeas, LiberalSquare) import Numeric.LAPACK.Matrix.Private (ShapeInt) import Numeric.LAPACK.Vector (Vector)@@ -161,12 +161,26 @@ Square (sizeA::+sizeB) a stack = ArrMatrix.lift4 Basic.stack +split ::+ (Shape.C sizeA, Shape.C sizeB, Class.Floating a) =>+ Square (sizeA::+sizeB) a ->+ (Square sizeA a, General sizeA sizeB a,+ General sizeB sizeA a, Square sizeB a)+split a =+ let af = Basic.toFull $ ArrMatrix.toVector a+ top = FullBasic.takeTop af+ bottom = FullBasic.takeBottom af+ in (ArrMatrix.lift0 $ Basic.fromFullUnchecked $ FullBasic.takeLeft top,+ ArrMatrix.lift0 $ FullBasic.takeRight top,+ ArrMatrix.lift0 $ FullBasic.takeLeft bottom,+ ArrMatrix.lift0 $ Basic.fromFullUnchecked $ FullBasic.takeRight bottom)+ takeTopLeft :: (Shape.C sizeA, Shape.C sizeB, Class.Floating a) => Square (sizeA::+sizeB) a -> Square sizeA a takeTopLeft = ArrMatrix.lift1- (FullBasic.recheck . Basic.fromFull . FullBasic.uncheck .+ (Basic.fromFullUnchecked . FullBasic.takeLeft . FullBasic.takeTop . Basic.toFull) takeBottomRight ::@@ -174,7 +188,7 @@ Square (sizeA::+sizeB) a -> Square sizeB a takeBottomRight = ArrMatrix.lift1- (FullBasic.recheck . Basic.fromFull . FullBasic.uncheck .+ (Basic.fromFullUnchecked . FullBasic.takeRight . FullBasic.takeBottom . Basic.toFull) multiply ::
src/Numeric/LAPACK/Matrix/Square/Basic.hs view
@@ -5,6 +5,7 @@ mapSize, toFull, fromFull,+ fromFullUnchecked, liberalFromFull, fromScalar, toScalar,@@ -84,6 +85,12 @@ (Extent.Measure meas, Extent.C vert, Extent.C horiz, Eq sh) => Full meas vert horiz sh sh a -> Square sh a fromFull = mapExtent ExtentPriv.squareFromFull++fromFullUnchecked ::+ (Extent.Measure meas, Extent.C vert, Extent.C horiz) =>+ Full meas vert horiz sh sh a -> Square sh a+fromFullUnchecked =+ Basic.recheck . mapExtent ExtentPriv.squareFromFull . Basic.uncheck liberalFromFull :: (Extent.Measure meas, Extent.C vert, Extent.C horiz,
src/Numeric/LAPACK/Matrix/Superscript.hs view
@@ -15,7 +15,7 @@ import qualified Numeric.LAPACK.Matrix.Shape.Omni as Omni import qualified Numeric.LAPACK.Matrix.Layout as Layout import qualified Numeric.LAPACK.Matrix.Extent as Extent-import qualified Numeric.LAPACK.Matrix.Array as ArrMatrix+import qualified Numeric.LAPACK.Matrix.Array.Private as ArrMatrix import qualified Numeric.LAPACK.Matrix as Matrix import Numeric.LAPACK.Matrix.Layout.Private (Filled) import Numeric.LAPACK.Matrix.Extent (Shape, Small)
src/Numeric/LAPACK/Matrix/Symmetric.hs view
@@ -54,14 +54,14 @@ import qualified Numeric.LAPACK.Matrix.Full as Full import qualified Numeric.LAPACK.Matrix.Array.Unpacked as ArrUnpacked-import qualified Numeric.LAPACK.Matrix.Array as ArrMatrix+import qualified Numeric.LAPACK.Matrix.Array.Private as ArrMatrix import qualified Numeric.LAPACK.Matrix.Layout.Private as Layout import qualified Numeric.LAPACK.Matrix.Shape.Omni as Omni import qualified Numeric.LAPACK.Matrix.Extent as Extent import qualified Numeric.LAPACK.Vector as Vector import Numeric.LAPACK.Matrix.Array.Mosaic (Symmetric, SymmetricP, FlexHermitianP, Upper, assureMirrored)-import Numeric.LAPACK.Matrix.Array (Full, General, Square, packTag)+import Numeric.LAPACK.Matrix.Array.Private (Full, General, Square, packTag) import Numeric.LAPACK.Matrix.Layout.Private (Order) import Numeric.LAPACK.Matrix.Private (ShapeInt) import Numeric.LAPACK.Vector (Vector)
src/Numeric/LAPACK/Matrix/Triangular.hs view
@@ -63,7 +63,7 @@ import qualified Numeric.LAPACK.Matrix.Array.Mosaic as Triangular import qualified Numeric.LAPACK.Matrix.Array.Unpacked as ArrUnpacked import qualified Numeric.LAPACK.Matrix.Array.Basic as OmniMatrix-import qualified Numeric.LAPACK.Matrix.Array as ArrMatrix+import qualified Numeric.LAPACK.Matrix.Array.Private as ArrMatrix import qualified Numeric.LAPACK.Matrix.Type as Matrix import qualified Numeric.LAPACK.Matrix.Class as MatrixClass import qualified Numeric.LAPACK.Matrix.Shape.Omni as Omni@@ -78,7 +78,7 @@ Upper, FlexUpper, FlexUpperP, ) import Numeric.LAPACK.Matrix.Array.Unpacked (Unpacked)-import Numeric.LAPACK.Matrix.Array (Full, General, Square, packTag, diagTag)+import Numeric.LAPACK.Matrix.Array.Private (Full, General, Square, packTag, diagTag) import Numeric.LAPACK.Matrix.Shape.Omni (Arbitrary, Unit) import Numeric.LAPACK.Matrix.Layout.Private (Order, Filled) import Numeric.LAPACK.Matrix.Private (ShapeInt)
src/Numeric/LAPACK/Matrix/Type.hs view
@@ -142,7 +142,8 @@ instance- (MultiplySame typ xl xu, MatrixShape.PowerStrip lower, MatrixShape.PowerStrip upper,+ (MultiplySame typ xl xu,+ MatrixShape.PowerStrip lower, MatrixShape.PowerStrip upper, Extent.Measure meas, Extent.C vert, Extent.C horiz, Shape.C height, Eq height, height ~ width, Class.Floating a) => Semigroup (Matrix typ xl xu lower upper meas vert horiz height width a)@@ -324,8 +325,10 @@ powerStrips :: (MatrixShape.PowerStrip lower, MatrixShape.PowerStrip upper) => Matrix typ xl xu lower upper meas vert horiz height width a ->- (MatrixShape.PowerStripSingleton lower, MatrixShape.PowerStripSingleton upper)-powerStrips _ = (MatrixShape.powerStripSingleton, MatrixShape.powerStripSingleton)+ (MatrixShape.PowerStripSingleton lower,+ MatrixShape.PowerStripSingleton upper)+powerStrips _ =+ (MatrixShape.powerStripSingleton, MatrixShape.powerStripSingleton) strips :: (MatrixShape.Strip lower, MatrixShape.Strip upper) =>
src/Numeric/LAPACK/Orthogonal.hs view
@@ -26,13 +26,13 @@ import qualified Numeric.LAPACK.Matrix.Triangular as Triangular import qualified Numeric.LAPACK.Matrix.Layout as Layout import qualified Numeric.LAPACK.Matrix.Array.Unpacked as Unpacked-import qualified Numeric.LAPACK.Matrix.Array as ArrMatrix+import qualified Numeric.LAPACK.Matrix.Array.Private as ArrMatrix import qualified Numeric.LAPACK.Matrix.Basic as Basic import qualified Numeric.LAPACK.Matrix.Type as Matrix import qualified Numeric.LAPACK.Matrix.Extent.Private as Extent import qualified Numeric.LAPACK.Vector as Vector import qualified Numeric.LAPACK.Shape as ExtShape-import Numeric.LAPACK.Matrix.Array (Full, General, Tall, Wide, Square)+import Numeric.LAPACK.Matrix.Array.Private (Full, General, Tall, Wide, Square) import Numeric.LAPACK.Matrix.Private (ShapeInt) import Numeric.LAPACK.Vector (Vector, (|-|)) import Numeric.LAPACK.Scalar (RealOf)
src/Numeric/LAPACK/Orthogonal/Householder.hs view
@@ -28,14 +28,14 @@ import qualified Numeric.LAPACK.Orthogonal.Plain as Plain import qualified Numeric.LAPACK.Matrix.Array.Unpacked as Unpacked-import qualified Numeric.LAPACK.Matrix.Array as ArrMatrix+import qualified Numeric.LAPACK.Matrix.Array.Private as ArrMatrix import qualified Numeric.LAPACK.Matrix.Extent.Strict as ExtentStrict import qualified Numeric.LAPACK.Matrix.Extent as Extent import qualified Numeric.LAPACK.Matrix.Modifier as Mod import qualified Numeric.LAPACK.Shape as ExtShape import Numeric.LAPACK.Orthogonal.Plain (Householder) import Numeric.LAPACK.Matrix.Array.Mosaic (Upper)-import Numeric.LAPACK.Matrix.Array (Full, Square)+import Numeric.LAPACK.Matrix.Array.Private (Full, Square) import Numeric.LAPACK.Matrix.Modifier (Transposition, Conjugation) import qualified Numeric.Netlib.Class as Class
src/Numeric/LAPACK/Orthogonal/Plain.hs view
@@ -9,7 +9,7 @@ import qualified Numeric.LAPACK.Matrix.Divide as Divide import qualified Numeric.LAPACK.Matrix.Multiply as Multiply import qualified Numeric.LAPACK.Matrix.Type as Matrix-import qualified Numeric.LAPACK.Matrix.Array as ArrMatrix+import qualified Numeric.LAPACK.Matrix.Array.Private as ArrMatrix import qualified Numeric.LAPACK.Matrix.Banded.Basic as Banded import qualified Numeric.LAPACK.Matrix.Basic as Basic import qualified Numeric.LAPACK.Matrix.Private as MatrixPriv
src/Numeric/LAPACK/Permutation.hs view
@@ -17,11 +17,11 @@ ) where import qualified Numeric.LAPACK.Permutation.Private as Plain-import qualified Numeric.LAPACK.Matrix.Array as ArrMatrix+import qualified Numeric.LAPACK.Matrix.Array.Private 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 Numeric.LAPACK.Matrix.Array.Private (Full, Square) import qualified Numeric.Netlib.Class as Class
src/Numeric/LAPACK/Singular.hs view
@@ -17,14 +17,14 @@ import qualified Numeric.LAPACK.Matrix.Hermitian as Hermitian import qualified Numeric.LAPACK.Matrix.Mosaic.Private as Mos-import qualified Numeric.LAPACK.Matrix.Array as ArrMatrix+import qualified Numeric.LAPACK.Matrix.Array.Private as ArrMatrix import qualified Numeric.LAPACK.Matrix.Extent.Private as Extent import qualified Numeric.LAPACK.Matrix.Shape.Omni as Omni import qualified Numeric.LAPACK.Matrix.Layout.Private as Layout import qualified Numeric.LAPACK.Matrix.Basic as Basic import qualified Numeric.LAPACK.Matrix as Matrix import Numeric.LAPACK.Matrix.Array.Banded (RectangularDiagonal)-import Numeric.LAPACK.Matrix.Array (ArrayMatrix, Full, General, Square)+import Numeric.LAPACK.Matrix.Array.Private (ArrayMatrix, Full, General, Square) import Numeric.LAPACK.Matrix.Multiply ((##*#), (#*##)) import Numeric.LAPACK.Vector (Vector) import Numeric.LAPACK.Scalar (RealOf)