| Copyright | (C) 2016 Marco Zocca |
|---|---|
| License | GPL-3 (see LICENSE) |
| Maintainer | zocca.marco gmail |
| Stability | provisional |
| Portability | portable |
| Safe Haskell | None |
| Language | Haskell2010 |
Data.Sparse.Common
Description
Synopsis
- module Numeric.LinearAlgebra.Class
- module Numeric.Eps
- module Data.Sparse.SpVector
- module Data.Sparse.SpMatrix
- type Rows = Int
- type Cols = Int
- type IxRow = Int
- type IxCol = Int
- type LexIx = Int
- data LexOrd
- prd :: PrintDense a => a -> IO ()
- prd0 :: PrintDense a => a -> IO ()
- class PrintDense a
- newline :: IO ()
- data PPrintOptions = PPOpts {}
- printDN :: (PrintfArg a, Epsilon a, Ord a) => Int -> Int -> PPrintOptions -> [a] -> String
- printCN :: (PrintfArg a, Epsilon a, Epsilon (Complex a), Ord a) => Int -> Int -> PPrintOptions -> [Complex a] -> String
- intersectWith :: Ord i => (a -> a -> b) -> [(i, a)] -> [(i, a)] -> [b]
- unionWith :: Ord i => (a -> a -> a) -> a -> [(i, a)] -> [(i, a)] -> [(i, a)]
- intersectWithD :: Ord i => (a -> a -> b) -> [(i, a)] -> [(i, a)] -> [b]
- unionWithD :: Ord i => (a -> a -> a) -> a -> [(i, a)] -> [(i, a)] -> [(i, a)]
- intersectWith0 :: (a -> b -> Ordering) -> (a -> b -> c) -> [a] -> [b] -> [c]
- unionWith0 :: (i -> i -> Ordering) -> (a -> a -> a) -> a -> [(i, a)] -> [(i, a)] -> [(i, a)]
- lift2snd :: (t -> t1 -> t2) -> (a, t) -> (a1, t1) -> t2
- safe :: (t -> Bool) -> (t -> a) -> t -> Maybe a
- maxTup :: Ord t => (t, t) -> (t, t) -> (t, t)
- minTup :: Ord t => (t, t) -> (t, t) -> (t, t)
- indexed :: [b] -> [(Int, b)]
- indexed' :: Int -> [a] -> [(Int, a)]
- indexed2 :: Int -> [c] -> [(Int, Int, c)]
- foldrMap :: (Foldable t, Functor t) => (a -> b) -> (b -> c -> c) -> c -> t a -> c
- foldlStrict :: (a -> b -> a) -> a -> [b] -> a
- ifoldr :: Num i => (a -> b -> b) -> b -> (i -> c -> d -> a) -> c -> [d] -> b
- type LB = Int
- type UB = Int
- inBounds :: LB -> UB -> Int -> Bool
- inBounds2 :: (LB, UB) -> (Int, Int) -> Bool
- inBounds0 :: UB -> Int -> Bool
- inBounds02 :: (UB, UB) -> (Int, Int) -> Bool
- head' :: Vector a -> Maybe a
- tail' :: Vector a -> Maybe (Vector a)
- insertRowWith :: (IxCol -> IxCol) -> SpMatrix a -> SpVector a -> Key -> SpMatrix a
- insertRow :: SpMatrix a -> SpVector a -> Key -> SpMatrix a
- insertColWith :: (IxRow -> IxRow) -> SpMatrix a -> SpVector a -> IxCol -> SpMatrix a
- insertCol :: SpMatrix a -> SpVector a -> IxCol -> SpMatrix a
- diagonalSM :: SpVector a -> SpMatrix a
- outerProdSV :: Num a => SpVector a -> SpVector a -> SpMatrix a
- (><) :: Num a => SpVector a -> SpVector a -> SpMatrix a
- toSV :: SpMatrix a -> SpVector a
- svToSM :: SpVector a -> SpMatrix a
- lookupRowSM :: SpMatrix a -> IxRow -> Maybe (SpVector a)
- extractCol :: SpMatrix a -> IxCol -> SpVector a
- extractRow :: SpMatrix a -> IxRow -> SpVector a
- extractVectorDenseWith :: Num a => (Int -> (IxRow, IxCol)) -> SpMatrix a -> SpVector a
- extractRowDense :: Num a => SpMatrix a -> IxRow -> SpVector a
- extractColDense :: Num a => SpMatrix a -> IxCol -> SpVector a
- extractDiagDense :: Num a => SpMatrix a -> SpVector a
- extractSubRow :: SpMatrix a -> IxRow -> (Int, Int) -> SpVector a
- extractSubCol :: SpMatrix a -> IxCol -> (IxRow, IxRow) -> SpVector a
- extractSubRow_RK :: SpMatrix a -> IxRow -> (IxCol, IxCol) -> SpVector a
- extractSubCol_RK :: SpMatrix a -> IxCol -> (IxRow, IxRow) -> SpVector a
- fromRowsL :: [SpVector a] -> SpMatrix a
- fromRowsV :: Vector (SpVector a) -> SpMatrix a
- fromColsV :: Vector (SpVector a) -> SpMatrix a
- fromColsL :: [SpVector a] -> SpMatrix a
- toRowsL :: SpMatrix a -> [SpVector a]
- toColsL :: SpMatrix a -> [SpVector a]
Documentation
module Numeric.LinearAlgebra.Class
module Numeric.Eps
module Data.Sparse.SpVector
module Data.Sparse.SpMatrix
Lexicographic ordering types
prd :: PrintDense a => a -> IO () #
Pretty-print with a descriptive header
prd0 :: PrintDense a => a -> IO () #
Pretty-print with no header
class PrintDense a #
Instances
| PrintDense (SpVector Double) # | |
| PrintDense (SpVector (Complex Double)) # | |
| PrintDense (SpMatrix Double) # | |
| PrintDense (SpMatrix (Complex Double)) # | |
data PPrintOptions #
Constructors
| PPOpts | |
Fields | |
Instances
| Eq PPrintOptions # | |
Defined in Data.Sparse.PPrint Methods (==) :: PPrintOptions -> PPrintOptions -> Bool # (/=) :: PPrintOptions -> PPrintOptions -> Bool # | |
| Show PPrintOptions # | |
Defined in Data.Sparse.PPrint Methods showsPrec :: Int -> PPrintOptions -> ShowS # show :: PPrintOptions -> String # showList :: [PPrintOptions] -> ShowS # | |
printDN :: (PrintfArg a, Epsilon a, Ord a) => Int -> Int -> PPrintOptions -> [a] -> String #
Pretty print an array of real numbers
printCN :: (PrintfArg a, Epsilon a, Epsilon (Complex a), Ord a) => Int -> Int -> PPrintOptions -> [Complex a] -> String #
Pretty print an array of complex numbers
Misc. utilities
intersectWith :: Ord i => (a -> a -> b) -> [(i, a)] -> [(i, a)] -> [b] #
Intersection and union of sparse lists having indices in _ascending_ order
intersectWithD :: Ord i => (a -> a -> b) -> [(i, a)] -> [(i, a)] -> [b] #
Intersection of sparse lists having indices in _descending_ order
unionWithD :: Ord i => (a -> a -> a) -> a -> [(i, a)] -> [(i, a)] -> [(i, a)] #
Union of sparse lists having indices in _descending_ order
intersectWith0 :: (a -> b -> Ordering) -> (a -> b -> c) -> [a] -> [b] -> [c] #
unionWith0 :: (i -> i -> Ordering) -> (a -> a -> a) -> a -> [(i, a)] -> [(i, a)] -> [(i, a)] #
lift2snd :: (t -> t1 -> t2) -> (a, t) -> (a1, t1) -> t2 #
Lift a binary function onto the second entry of a tuple
safe :: (t -> Bool) -> (t -> a) -> t -> Maybe a #
Wrap a function with a null check, returning in Maybe
maxTup :: Ord t => (t, t) -> (t, t) -> (t, t) #
Componentwise tuple operations TODO : use semilattice properties instead
minTup :: Ord t => (t, t) -> (t, t) -> (t, t) #
Componentwise tuple operations TODO : use semilattice properties instead
foldrMap :: (Foldable t, Functor t) => (a -> b) -> (b -> c -> c) -> c -> t a -> c #
foldr over the results of a fmap
foldlStrict :: (a -> b -> a) -> a -> [b] -> a #
strict left fold
Bounds checking
Safe indexing
insertRowWith :: (IxCol -> IxCol) -> SpMatrix a -> SpVector a -> Key -> SpMatrix a #
Insert row , using the provided row index transformation function
insertColWith :: (IxRow -> IxRow) -> SpMatrix a -> SpVector a -> IxCol -> SpMatrix a #
Insert column, using the provided row index transformation function
diagonalSM :: SpVector a -> SpMatrix a #
Fill the diagonal of a SpMatrix with the components of a SpVector
lookupRowSM :: SpMatrix a -> IxRow -> Maybe (SpVector a) #
Lookup a row in a SpMatrix; returns an SpVector with the row, if this is non-empty
extractCol :: SpMatrix a -> IxCol -> SpVector a #
Extract jth column
extractRow :: SpMatrix a -> IxRow -> SpVector a #
Extract ith row
extractVectorDenseWith :: Num a => (Int -> (IxRow, IxCol)) -> SpMatrix a -> SpVector a #
Generic extraction function
extractDiagDense :: Num a => SpMatrix a -> SpVector a #
Extract the diagonal
extractSubRow :: SpMatrix a -> IxRow -> (Int, Int) -> SpVector a #
extract row interval (all entries between columns j1 and j2, INCLUDED, are returned) extractSubRow :: SpMatrix a -> IxRow -> (IxCol, IxCol) -> SpVector a extractSubRow m i (j1, j2) = case lookupRowSM m i of Nothing -> zeroSV (ncols m) Just rv -> ifilterSV (j _ -> j >= j1 && j <= j2) rv
", returning in Maybe extractSubRow :: SpMatrix a -> IxRow -> (Int, Int) -> Maybe (SpVector a) extractSubRow m i (j1, j2) = resizeSV (j2 - j1) . ifilterSV (j _ -> j >= j1 && j j2) <$ lookupRowSM m i
Extract an interval of SpVector components, changing accordingly the resulting SpVector size. Keys are _not_ rebalanced, i.e. components are still labeled according with respect to the source matrix.
extractSubRow_RK :: SpMatrix a -> IxRow -> (IxCol, IxCol) -> SpVector a #
extract row interval, rebalance keys by subtracting lowest one
extractSubCol_RK :: SpMatrix a -> IxCol -> (IxRow, IxRow) -> SpVector a #
extract column interval, rebalance keys by subtracting lowest one
fromColsV :: Vector (SpVector a) -> SpMatrix a #
Pack a V.Vector of SpVectors as columns of an SpMatrix
Orphan instances
| PrintDense (SpVector Double) # | |
| PrintDense (SpVector (Complex Double)) # | |
| PrintDense (SpMatrix Double) # | |
| PrintDense (SpMatrix (Complex Double)) # | |
| (InnerSpace t, Scalar t ~ t) => LinearVectorSpace (SpVector t) # | |