Aelve Codesearch

grep over package repositories
Please provide a string to search for.
3+ characters are required.
Index updated about an hour ago

total matches: more than 1000

4Blocks-0.2
4 matches
Core/ColouredPoint.hs
getLinesOfColouredPoints :: [ColouredPoint] -> [[ColouredPoint]]
getLinesOfColouredPoints colouredPoints = linesOfColouredPoints
  where 
    sortedByYColouredPoints = sortBy (compare `on` getColouredPointY) colouredPoints
    groupedColouredPoints = groupBy (\(x1,y1,c1) (x2,y2,c2) -> (y1==y2)) sortedByYColouredPoints
    reversedGroupedColouredPoints = reverse groupedColouredPoints
    linesOfColouredPoints = reversedGroupedColouredPoints

getSortedLinesOfColouredPoints :: [ColouredPoint] -> [[ColouredPoint]]
getSortedLinesOfColouredPoints colouredPoints = linesOfColouredPoints

            
Core/ColouredPoint.hs
getSortedLinesOfColouredPoints :: [ColouredPoint] -> [[ColouredPoint]]
getSortedLinesOfColouredPoints colouredPoints = linesOfColouredPoints
  where 
    sortedByYColouredPoints = sortBy (compare `on` getColouredPointY) colouredPoints
    groupedColouredPoints = groupBy (\(x1,y1,c1) (x2,y2,c2) -> (y1==y2)) sortedByYColouredPoints
    sortedByXYColouredPointsLines = map (sortBy (compare `on` getColouredPointX)) groupedColouredPoints
    reversedGroupedColouredPoints = reverse sortedByXYColouredPointsLines
    linesOfColouredPoints = reversedGroupedColouredPoints
    
getColumnsOfColouredPoints :: [ColouredPoint] -> [[ColouredPoint]]
getColumnsOfColouredPoints colouredPoints = columnsOfColouredPoints
  where

            
Core/ColouredPoint.hs
getColumnsOfColouredPoints :: [ColouredPoint] -> [[ColouredPoint]]
getColumnsOfColouredPoints colouredPoints = columnsOfColouredPoints
  where
    sortedByXColouredPoints = sortBy (compare `on` getColouredPointX) colouredPoints
    groupedColouredPoints = groupBy (\(x1,y1,c1) (x2,y2,c2) -> (x1==x2)) sortedByXColouredPoints    
    columnsOfColouredPoints = groupedColouredPoints
    
getSortedColumnsOfColouredPoints :: [ColouredPoint] -> [[ColouredPoint]]
getSortedColumnsOfColouredPoints colouredPoints = columnsOfColouredPoints
  where

            
Core/ColouredPoint.hs
getSortedColumnsOfColouredPoints :: [ColouredPoint] -> [[ColouredPoint]]
getSortedColumnsOfColouredPoints colouredPoints = columnsOfColouredPoints
  where
    sortedByXColouredPoints = sortBy (compare `on` getColouredPointX) colouredPoints
    groupedColouredPoints = groupBy (\(x1,y1,c1) (x2,y2,c2) -> (x1==x2)) sortedByXColouredPoints
    sortedByXYColouredPointsLines = map (sortBy (compare `on` getColouredPointY)) groupedColouredPoints
    columnsOfColouredPoints = sortedByXYColouredPointsLines
    
getColouredPointsFromLines :: [[ColouredPoint]] -> [ColouredPoint]
getColouredPointsFromLines = concat

convertAllColouredPointsToColour :: Colour -> [ColouredPoint] -> [ColouredPoint]

            
ADPfusion-0.5.2.2
3 matches
ADP/Fusion/SynVar/Fill.hs
import qualified Data.Vector.Fusion.Stream.Monadic as SM
import           System.IO.Unsafe
import           Control.Monad (when,forM_)
import           Data.List (nub,sort,group)
import qualified Data.Vector.Unboxed as VU
import           Data.Proxy
import qualified GHC.Generics as G
import qualified Data.Typeable as T
import qualified Data.Data as D

            
ADP/Fusion/SynVar/Fill.hs
  mutateTables h mrph tt@(_:.TW (ITbl _ _ _ arr) _) = do
    let (from,to) = bounds arr
    -- TODO (1) find the set of orders for the synvars
    let !tbos = VU.fromList . nub . sort $ tableBigOrder tt
    let !tlos = VU.fromList . nub . sort $ tableLittleOrder tt
    VU.forM_ tbos $ \bo ->
      case (VU.length tlos) of
        1 -> let lo = VU.head tlos
             in  flip SM.mapM_ (streamUp from to) $ \k ->
                  mutateCell h bo lo (inline mrph) tt to k

            
ADP/Fusion/SynVar/Fill.hs
  => t
  -> m t
mutateTablesNew ts = do
  -- sort the tables according to [bigorder,type,littleorder]. For each
  -- @bigorder@, we should have only one @type@ and can therefor do the
  -- following (i) get subset of the @ts@, (ii) use outermost of @ts@ to
  -- get bounds, (iii) fill these tables
  let !tbos = VU.fromList . nub . sort $ tableBigOrder ts
  let ds = L.sort $ asDyn ts
  let goM :: (Monad m, PrimMonad m) => [Q] -> m ()
      goM [] = return ()
      goM xs = do
        ys <- fillWithDyn xs ts
        if null ys

            
ADPfusionForest-0.0.0.1
10 matches
ADP/Fusion/Core/ForestAlign/PermuteRightLinear.hs
-- subset of children of each node with a linear index. The @mkLookUp@
-- function generates this.
--
-- TODO use 'sortedSubForests' such that the partial order matches the
-- linearized order.

mkLookUp :: Forest Pre v a -> LookUp
mkLookUp f = HM.fromList . flip P.zip [0..] $ sortedSubForests f
{-
mkLookUp f = HM.fromList . flip P.zip [0..] . go $ roots f : (VG.toList $ children f)
  where go :: [VU.Vector Int] -> [VU.Vector Int]
        go = P.map VG.fromList
           . S.toList . S.fromList

            
ADP/Fusion/Core/ForestAlign/PermuteRightLinear.hs

-- cull from p the non-needed parts via lf ht
streamUpMk p lf ht z =
      -- all sorted subsets of subforests in the forest (have a beer).
  let ssf = sortedSubForests p
      -- extract the highest possible index, which by definition is an
      -- @E index@.
      E ht' = ht
  in  {- trace ("XXX" P.++ show ssf) . -} return $ SE' ht' (z,ssf)
{-# Inline [0] streamUpMk #-}

            
ADP/Fusion/Core/ForestAlign/PermuteRightLinear.hs
{-# Inline [0] streamUpMk #-}

streamDownMk p lf ht z =
  let ssf = reverse $ VG.empty : sortedSubForests p
  in  return $ Stp (z,ssf)
{-# Inline [0] streamDownMk #-}

-- |


            
ADP/Fusion/Core/ForestAlign/PermuteRightLinear.hs
-- there is no subforest left to work with. We are done.
streamUpStep p lk lf ht (Stp (z,[]))
  = return $ SM.Done
-- We have at least one sorted subforest @x:@ to deal with. By definition,
-- sets of size 0 do not happen. This is enforced by @sortedSubForests@
-- which produces vectors of @size >= 1@.
streamUpStep p lk lf ht (Stp (z,x:xs))
  -- subsets of size one are trees. They first create an @E@psilon object.
  -- Then they create a @T@ree object, followed by a @F@orest with one tree.
  | sz == 1 = return $ SM.Yield (z:.TreeIxR p lk (E i)) (ST (z,x:xs))

            
ADP/Fusion/Core/ForestAlign/PermuteRightLinear.hs
          step (OIEE svS@(SvS s tt ii) (E i)) = return $ Skip (OIET svS (E i))
          step (OIET svS@(SvS s tt ii) (E i)) | Just l <- leftSibling (rightMostLeaf frst (getTFEIx utfe)) frst i =
            return $ Yield (SvS s (tt:.TreeIxR frst jl (T l)) (ii:.:RiTirO (T l))) 
                           (OIEF svS $ if i == (getTFEIx utfe) then (L.map F $ sortedSubForests frst) else [])
          step (OIET svS@(SvS s tt ii) (E i)) = return Done
          step (OIEF svS@(SvS s tt ii) []) = return Done
          step (OIEF svS@(SvS s tt ii) (x:xs)) =
            return $ Yield (SvS s (tt:.TreeIxR frst jl x) (ii:.:RiTirO x)) (OIEF svS xs) 
          step (OIT svS@(SvS s tt ii) (T i)) =

            
ADP/Fusion/SynVar/Indices/ForestEdit/LeftLinear.hs
import           Prelude hiding (map)
import qualified Data.Vector.Generic as VG
import           Debug.Trace
import           Data.List (sort,nub)

import           ADP.Fusion.Core
import           Data.Forest.Static
import           Data.PrimitiveArray hiding (map)


            
ADP/Fusion/SynVar/Indices/ForestEdit/LeftLinear.hs

allLeftBoundForests frst lc k = ls
  where rs = goR k
        ls = nub $ sort [ lc VG.! z | z <- rs ]
        goR (-1) = []
        goR k    = k : goR (parent frst VG.! k)

instance (MinSize c) => TableStaticVar (u I) c (TreeIxL Post v a O) where 
  tableStaticVar _ _ (OStatic  ())   _ = ORightOf   ()

            
src/AffineAlignNewickTreesSmall.hs
import           Control.Monad(forM_,unless)
import           Data.Char (toLower)
import           Data.List (nub,tails)
import           Data.List (sortBy)
import           Data.Ord (comparing)
import           Data.Vector.Fusion.Util
import           Debug.Trace
import           Numeric.Log
import qualified Data.Text as Text

            
src/AffineAlignNewickTreesSmall.hs
-- big orders.
--
-- The little-order influences per-cell calculations. Cells with the same
-- index are sorted by order and those with a smaller index calculated
-- first.
--
-- For this calculation we have the following:
--
-- @EE@ has only one rule: @EE -> ε@, the full table is filled before any

            
src/AlignNewickTrees.hs
import           Control.Monad(forM_, unless)
import           Data.Char (toLower)
import           Data.List (nub, tails)
import           Data.List (sortBy)
import           Data.Ord (comparing)
import           Data.Vector.Fusion.Util
import           Debug.Trace
import           Numeric.Log
import qualified Data.Text as Text

            
AERN-Basics-2011.1.0.1
4 matches
src/Numeric/AERN/Basics/NumericOrder/Arbitrary.hs
              do
              unambiguousConstraints <- elements consistentUnambiguousConstraints
              let cMap = Map.fromList unambiguousConstraints
              let sortedIndices = List.sortBy (turnIntoOrdering cMap) indices
              let sortedIndicesGrouped = List.groupBy (turnIntoEquality cMap) sortedIndices
              ds <- vectorOf (3 * (length sortedIndicesGrouped)) givenArbitrary
              seed <- arbitrary
              let dsDistinctSorted = getNDistinctSorted seed (length sortedIndicesGrouped) ds
                                      -- here we rely on the following property:
                                      -- it is very unlikely to get less than n distinct
                                      -- elements among 3*n elements generated by givenArbitrary 
              return $ 
                  map snd $ 

            
src/Numeric/AERN/Basics/NumericOrder/Arbitrary.hs
                                      -- elements among 3*n elements generated by givenArbitrary 
              return $ 
                  map snd $ 
                      List.sort $ 
                          concat $ 
                              zipWith zip sortedIndicesGrouped $ 
                                  map repeat dsDistinctSorted
       where
       consistentUnambiguousConstraints =
           pickConsistentOrderings permittedInLinearOrder indices constraints
       turnIntoOrdering cMap a b =

            
src/Numeric/AERN/Misc/List.hs
import qualified Data.Set as Set
import qualified Data.Map as Map

sortUsing :: (Ord b) => (a -> b) -> [a] -> [a]
sortUsing f =
    List.sortBy compareF
    where
    compareF a b = compare (f a) (f b)

{-|
    Eg: @combinations [[1,2,3],[4,5],[7]] = [[1,4,7], [1,5,7], [2,4,7], [2,5,7], [3,4,7], [3,5,7]]@

            
src/Numeric/AERN/Misc/QuickCheck.hs
    return $ permuteBy (nums :: [Int]) elems
    where
    permuteBy nums elems =
        map snd $ List.sort $ zip nums elems

            
AERN-RnToRm-0.5.0.1
1 matches
src/Data/Number/ER/RnToRm/UnitDom/ChebyshevBase/Polynom/Reduce.hs
        Map.fromList $ map snd $ largeCoeffTerms
    (smallCoeffTerms, largeCoeffTerms) = 
                splitAt (Map.size coeffs - maxTermCount) $
                    List.sort $ 
                        map (\(t,c)->(abs c, (t,c))) $ Map.toList coeffs

chplReduceTermCountDown m = fst . chplReduceTermCount m
chplReduceTermCountUp m = snd . chplReduceTermCount m


            
Advise-me-0.1
8 matches
app/AdviseMeAdmin.hs

import Data.Monoid ( (<>) )
import Data.Char
import Data.List (sort, isSuffixOf, intersperse, foldl', intersperse)
import Data.Maybe
import Data.String
import Data.Time (formatTime, defaultTimeLocale, UTCTime)
import Control.Monad
import Control.Exception

            
app/AdviseMeAdmin.hs


findDatabases :: IO [FilePath]
findDatabases = sort . filter (".db" `isSuffixOf`) <$> getDirectoryContents "."

-- | Find the network file associated with a task ID.
findNetwork :: TaskID -> IO FilePath
findNetwork tID = do
   MSP.Task t <- findTaskFuzzy tID

            
app/DatabaseBuilder.hs

import Data.Time.Clock (UTCTime)
import Data.Time.Format (parseTimeM, defaultTimeLocale)
import Data.List (sortBy, nubBy, foldl', intercalate, isPrefixOf, nub)
import Data.Char (isSpace)
import Data.Function (on)
import Data.Monoid ((<>))
import Data.Maybe (fromJust, fromMaybe, isJust)
import Control.Monad (unless, when, forM_, forM)

            
app/DatabaseBuilder.hs
         error $ "Task ID \"" ++ tID ++ "\" is not recognized."

   -- Determine the order in which the requests are sent
   let sortRequests
        | filterFlag arg  = return . sortBy
                            (\x y -> compareFilter taskFilter x y
                                  <> compareTimes x y)
        | otherwise       = return . sortBy compareAppearance


   -- Obtain requests from all databases and perform operations
   processedRecords <- concatMapM allRecords inConns
      >>= task "fix encoding"

            
app/DatabaseBuilder.hs
      >>= task "changing numbers in old task answers"
         changeNumbersInOldRequests (fixNumbersFlag arg)
      >>= task "determining request order"
         sortRequests True
      >>= task "domain reasoner"
         domainReasoner (drFlag arg)
#ifdef XLSX
      >>= task "replacing evidence, drawing from human assessments"
         (replaceEvidence $ replaceEvidenceArg arg) (length (replaceEvidenceArg arg) > 0)

            
app/DatabaseBuilder.hs
      old' <- collectInputs old
      return . replaceInputs new
             . map (Right . snd)
             . sortBy (compare `on` fst)
             . nubBy ((==) `on` fst)
             $ new' ++ old'

mkAttr (n XML.:= a) = n XML..=. a
mkContent f = either XML.string (XML.builder . f)

            
src/Bayes/EliminationOrdering.hs

minFactorNext :: (String -> Bool) -> [Dimensions] -> Maybe String
minFactorNext p ds =
   case sortOn fst (map f vs) of
      [] -> Nothing
      (_, v):_ -> Just v
 where
   vs  = filter p (vars ds)
   f v = let xs  = filter (hasVarD v) ds

            
src/Bayes/Factor.hs
makeFactor :: [(String, Int)] -> [Double] -> Factor
makeFactor d bs = F (mkD dims) (reorder dims d $ makeTree (map snd d) bs)
 where
   dims = sort d

makeTree :: [Int] -> [Double] -> Tree
makeTree is = rec (reverse is) . map leaf
 where
   rec (2:ns) ts = rec ns $ groups2 ts