Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- class (Vector (Column mat) a, Vector (Row mat) a, MMatrix (Mutable mat) a, Row mat ~ Row (Mutable mat), Column mat ~ Column (Mutable mat)) => Matrix mat a where
- basicRowCount :: mat a -> Size
- basicColumnCount :: mat a -> Size
- unsafeFreeze :: PrimMonad m => Mutable mat (PrimState m) a -> m (mat a)
- unsafeThaw :: PrimMonad m => mat a -> m (Mutable mat (PrimState m) a)
- basicUnsafeIndexM :: Monad m => mat a -> Index -> Index -> m a
- basicUnsafeGetRowM :: Monad m => mat a -> Index -> m (Row mat a)
- basicUnsafeGetColumnM :: Monad m => mat a -> Index -> m (Column mat a)
- basicUnsafeCopy :: PrimMonad m => Mutable mat (PrimState m) a -> mat a -> m ()
- unsafeGenerate :: Size -> Size -> (Index -> Index -> a) -> mat a
- unsafeWrite :: mat a -> Index -> Index -> a -> mat a
- unsafeFromRows :: [Row mat a] -> mat a
- unsafeFromColumns :: [Column mat a] -> mat a
- toRows :: mat a -> [Row mat a]
- toColumns :: mat a -> [Column mat a]
- swapRows :: mat a -> Index -> Index -> mat a
- scaleRow :: Commutative a => mat a -> Index -> a -> mat a
- unsafeIMapRowM :: Monad m => mat a -> Index -> (Index -> a -> m a) -> m (mat a)
- unsafeIMapRowM_ :: Monad m => mat a -> Index -> (Index -> a -> m b) -> m ()
- unsafeIMapRow :: mat a -> Index -> (Index -> a -> a) -> mat a
- combineRows :: (Commutative a, Semiring a) => Index -> a -> Index -> mat a -> mat a
- gaussReduction :: (Eq a, Normed a, Field a) => mat a -> (mat a, mat a, a)
- type family Column (mat :: k) :: Type -> Type
- type family Row (mat :: k) :: Type -> Type
- type Size = Int
- type Index = Int
- data WrapImmutable mat s a
- type family Mutable (v :: Type -> Type) = (mv :: Type -> Type -> Type) | mv -> v
- rowCount :: Matrix mat a => mat a -> Size
- columnCount :: Matrix mat a => mat a -> Size
- generate :: Matrix mat a => Size -> Size -> (Index -> Index -> a) -> mat a
- freeze :: (Matrix mat a, PrimMonad m) => Mutable mat (PrimState m) a -> m (mat a)
- thaw :: (Matrix mat a, PrimMonad m) => mat a -> m (Mutable mat (PrimState m) a)
- fromRows :: Matrix mat a => [Row mat a] -> mat a
- fromColumns :: Matrix mat a => [Column mat a] -> mat a
- create :: Matrix mat a => (forall s. ST s (Mutable mat s a)) -> mat a
- (!) :: Matrix mat a => mat a -> (Index, Index) -> a
- wrapImmutable :: (PrimMonad m, Matrix mat a) => mat a -> m (WrapImmutable mat (PrimState m) a)
Documentation
class (Vector (Column mat) a, Vector (Row mat) a, MMatrix (Mutable mat) a, Row mat ~ Row (Mutable mat), Column mat ~ Column (Mutable mat)) => Matrix mat a where Source #
General Matrix type, with associated mutable matrix.
basicRowCount :: mat a -> Size Source #
basicColumnCount :: mat a -> Size Source #
unsafeFreeze :: PrimMonad m => Mutable mat (PrimState m) a -> m (mat a) Source #
default unsafeFreeze :: (PrimMonad m, Mutable mat ~ WrapImmutable mat) => Mutable mat (PrimState m) a -> m (mat a) Source #
unsafeThaw :: PrimMonad m => mat a -> m (Mutable mat (PrimState m) a) Source #
default unsafeThaw :: (Mutable mat ~ WrapImmutable mat, PrimMonad m) => mat a -> m (Mutable mat (PrimState m) a) Source #
basicUnsafeIndexM :: Monad m => mat a -> Index -> Index -> m a Source #
basicUnsafeGetRowM :: Monad m => mat a -> Index -> m (Row mat a) Source #
basicUnsafeGetColumnM :: Monad m => mat a -> Index -> m (Column mat a) Source #
basicUnsafeCopy :: PrimMonad m => Mutable mat (PrimState m) a -> mat a -> m () Source #
unsafeGenerate :: Size -> Size -> (Index -> Index -> a) -> mat a Source #
unsafeWrite :: mat a -> Index -> Index -> a -> mat a Source #
unsafeFromRows :: [Row mat a] -> mat a Source #
unsafeFromColumns :: [Column mat a] -> mat a Source #
toRows :: mat a -> [Row mat a] Source #
toColumns :: mat a -> [Column mat a] Source #
swapRows :: mat a -> Index -> Index -> mat a Source #
scaleRow :: Commutative a => mat a -> Index -> a -> mat a Source #
unsafeIMapRowM :: Monad m => mat a -> Index -> (Index -> a -> m a) -> m (mat a) Source #
unsafeIMapRowM_ :: Monad m => mat a -> Index -> (Index -> a -> m b) -> m () Source #
unsafeIMapRow :: mat a -> Index -> (Index -> a -> a) -> mat a Source #
combineRows :: (Commutative a, Semiring a) => Index -> a -> Index -> mat a -> mat a Source #
gaussReduction :: (Eq a, Normed a, Field a) => mat a -> (mat a, mat a, a) Source #
Instances
type family Column (mat :: k) :: Type -> Type Source #
Instances
type Column STMatrix Source # | |
Defined in Algebra.Matrix.HMatrix | |
type Column MIMMatrix Source # | |
Defined in Algebra.Matrix.IntMap | |
type Column Matrix Source # | |
Defined in Algebra.Matrix.DataMatrix | |
type Column Matrix Source # | |
Defined in Algebra.Matrix.HMatrix type Column Matrix = Vector | |
type Column IMMatrix Source # | |
Defined in Algebra.Matrix.IntMap | |
type Column (WrapImmutable mat :: Type -> k -> Type) Source # | |
Defined in Algebra.Matrix.Generic |
type family Row (mat :: k) :: Type -> Type Source #
Instances
type Row STMatrix Source # | |
Defined in Algebra.Matrix.HMatrix | |
type Row MIMMatrix Source # | |
Defined in Algebra.Matrix.IntMap | |
type Row Matrix Source # | |
Defined in Algebra.Matrix.DataMatrix | |
type Row Matrix Source # | |
Defined in Algebra.Matrix.HMatrix type Row Matrix = Vector | |
type Row IMMatrix Source # | |
Defined in Algebra.Matrix.IntMap | |
type Row (WrapImmutable mat :: Type -> k -> Type) Source # | |
Defined in Algebra.Matrix.Generic |
data WrapImmutable mat s a Source #
Wrapper type for matrix types without mutable representation.
N.B. To make things work, you have to provide all methods of
class except Matrix
, unsafeThaw
,
unsafeFreeze
, basicUnsafeCopy
, and unsafeIMapRowM
.gaussReduction
Instances
(Monoidal a, Matrix mat a) => MMatrix (WrapImmutable mat) a Source # | |
Defined in Algebra.Matrix.Generic basicUnsafeNew :: PrimMonad m => Size -> Size -> m (WrapImmutable mat (PrimState m) a) Source # basicInitialise :: PrimMonad m => WrapImmutable mat (PrimState m) a -> m () Source # basicRowCount :: WrapImmutable mat s a -> Size Source # basicColumnCount :: WrapImmutable mat s a -> Size Source # unsafeGetRow :: PrimMonad m => Index -> WrapImmutable mat (PrimState m) a -> m (Row (WrapImmutable mat) a) Source # unsafeGetColumn :: PrimMonad m => Index -> WrapImmutable mat (PrimState m) a -> m (Column (WrapImmutable mat) a) Source # unsafeFill :: PrimMonad m => Size -> Size -> a -> m (WrapImmutable mat (PrimState m) a) Source # unsafeFromRow :: PrimMonad m => Row (WrapImmutable mat) a -> m (WrapImmutable mat (PrimState m) a) Source # unsafeFromRows :: PrimMonad m => [Row (WrapImmutable mat) a] -> m (WrapImmutable mat (PrimState m) a) Source # unsafeFromColumn :: PrimMonad m => Column (WrapImmutable mat) a -> m (WrapImmutable mat (PrimState m) a) Source # unsafeFromColumns :: PrimMonad m => [Column (WrapImmutable mat) a] -> m (WrapImmutable mat (PrimState m) a) Source # unsafeCopy :: PrimMonad m => WrapImmutable mat (PrimState m) a -> WrapImmutable mat (PrimState m) a -> m () Source # unsafeRead :: PrimMonad m => WrapImmutable mat (PrimState m) a -> Index -> Index -> m a Source # unsafeWrite :: PrimMonad m => WrapImmutable mat (PrimState m) a -> Index -> Index -> a -> m () Source # basicSet :: PrimMonad m => WrapImmutable mat (PrimState m) a -> a -> m () Source # basicUnsafeIMapRowM :: PrimMonad m => WrapImmutable mat (PrimState m) a -> Index -> (Index -> a -> m a) -> m () Source # basicUnsafeIMapRow :: PrimMonad m => WrapImmutable mat (PrimState m) a -> Index -> (Index -> a -> a) -> m () Source # basicUnsafeSwapRows :: PrimMonad m => WrapImmutable mat (PrimState m) a -> Index -> Index -> m () Source # unsafeScaleRow :: (PrimMonad m, Commutative a) => WrapImmutable mat (PrimState m) a -> Index -> a -> m () Source # unsafeGenerate :: PrimMonad m => Size -> Size -> (Index -> Index -> a) -> m (WrapImmutable mat (PrimState m) a) Source # unsafeGenerateM :: PrimMonad m => Size -> Size -> (Index -> Index -> m a) -> m (WrapImmutable mat (PrimState m) a) Source # toRows :: PrimMonad m => WrapImmutable mat (PrimState m) a -> m [Row (WrapImmutable mat) a] Source # toColumns :: PrimMonad m => WrapImmutable mat (PrimState m) a -> m [Column (WrapImmutable mat) a] Source # combineRows :: (Semiring a, Commutative a, PrimMonad m) => Index -> a -> Index -> WrapImmutable mat (PrimState m) a -> m () Source # | |
type Row (WrapImmutable mat :: Type -> k -> Type) Source # | |
Defined in Algebra.Matrix.Generic | |
type Column (WrapImmutable mat :: Type -> k -> Type) Source # | |
Defined in Algebra.Matrix.Generic |
type family Mutable (v :: Type -> Type) = (mv :: Type -> Type -> Type) | mv -> v #
Instances
type Mutable Vector | |
Defined in Data.Vector | |
type Mutable Vector | |
Defined in Data.Vector.Primitive type Mutable Vector = MVector | |
type Mutable Vector | |
Defined in Data.Vector.Storable type Mutable Vector = MVector | |
type Mutable Vector | |
Defined in Data.Vector.Unboxed.Base type Mutable Vector = MVector | |
type Mutable Matrix Source # | |
Defined in Algebra.Matrix.DataMatrix type Mutable Matrix | |
type Mutable Matrix Source # | |
Defined in Algebra.Matrix.HMatrix | |
type Mutable IMMatrix Source # | |
Defined in Algebra.Matrix.IntMap |
columnCount :: Matrix mat a => mat a -> Size Source #
fromColumns :: Matrix mat a => [Column mat a] -> mat a Source #
wrapImmutable :: (PrimMonad m, Matrix mat a) => mat a -> m (WrapImmutable mat (PrimState m) a) Source #