camfort-0.700: CamFort - Cambridge Fortran infrastructure

Safe HaskellNone
LanguageHaskell98

Extensions.Units

Contents

Synopsis

Documentation

(<<) :: MonadState f m => Lens (->) f [o] -> o -> m () infix 2 Source

(<<++) :: MonadState f m => Lens (->) f [a] -> a -> m () infix 2 Source

doInferUnits :: (?criticals :: Bool, ?solver :: Solver, ?debug :: Bool, ?assumeLiterals :: AssumeLiterals) => Program Annotation -> State UnitEnv (Program Annotation) Source

inferProgUnits :: (?criticals :: Bool, ?solver :: Solver, ?debug :: Bool, ?assumeLiterals :: AssumeLiterals) => ProgUnit Annotation -> State UnitEnv () Source

inferBlockUnits :: (?solver :: Solver, ?criticals :: Bool, ?debug :: Bool, ?assumeLiterals :: AssumeLiterals) => Block Annotation -> Maybe ProcedureNames -> State UnitEnv () Source

reduceRows :: Col -> LinearSystem -> LinearSystem Source

reduceRows is a core part of the polymorphic unit checking for procedures.

It is essentially an "optimiation" of the Gaussian matrix (not in the sense of performance), that elimiantes rows in the system such that there are as few variables as possible. Within a function, assuming everything is consistent, then this should generate a linear constraint between the parameters and the return as a single row in the matrix. This is then used by the interprocedural constraints to hookup call-sites with definitions (in a parametrically polymorphic way- i.e. lambda abstraction is polymorphic in its units, different to say ML).

Unit inference (main, over all AST)

inferDecl :: (?assumeLiterals :: AssumeLiterals) => Maybe ProcedureNames -> Decl Annotation -> State UnitEnv (Decl Annotation) Source

inferDecl - extract and record information from explicit unit declarations

inferInterproceduralUnits :: (?solver :: Solver, ?criticals :: Bool, ?debug :: Bool, ?assumeLiterals :: AssumeLiterals) => Program Annotation -> State UnitEnv () Source

swapUnitVarCats :: Int -> Int -> [t] -> [t] Source

swapUnitVarCats' :: Int -> Int -> [t] -> [t] -> Int -> [t] Source

reorderVarCols :: State UnitEnv () Source

reorderVarCols puts any variable columns to the end of the Gaussian matrix (along with the associated information)

assumeLiteralUnits :: (?solver :: Solver, ?debug :: Bool) => State UnitEnv Bool Source

(<**>) :: Maybe a -> Maybe a -> Maybe a Source

inferSpecUnits :: (?assumeLiterals :: AssumeLiterals) => [Spec Annotation] -> State UnitEnv () Source

inferStmtUnits :: (?assumeLiterals :: AssumeLiterals) => Fortran Annotation -> State UnitEnv () Source

inferStmtUnits, does what it says on the tin

inverse :: [Int] -> [Int] Source

fixValue :: Eq a => (a -> a) -> a -> a Source

moveElem :: Int -> Int -> [a] -> [a] Source

incrElem :: Num a => a -> (Int, Int) -> Matrix a -> Matrix a Source

moveCol :: Int -> Int -> Matrix a -> Matrix a Source

mustEqual :: (?assumeLiterals :: AssumeLiterals) => Bool -> VarCol -> VarCol -> State UnitEnv VarCol Source

debugInfoForNonZeros :: [Rational] -> State UnitEnv String Source

Print debug information for non-zero coefficients from the Gaussian matrix

errorMessage :: (?debug :: Bool) => Row -> UnitConstant -> [Rational] -> State UnitEnv String Source

An attempt at getting some useful user information. Needs position information

solveSystemM :: (?solver :: Solver, ?debug :: Bool) => String -> State UnitEnv Bool Source

intrinsicsDict :: (?assumeLiterals :: AssumeLiterals) => [(String, String -> State UnitEnv ())] Source

addProductIntrinsic :: (?assumeLiterals :: AssumeLiterals) => String -> State UnitEnv () Source

addPowerIntrinsic :: (?assumeLiterals :: AssumeLiterals) => String -> State UnitEnv () Source

debugGaussian :: State UnitEnv String Source

debugGaussian - a debugging routine which shose the Gaussian matrix with various peieces of info mainly used for development purposes