-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | polynomial function enclosures (PFEs) approximating exact real functions
--
-- AERN-RnToRm provides datatypes and abstractions for approximating
-- functions of type D -> R^m where D is a bounded
-- interval in R^n with non-empty interior.
--
-- Abstractions are provided via 4 type classes:
--
--
-- - ERUnitFnBase: generalises polynomials with floating point
-- coefficients. (Not exported here, used only internally.)
-- - ERFnApprox: generalises functions enclosures on a certain
-- unspecified domain.
-- - ERUnitFnApprox (extends ERFnApprox): generalises function graph
-- enclosures on the domain [-1,1]^n. (Not exported here,
-- used only internally.)
-- - ERFnDomApprox (extends ERFnApprox): generalises function
-- enclosures over a specified and queriable domain box (instance of
-- class DomainBox).
--
--
-- At all levels, all field operations are supported as well as some
-- elementary operations, namely exp, sin and cos. Log and sqrt are
-- planned to be added soon.
--
-- Implementations of ERUnitFnBase:
--
--
--
-- By using the Chebyshev basis on domain [-1,1]^n, we gain
-- simple and optimally rounding degree reduction as well as relatively
-- simple handling of rounding in other operations.
--
-- Implementations of ERUnitFnApprox:
--
--
--
-- Implementations of ERFnDomApprox:
--
--
-- - ERFnDomTranslApprox: builds a basic implementation using an
-- instance of ERUnitFnApprox.
-- - ERFnTuple: extends another implementation of ERFnDomApprox to work
-- with lists of functions simultaneously.
-- - ERFnDomEdgesApprox: separately enclose a function on its domain
-- box as well as on all the domain's hyper-edges (including the corners)
-- using another implementation of ERFnDomApprox.
-- - ERFnPiecewise: allows the domain box to be bisected to an
-- arbitrary finite depth and uses another implementation of
-- ERFnDomApprox to approximate the function on each segment.
--
--
-- Simple examples of usage can be found in tests/Demo.hs.
@package AERN-RnToRm
@version 0.3.0
-- | Internal module for
-- Data.Number.ER.RnToRm.UnitDom.ChebyshevBase.Polynom.
--
-- Definition of the polynomial datatype and simple related functions.
module Data.Number.ER.RnToRm.UnitDom.ChebyshevBase.Polynom.Basic
-- | A polynomial represented by its coefficients it the Chebyshev basis.
--
-- The polynomials are never to be used outside the domain
-- [-1,1]^n.
--
-- All operations are rounded in such a way that the resulting polynomial
-- is a point-wise upper or lower bound of the exact result.
data ERChebPoly box b
ERChebPoly :: (Map (TermKey box) b) -> ERChebPoly box b
chplCoeffs :: ERChebPoly box b -> (Map (TermKey box) b)
type TermKey box = box
chplConstTermKey :: (DomainBox box varid d) => box
chplIsConstTermKey :: (DomainBox box varid d) => box -> Bool
chplTermOrder :: (DomainBox box varid d, Num d) => box -> d
chplTermArity :: (DomainBox box varid d) => box -> Int
-- | Inspect all terms of the polynomial and return the degree of the
-- highest degree term.
chplGetDegree :: (ERRealBase b, DomainBox box varid d, Num d, Ord d) => (ERChebPoly box b) -> d
chplConst :: (ERRealBase b, DomainBox box varid Int, Ord box) => b -> ERChebPoly box b
-- | make a basic x polynomial for a given variable number
chplVar :: (ERRealBase b, DomainBox box varid Int, Ord box) => varid -> ERChebPoly box b
chplNormaliseUp :: (ERRealBase b, DomainBox box varid Int, Ord box) => ERChebPoly box b -> ERChebPoly box b
chplNormaliseDown :: (ERRealBase b, DomainBox box varid Int, Ord box) => ERChebPoly box b -> ERChebPoly box b
chplNormalise :: (ERRealBase b, DomainBox box varid Int, Ord box) => ERChebPoly box b -> (ERChebPoly box b, ERChebPoly box b)
-- | Convert a polynomial to a string representation, using the ordinary
-- x^n basis.
chplShow :: (ERRealBase b, DomainBox box varid Int, Ord box) => Bool -> ERChebPoly box b -> String
-- | conversion of polynomials from Chebyshev basis to the X^n basis
--
-- (not exact - suffering from rounding in the coefficient conversions)
chebToXBasis :: (ERRealBase b, DomainBox box varid Int, Ord box) => (Map (TermKey box) b) -> (Map (TermKey box) b)
-- | conversion of one Chebyshev term to the X^n basis
termXterms :: (DomainBox box varid Int, Ord box) => TermKey box -> Map (TermKey box) Integer
-- | Chebyshev polynomials expressed as associative lists power -> coeff
chebyXCoeffsLists :: (Num d1, Enum d1, Num d2, Enum d2) => [[(d1, d2)]]
-- | Chebyshev polynomials expressed as lists of integer coefficients for
-- powers 0,1,2...
chebyXCoeffs :: (Num d, Enum d) => [[d]]
instance Typeable2 ERChebPoly
instance (Eq box, Eq b) => Eq (ERChebPoly box b)
instance (Data box, Data b, Ord box) => Data (ERChebPoly box b)
instance (ERRealBase b, DomainBox box varid Int, Ord box) => Show (ERChebPoly box b)
instance (Ord a, Binary a, Binary b) => Binary (ERChebPoly a b)
-- | Internal module for
-- Data.Number.ER.RnToRm.UnitDom.ChebyshevBase.Polynom.
--
-- Implementation of field arithmetic over polynomials with rounding
-- consistent over the whole domain.
module Data.Number.ER.RnToRm.UnitDom.ChebyshevBase.Polynom.Field
chplAffine :: (ERRealBase b, DomainBox box varid Int, Ord box) => b -> Map varid b -> ERChebPoly box b
-- | Convert a polynomial to a lower-order one that is dominated by (resp.
-- dominates) it closely on the domain [-1,1].
chplReduceDegree :: (ERRealBase b, DomainBox box varid Int, Ord box) => Int -> ERChebPoly box b -> (ERChebPoly box b, ERChebPoly box b)
-- | multiply a polynomial by a scalar rounding downwards and upwards
chplScale :: (ERRealBase b, DomainBox box varid Int, Ord box) => b -> (ERChebPoly box b) -> (ERChebPoly box b, ERChebPoly box b)
-- | multiply a polynomial by a scalar interval rounding downwards and
-- upwards
chplScaleApprox :: (ERRealBase b, DomainBox box varid Int, Ord box) => (b, b) -> (ERChebPoly box b) -> (ERChebPoly box b, ERChebPoly box b)
instance (ERRealBase b, DomainBox box varid Int, Ord box) => Ord (ERChebPoly box b)
instance (ERRealBase b, DomainBox box varid Int, Ord box) => Fractional (ERChebPoly box b)
instance (ERRealBase b, DomainBox box varid Int, Ord box) => Num (ERChebPoly box b)
-- | Internal module for
-- Data.Number.ER.RnToRm.UnitDom.ChebyshevBase.Polynom.
--
-- Implementation of various evaluation functions related to polynomials.
module Data.Number.ER.RnToRm.UnitDom.ChebyshevBase.Polynom.Eval
-- | Evaluate a polynomial at a point, consistently rounding upwards and
-- downwards.
chplEval :: (ERRealBase b, DomainBox box varid Int, Ord box, DomainBoxMappable boxb boxbb varid b [(b, b)]) => boxb -> ERChebPoly box b -> (b, b)
chplEvalUp :: (ERRealBase b, DomainBox box varid Int, Ord box, DomainBoxMappable boxb boxbb varid b [(b, b)]) => boxb -> ERChebPoly box b -> b
chplEvalDown :: (ERRealBase b, DomainBox box varid Int, Ord box, DomainBoxMappable boxb boxbb varid b [(b, b)]) => boxb -> ERChebPoly box b -> b
chebyEvalTsRoundDownUp :: (Num v) => v -> [(v, v)]
chebyEvalTsExact :: (Num v) => v -> [v]
-- | Evaluate a polynomial at a real number approximation
chplEvalApprox :: (ERRealBase b, ERApprox ra, DomainBox box varid Int, Ord box, DomainBoxMappable boxra boxras varid ra [ra], DomainIntBox boxra varid ra) => (b -> ra) -> boxra -> ERChebPoly box b -> ra
-- | Substitute several variables in a polynomial with real number
-- approximations, rounding downwards and upwards.
chplPartialEvalApprox :: (ERRealBase b, ERApprox ra, DomainBox box varid Int, Ord box, DomainBoxMappable boxra boxras varid ra [ra], DomainIntBox boxra varid ra) => (ra -> (b, b)) -> boxra -> ERChebPoly box b -> (ERChebPoly box b, ERChebPoly box b)
-- | Compose two polynomials, rounding upwards provided the second
-- polynomial maps [-1,1] into [-1,1].
chplCompose :: (ERRealBase b, DomainBox box varid Int, Ord box) => Int -> ERChebPoly box b -> Map varid (ERChebPoly box b) -> (ERChebPoly box b, ERChebPoly box b)
-- | Internal module for
-- Data.Number.ER.RnToRm.UnitDom.ChebyshevBase.Polynom.
--
-- Implementation of various functions related to the bounds of
-- polynomials.
module Data.Number.ER.RnToRm.UnitDom.ChebyshevBase.Polynom.Bounds
-- | Find an upper bound on a polynomial over the unit domain [-1,1]^n.
chplUpperBoundAffine :: (ERRealBase b, DomainBox box varid Int, Ord box) => EffortIndex -> ERChebPoly box b -> b
-- | Find a close upper bound on an affine polynomial over the unit domain
-- [-1,1]^n.
chplUpperBoundAffineCorners :: (ERRealBase b, DomainBox box varid Int, Ord box, DomainBoxMappable boxb boxbb varid b [(b, b)], Num varid, Enum varid) => EffortIndex -> ERChebPoly box b -> b
-- | Find a close upper bound on a quadratic polynomial over the unit
-- domain [-1,1]^n.
chplUpperBoundQuadr :: (ERRealBase b, RealFrac b, DomainBox box varid Int, Ord box, DomainBoxMappable boxra boxras varid (ERInterval b) [ERInterval b], DomainBoxMappable boxra boxra varid (ERInterval b) (ERInterval b), DomainIntBox boxra varid (ERInterval b), Num varid, Enum varid) => EffortIndex -> ERChebPoly box b -> b
-- | Approximate from below and from above the pointwise maximum of two
-- polynomials
chplMax :: (ERRealBase b, DomainBox box varid Int, Ord box) => Int -> ERChebPoly box b -> ERChebPoly box b -> (ERChebPoly box b, ERChebPoly box b)
-- | Approximate the function max(0,p(x)) by a polynomial from below and
-- from above.
chplNonneg :: (ERRealBase b, DomainBox box varid Int, Ord box) => Int -> ERChebPoly box b -> (ERChebPoly box b, ERChebPoly box b)
-- | A version of chplNonneg using a cubic approximation.
chplNonnegCubic :: (ERRealBase b, DomainBox box varid Int, Ord box) => Int -> ERChebPoly box b -> (ERChebPoly box b, ERChebPoly box b)
-- | Internal module for
-- Data.Number.ER.RnToRm.UnitDom.ChebyshevBase.Polynom.
--
-- Implementation of elementary functions applied to polynomials.
module Data.Number.ER.RnToRm.UnitDom.ChebyshevBase.Polynom.Elementary
-- | Approximate the pointwise square root of a polynomial by another
-- polynomial from below and from above.
chplSqrt :: (ERRealBase b, RealFrac b, DomainBox box varid Int, Ord box) => Int -> EffortIndex -> ERChebPoly box b -> (ERChebPoly box b, ERChebPoly box b)
-- | Approximate the pointwise exponential of a polynomial by another
-- polynomial from below and from above.
chplExp :: (ERRealBase b, RealFrac b, DomainBox box varid Int, Ord box) => Int -> EffortIndex -> ERChebPoly box b -> (ERChebPoly box b, ERChebPoly box b)
-- | Approximate the pointwise integer power of a polynomial by another
-- polynomial from above.
chplPow :: (ERRealBase b, Integral i, DomainBox box varid Int, Ord box) => Int -> ERChebPoly box b -> i -> ERChebPoly box b
-- | Approximate the pointwise natural logarithm of a polynomial by another
-- polynomial from below and from above.
chplLog :: (ERRealBase b, RealFrac b, DomainBox box varid Int, Ord box) => Int -> EffortIndex -> ERChebPoly box b -> (ERChebPoly box b, ERChebPoly box b)
-- | Approximate the pointwise sine of a polynomial by another polynomial
-- from below and from above.
chplSineCosine :: (ERRealBase b, RealFrac b, DomainBox box varid Int, Ord box) => Bool -> Int -> EffortIndex -> ERChebPoly box b -> (ERChebPoly box b, ERChebPoly box b)
-- | Approximate the pointwise cosine of a polynomial by another polynomial
-- from below and from above using the tau method as described in [Mason
-- & Handscomb 2003, p 62].
chplRecip :: (ERRealBase b, RealFrac b, DomainBox box varid Int, Ord box) => Int -> EffortIndex -> ERChebPoly box b -> (ERChebPoly box b, ERChebPoly box b)
-- | Internal module for
-- Data.Number.ER.RnToRm.UnitDom.ChebyshevBase.Polynom.
--
-- Implementation of safely rounded integration of polynomials and other
-- related functions.
module Data.Number.ER.RnToRm.UnitDom.ChebyshevBase.Polynom.Integration
-- | Approximate from below and from above the integral of a polynomial.
--
-- Based on the following formulas for Chebyshev polynomials:
--
--
-- \int T_n(x)dx =
-- T_{n+1}(x)/2(n+1) - T_{n-1}(x)/2(n-1)
--
--
--
-- \int T_1(x)dx =
-- T_2(x)/4 + 1/4
--
--
--
-- \int T_0(x)dx =
-- T_1(x)
--
chplIntegrate :: (ERRealBase b, DomainBox box varid Int, Ord box) => varid -> ERChebPoly box b -> (ERChebPoly box b, ERChebPoly box b)
-- | measure the volume between a polynomial and the zero axis on [-1,1]^n
chplVolumeAboveZero :: (ERRealBase b, DomainBox box varid Int, Ord box, DomainBoxMappable boxb boxbb varid b [(b, b)]) => [varid] -> ERChebPoly box b -> (b, b)
-- | Differentiate a polynomial using one of its variables.
chplDifferentiate :: (ERRealBase b, DomainBox box varid Int, Ord box) => ERChebPoly box b -> varid -> ERChebPoly box b
-- | Defines a representation for recursive bisections of R^n by
-- hyperplanes, each of which is perpendicular to a base axis.
--
-- Arbitrary data can be associated with the sections of a partition.
--
-- To be imported qualified, usually with prefix BISTR.
module Data.Number.ER.RnToRm.BisectionTree
-- |
-- - The root of the tree often represents the whole R^n.
-- - Each node splits the parent's space into two using a specified
-- variable (ie direction) and an optional splitting point.
-- - By default, a split is taken at the point defined by the method
-- RA.bisect.
--
data BisectionTree box varid d v
Leaf :: Depth -> box -> v -> BisectionTree box varid d v
bistrDepth :: BisectionTree box varid d v -> Depth
-- | domain
bistrDom :: BisectionTree box varid d v -> box
-- | value estimate
bistrVal :: BisectionTree box varid d v -> v
Node :: Depth -> box -> varid -> d -> BisectionTree box varid d v -> BisectionTree box varid d v -> BisectionTree box varid d v
bistrDepth :: BisectionTree box varid d v -> Depth
-- | domain
bistrDom :: BisectionTree box varid d v -> box
-- | direction to split in
bistrDir :: BisectionTree box varid d v -> varid
-- | point that the split is at
bistrPt :: BisectionTree box varid d v -> d
-- | the half towards -Infty in split dir
bistrLO :: BisectionTree box varid d v -> BisectionTree box varid d v
-- | the half towards +Infty in split dir
bistrHI :: BisectionTree box varid d v -> BisectionTree box varid d v
type Depth = Int
-- | value splitter function - parameters are: depth, domain of value,
-- value, variable to split by, point to split at; returns the two split
-- values
type ValueSplitter box varid d v = EffortIndex -> Depth -> box -> v -> varid -> d -> (v, v)
type ValueCombiner box varid d v = EffortIndex -> Depth -> (BisectionTree box varid d v) -> v
isLeaf :: BisectionTree box varid d v -> Bool
const :: box -> v -> BisectionTree box varid d v
removeVars :: (ERIntApprox d, DomainIntBox box varid d, DomainBoxMappable box box varid d d) => box -> BisectionTree box varid d v -> BisectionTree box varid d v
-- | Ensure both trees have equal structure at the top level: either they
-- are all leaves or they all split at the same direction with the same
-- splitting point.
--
-- Also, unify the domains at the top level.
sync2 :: (ERIntApprox d, DomainIntBox box varid d) => ValueSplitter box varid d v1 -> ValueSplitter box varid d v2 -> EffortIndex -> BisectionTree box varid d v1 -> BisectionTree box varid d v2 -> (BisectionTree box varid d v1, BisectionTree box varid d v2)
-- | Ensure all the trees have equal structure at the top level: either
-- they are all leaves or they all split at the same direction with the
-- same splitting point.
--
-- Also, unify the domains at the top level.
syncMany :: (ERIntApprox d, DomainIntBox box varid d) => ValueSplitter box varid d v -> EffortIndex -> [BisectionTree box varid d v] -> [BisectionTree box varid d v]
split :: (ERIntApprox d, DomainBox box varid d) => ValueSplitter box varid d v -> EffortIndex -> varid -> d -> box -> BisectionTree box varid d v -> BisectionTree box varid d v
-- | Apply a function to all values, thus creating a new tree.
mapWithDom :: (DomainBox box varid d) => (box -> v1 -> v2) -> BisectionTree box varid d v1 -> BisectionTree box varid d v2
-- | Apply a function to all values, thus creating a new tree.
mapLeaves :: (BisectionTree box varid d v1 -> BisectionTree box varid d v2) -> BisectionTree box varid d v1 -> BisectionTree box varid d v2
-- | Perform a given action on all branches of a bisection tree, left to
-- right. (optionally now going below the given depth)
doBistr :: (box -> v -> IO ()) -> Maybe Int -> BisectionTree box varid d v -> IO ()
-- | Perform a given action on all branches of a bisection tree, left to
-- right. (optionally now going below the given depth)
doMap :: (Depth -> box -> v -> IO v) -> Maybe Int -> BisectionTree box varid d v -> IO (BisectionTree box varid d v)
-- | Perform a given action on all branches of a bisection tree, left to
-- right with the option of further branching the tree. (optionally now
-- going below the given depth)
doMapLeaves :: (BisectionTree box varid d v -> IO (BisectionTree box varid d v)) -> Maybe Int -> BisectionTree box varid d v -> IO (BisectionTree box varid d v)
-- | Combine two bisection trees using a given value combining function.
-- Where necessary, leaves are split so that the resulting tree's
-- structure is the union of the two argument tree structures. Such
-- splitting of values in leaves is performed by the provided functions.
combineWith :: (ERIntApprox d, DomainIntBox box varid d) => ValueSplitter box varid d v1 -> ValueSplitter box varid d v2 -> (box -> v1 -> v2 -> (Maybe res, aux)) -> EffortIndex -> (BisectionTree box varid d v1) -> (BisectionTree box varid d v2) -> (Maybe (BisectionTree box varid d res), [aux])
-- | return all values in leafs (except those within some CE subtree) as a
-- list (from the leftmost to the rightmost)
collectValues :: BisectionTree box varid b a -> [a]
-- | return all values in leafs (except those within some CE subtree) as a
-- list (from the leftmost to the rightmost)
collectDomValues :: BisectionTree box varid d v -> [(box, v)]
-- | lookup the smallest subtree whose domain covers the given rectangle
lookupSubtreeDom :: (ERIntApprox d, DomainBox box varid d) => (BisectionTree box varid d v) -> box -> (BisectionTree box varid d v)
instance Typeable4 BisectionTree
instance (Data box, Data varid, Data d, Data v) => Data (BisectionTree box varid d v)
instance (VariableID varid, Show d, Show v, DomainBox box varid d) => Show (BisectionTree box varid d v)
instance (Binary a, Binary b, Binary c, Binary d) => Binary (BisectionTree a b c d)
-- | To be imported qualified, usually with prefix BTINTEG.
module Data.Number.ER.RnToRm.BisectionTree.Integration
-- | Transform a bunch of bisection trees over the same domain by
-- integrating them in a very abstract sense. The trees are
-- unified in their splitting patterns in the process. By supplying
-- certain parameters, this function can in fact perform numerical
-- integration of piece-wise polynomial functions.
--
-- It can be also viewed as a zipping+folding operator over
-- bisection trees that generates another bunch of bisection trees,
-- synchronously traversing the original trees from a certain point on a
-- selected axis outwards in both directions, carrying some data along.
zipFromOrigin :: (ERIntApprox d, DomainIntBox box varid d, Show v1, Show v2, Show valPass) => ValueSplitter box varid d v1 -> ValueCombiner box varid d v1 -> EffortIndex -> varid -> d -> (Maybe (box)) -> (Maybe valPass -> Maybe valPass -> [BisectionTree box varid d v1] -> [BisectionTree box varid d v2]) -> (EffortIndex -> Depth -> (box) -> [v1] -> [v2] -> Bool) -> (EffortIndex -> Depth -> (box) -> [v1] -> (valPass, [v2], valPass)) -> (EffortIndex -> Depth -> (box) -> valPass -> [v1] -> ([v2], valPass)) -> (EffortIndex -> Depth -> (box) -> [v1] -> valPass -> (valPass, [v2])) -> [BisectionTree box varid d v1] -> [BisectionTree box varid d v2]
-- | Zip a list of bisection trees in synchrony but do something else
-- inside and not inside a given subdomain.
--
-- Further splitting at default points will be done up to the given depth
-- in an attempt to separate the subdomain as well as possible.
--
-- If the subdomain is not properly isolated by the splitting at the
-- maximum depth, splits are made at irregular points to ensure full
-- isolation of the subdomain.
zipOnSubdomain :: (ERIntApprox d, DomainIntBox box varid d) => ValueSplitter box varid d v1 -> EffortIndex -> Depth -> box -> (box -> [v1] -> [v2]) -> (box -> [v1] -> [v2]) -> (box -> [v1] -> [v2]) -> [BisectionTree box varid d v1] -> [BisectionTree box varid d v2]
-- | A class abstracting function arithmetic with directed rounding. It is
-- used to describe a boundary for an approximation to a real function on
-- the interval [-1,1]^n.
--
-- To be imported qualified, usually with the synonym UFB.
module Data.Number.ER.RnToRm.UnitDom.Base
class (ERRealBase b, ERIntApprox ra, Fractional ufb, Ord ufb, DomainBox boxb varid b, DomainIntBox boxra varid ra) => ERUnitFnBase boxb boxra varid b ra ufb | ufb -> boxb boxra varid b ra
check :: (ERUnitFnBase boxb boxra varid b ra ufb) => String -> ufb -> ufb
getGranularity :: (ERUnitFnBase boxb boxra varid b ra ufb) => ufb -> Granularity
setMinGranularity :: (ERUnitFnBase boxb boxra varid b ra ufb) => Granularity -> ufb -> ufb
setGranularity :: (ERUnitFnBase boxb boxra varid b ra ufb) => Granularity -> ufb -> ufb
const :: (ERUnitFnBase boxb boxra varid b ra ufb) => b -> ufb
affine :: (ERUnitFnBase boxb boxra varid b ra ufb) => b -> Map varid b -> ufb
scale :: (ERUnitFnBase boxb boxra varid b ra ufb) => b -> ufb -> (ufb, ufb)
scaleApprox :: (ERUnitFnBase boxb boxra varid b ra ufb) => ra -> ufb -> (ufb, ufb)
scaleApproxDown :: (ERUnitFnBase boxb boxra varid b ra ufb) => ra -> ufb -> ufb
scaleApproxUp :: (ERUnitFnBase boxb boxra varid b ra ufb) => ra -> ufb -> ufb
getDegree :: (ERUnitFnBase boxb boxra varid b ra ufb) => ufb -> Int
reduceDegree :: (ERUnitFnBase boxb boxra varid b ra ufb) => Int -> ufb -> (ufb, ufb)
reduceDegreeDown :: (ERUnitFnBase boxb boxra varid b ra ufb) => Int -> ufb -> ufb
reduceDegreeUp :: (ERUnitFnBase boxb boxra varid b ra ufb) => Int -> ufb -> ufb
integrate :: (ERUnitFnBase boxb boxra varid b ra ufb) => varid -> ufb -> (ufb, ufb)
integrateDown :: (ERUnitFnBase boxb boxra varid b ra ufb) => varid -> ufb -> ufb
integrateUp :: (ERUnitFnBase boxb boxra varid b ra ufb) => varid -> ufb -> ufb
volumeAboveZero :: (ERUnitFnBase boxb boxra varid b ra ufb) => [varid] -> ufb -> (b, b)
upperBound :: (ERUnitFnBase boxb boxra varid b ra ufb) => EffortIndex -> ufb -> b
lowerBound :: (ERUnitFnBase boxb boxra varid b ra ufb) => EffortIndex -> ufb -> b
nonneg :: (ERUnitFnBase boxb boxra varid b ra ufb) => Int -> ufb -> (ufb, ufb)
recip :: (ERUnitFnBase boxb boxra varid b ra ufb) => Int -> EffortIndex -> ufb -> (ufb, ufb)
recipDown :: (ERUnitFnBase boxb boxra varid b ra ufb) => Int -> EffortIndex -> ufb -> ufb
recipUp :: (ERUnitFnBase boxb boxra varid b ra ufb) => Int -> EffortIndex -> ufb -> ufb
max :: (ERUnitFnBase boxb boxra varid b ra ufb) => Int -> ufb -> ufb -> (ufb, ufb)
maxDown :: (ERUnitFnBase boxb boxra varid b ra ufb) => Int -> ufb -> ufb -> ufb
maxUp :: (ERUnitFnBase boxb boxra varid b ra ufb) => Int -> ufb -> ufb -> ufb
min :: (ERUnitFnBase boxb boxra varid b ra ufb) => Int -> ufb -> ufb -> (ufb, ufb)
minDown :: (ERUnitFnBase boxb boxra varid b ra ufb) => Int -> ufb -> ufb -> ufb
minUp :: (ERUnitFnBase boxb boxra varid b ra ufb) => Int -> ufb -> ufb -> ufb
sqrt :: (ERUnitFnBase boxb boxra varid b ra ufb) => Int -> EffortIndex -> ufb -> (ufb, ufb)
exp :: (ERUnitFnBase boxb boxra varid b ra ufb) => Int -> EffortIndex -> ufb -> (ufb, ufb)
log :: (ERUnitFnBase boxb boxra varid b ra ufb) => Int -> EffortIndex -> ufb -> (ufb, ufb)
sin :: (ERUnitFnBase boxb boxra varid b ra ufb) => Int -> EffortIndex -> ufb -> (ufb, ufb)
cos :: (ERUnitFnBase boxb boxra varid b ra ufb) => Int -> EffortIndex -> ufb -> (ufb, ufb)
eval :: (ERUnitFnBase boxb boxra varid b ra ufb) => boxb -> ufb -> (b, b)
evalDown :: (ERUnitFnBase boxb boxra varid b ra ufb) => boxb -> ufb -> b
evalUp :: (ERUnitFnBase boxb boxra varid b ra ufb) => boxb -> ufb -> b
evalApprox :: (ERUnitFnBase boxb boxra varid b ra ufb) => boxra -> ufb -> ra
partialEvalApprox :: (ERUnitFnBase boxb boxra varid b ra ufb) => boxra -> ufb -> (ufb, ufb)
partialEvalApproxDown :: (ERUnitFnBase boxb boxra varid b ra ufb) => boxra -> ufb -> ufb
partialEvalApproxUp :: (ERUnitFnBase boxb boxra varid b ra ufb) => boxra -> ufb -> ufb
compose :: (ERUnitFnBase boxb boxra varid b ra ufb) => Int -> ufb -> Map varid ufb -> (ufb, ufb)
composeDown :: (ERUnitFnBase boxb boxra varid b ra ufb) => Int -> ufb -> Map varid ufb -> ufb
composeUp :: (ERUnitFnBase boxb boxra varid b ra ufb) => Int -> ufb -> Map varid ufb -> ufb
raEndpoints :: (ERUnitFnBase boxb boxra varid b ra ufb) => ufb -> ra -> (b, b)
raFromEndpoints :: (ERUnitFnBase boxb boxra varid b ra ufb) => ufb -> (b, b) -> ra
-- | Arithmetic of multivariate polynomials represented by their
-- coefficients it the Chebyshev basis.
--
-- The polynomials are never to be used outside the domain
-- [-1,1]^n.
--
-- All operations are rounded in such a way that the resulting polynomial
-- is a point-wise upper or lower bound of the exact result.
module Data.Number.ER.RnToRm.UnitDom.ChebyshevBase.Polynom
-- | A polynomial represented by its coefficients it the Chebyshev basis.
--
-- The polynomials are never to be used outside the domain
-- [-1,1]^n.
--
-- All operations are rounded in such a way that the resulting polynomial
-- is a point-wise upper or lower bound of the exact result.
data ERChebPoly box b
ERChebPoly :: (Map (TermKey box) b) -> ERChebPoly box b
chplCoeffs :: ERChebPoly box b -> (Map (TermKey box) b)
type TermKey box = box
instance (ERRealBase rb, RealFrac rb, DomainBox box varid Int, Ord box, DomainBoxMappable boxb boxbb varid rb [(rb, rb)], DomainBoxMappable boxra boxras varid (ERInterval rb) [ERInterval rb], DomainIntBox boxra varid (ERInterval rb)) => ERUnitFnBase boxb boxra varid rb (ERInterval rb) (ERChebPoly box rb)
-- | Approximation of a real functions with rectangular domains.
--
-- To be imported qualified, usually with the synonym FA.
module Data.Number.ER.RnToRm.Approx
-- | A class of types that approximate first-order real functions R^n
-- -> R^m using some type of graph enclosures. The domains of the
-- functions can be neither specified nor investigated by operations in
-- this class.
--
-- This class extends ERApprox so that we could perform point-wise
-- operations on the functions.
--
-- This class is associated with:
--
--
-- - two real number types (instances of ERIntApprox) for
-- working with parts of the function's domain and range;
-- - a type of boxes indexed by variables (instance of
-- DomainBox) for working with parts of the function's
-- domain.
--
class (ERApprox fa, ERIntApprox domra, ERIntApprox ranra, DomainBox box varid domra) => ERFnApprox box varid domra ranra fa | fa -> box varid domra ranra
check :: (ERFnApprox box varid domra ranra fa) => String -> fa -> fa
domra2ranra :: (ERFnApprox box varid domra ranra fa) => fa -> domra -> ranra
ranra2domra :: (ERFnApprox box varid domra ranra fa) => fa -> ranra -> domra
getDegree :: (ERFnApprox box varid domra ranra fa) => fa -> Int
setMaxDegree :: (ERFnApprox box varid domra ranra fa) => Int -> fa -> fa
getMaxDegree :: (ERFnApprox box varid domra ranra fa) => fa -> Int
getBestPrecision :: (ERFnApprox box varid domra ranra fa) => fa -> Precision
getRangeApprox :: (ERFnApprox box varid domra ranra fa) => fa -> ranra
tuple :: (ERFnApprox box varid domra ranra fa) => [fa] -> fa
getTupleSize :: (ERFnApprox box varid domra ranra fa) => fa -> Int
applyTupleFn :: (ERFnApprox box varid domra ranra fa) => ([fa] -> [fa]) -> (fa -> fa)
volume :: (ERFnApprox box varid domra ranra fa) => fa -> ranra
scale :: (ERFnApprox box varid domra ranra fa) => ranra -> fa -> fa
partialIntersect :: (ERFnApprox box varid domra ranra fa) => EffortIndex -> box -> fa -> fa -> fa
intersectMeasureImprovement :: (ERFnApprox box varid domra ranra fa) => EffortIndex -> fa -> fa -> (fa, ranra)
eval :: (ERFnApprox box varid domra ranra fa) => box -> fa -> [ranra]
partialEval :: (ERFnApprox box varid domra ranra fa) => box -> fa -> fa
composeThin :: (ERFnApprox box varid domra ranra fa) => fa -> Map varid fa -> fa
-- | This class extends ERFnApprox by:
--
--
-- - making the domain of the function enclosure available for
-- inspection;
-- - allowing the construction of basic function enclosures where the
-- domain has to be specified.
--
class (ERFnApprox box varid domra ranra fa, DomainIntBox box varid domra) => ERFnDomApprox box varid domra ranra fa | fa -> box varid domra ranra
bottomApprox :: (ERFnDomApprox box varid domra ranra fa) => box -> Int -> fa
const :: (ERFnDomApprox box varid domra ranra fa) => box -> [ranra] -> fa
proj :: (ERFnDomApprox box varid domra ranra fa) => box -> varid -> fa
dom :: (ERFnDomApprox box varid domra ranra fa) => fa -> box
bisect :: (ERFnDomApprox box varid domra ranra fa) => varid -> Maybe domra -> fa -> (fa, fa)
unBisect :: (ERFnDomApprox box varid domra ranra fa) => varid -> (fa, fa) -> fa
integrate :: (ERFnDomApprox box varid domra ranra fa) => EffortIndex -> fa -> varid -> box -> domra -> fa -> fa
integrateUnary :: (ERFnDomApprox box varid domra ranra fa) => EffortIndex -> fa -> domra -> domra -> [ranra] -> fa
integrateMeasureImprovement :: (ERFnDomApprox box varid domra ranra fa) => EffortIndex -> fa -> varid -> box -> domra -> fa -> (fa, fa)
integrateMeasureImprovementUnary :: (ERFnDomApprox box varid domra ranra fa) => EffortIndex -> fa -> domra -> domra -> fa -> (fa, fa)
-- | Recursively perform a number of bisections and then glue the bits back
-- together.
--
-- This way we can ensure that a piece-wise enclosure has a partition
-- that goes to at least the given depth.
bisectUnbisectDepth :: (ERFnDomApprox box varid domra ranra fa) => Int -> fa -> fa
-- | Approximation of continuous real functions defined on the unit
-- rectangle domain of a certain dimension.
--
-- To be imported qualified, usually with the synonym UFA.
module Data.Number.ER.RnToRm.UnitDom.Approx
-- | This class extends ERFnApprox by:
--
--
-- - assuming that the domain of the function enclosures is always
-- [-1,1]^n for some n;
-- - allowing the construction of basic function enclosures where the
-- domain has to be known.
--
class (ERFnApprox box varid domra ranra fa) => ERUnitFnApprox box varid domra ranra fa | fa -> box varid domra ranra
bottomApprox :: (ERUnitFnApprox box varid domra ranra fa) => fa
const :: (ERUnitFnApprox box varid domra ranra fa) => [ranra] -> fa
affine :: (ERUnitFnApprox box varid domra ranra fa) => [ranra] -> Map varid ([ranra]) -> fa
volume :: (ERUnitFnApprox box varid domra ranra fa) => [varid] -> fa -> ranra
intersectMeasureImprovement :: (ERUnitFnApprox box varid domra ranra fa) => EffortIndex -> [varid] -> fa -> fa -> (fa, ranra)
integrate :: (ERUnitFnApprox box varid domra ranra fa) => EffortIndex -> fa -> varid -> domra -> fa -> fa
-- | A construction of an enclosure of a real function on the domain
-- [-1,1]^n for some n using elements of some base (eg rational functions
-- or polynomials).
module Data.Number.ER.RnToRm.UnitDom.Approx.Interval
data ERFnInterval fb ra
ERFnIntervalAny :: ERFnContext -> ERFnInterval fb ra
erfnContext :: ERFnInterval fb ra -> ERFnContext
ERFnInterval :: fb -> fb -> ERFnContext -> ra -> ERFnInterval fb ra
erfnUpper :: ERFnInterval fb ra -> fb
erfnLowerNeg :: ERFnInterval fb ra -> fb
erfnContext :: ERFnInterval fb ra -> ERFnContext
erfnGlobal :: ERFnInterval fb ra -> ra
data ERFnContext
ERFnContext :: Int -> Granularity -> ERFnContext
erfnMaxDegree :: ERFnContext -> Int
erfnCoeffGranularity :: ERFnContext -> Granularity
instance Typeable ERFnContext
instance Typeable2 ERFnInterval
instance Show ERFnContext
instance Data ERFnContext
instance (Data fb, Data ra) => Data (ERFnInterval fb ra)
instance (ERUnitFnBase boxb boxra varid b ra fb) => ERUnitFnApprox boxra varid ra ra (ERFnInterval fb ra)
instance (ERUnitFnBase boxb boxra varid b ra fb) => ERFnApprox boxra varid ra ra (ERFnInterval fb ra)
instance (ERUnitFnBase boxb boxra varid b ra fb, ERApproxElementary ra) => ERApproxElementary (ERFnInterval fb ra)
instance (ERUnitFnBase boxb boxra varid b ra fb) => ERIntApprox (ERFnInterval fb ra)
instance (ERUnitFnBase boxb boxra varid b ra fb) => ERApprox (ERFnInterval fb ra)
instance (ERUnitFnBase boxb boxra varid b ra fb) => Fractional (ERFnInterval fb ra)
instance (ERUnitFnBase boxb boxra varid b ra fb) => Num (ERFnInterval fb ra)
instance (ERUnitFnBase boxb boxra varid b ra fb) => Ord (ERFnInterval fb ra)
instance (ERUnitFnBase boxb boxra varid b ra fb) => Eq (ERFnInterval fb ra)
instance (ERUnitFnBase boxb boxra varid b ra fb) => Show (ERFnInterval fb ra)
instance Binary ERFnContext
instance (Binary a, Binary b) => Binary (ERFnInterval a b)
-- | Datatype translating enclosures from [-1,1]^n to any compact
-- interval in R^n with non-empty interior.
module Data.Number.ER.RnToRm.Approx.DomTransl
-- | Datatype translating enclosures from [-1,1]^n to any compact
-- interval in R^n with non-empty interior using a bunch of
-- linear maps, one for each dimension.
data ERFnDomTranslApprox dtrbox varid ufa ira
ERFnDomTranslApprox :: ufa -> dtrbox -> ERFnDomTranslApprox dtrbox varid ufa ira
erfnUnitApprox :: ERFnDomTranslApprox dtrbox varid ufa ira -> ufa
erfnDomTransl :: ERFnDomTranslApprox dtrbox varid ufa ira -> dtrbox
-- | The canonical translation of any compact non-empty and non-singleton
-- interval in R to and from the unit interval [-1,1].
--
-- This structure holds the two coefficients for both linear mappings.
data DomTransl ira
DomTransl :: ira -> ira -> ira -> ira -> ira -> DomTransl ira
-- | the interval being mapped
dtrDom :: DomTransl ira -> ira
dtrFromUnitSlope :: DomTransl ira -> ira
dtrFromUnitConst :: DomTransl ira -> ira
dtrToUnitSlope :: DomTransl ira -> ira
dtrToUnitConst :: DomTransl ira -> ira
instance Typeable1 DomTransl
instance Typeable4 ERFnDomTranslApprox
instance (Data ira) => Data (DomTransl ira)
instance (Data dtrbox, Data varid, Data ufa, Data ira) => Data (ERFnDomTranslApprox dtrbox varid ufa ira)
instance (ERUnitFnApprox box varid domra ranra ufa, DomainIntBox box varid domra, DomainBoxMappable dtrbox box varid (DomTransl domra) domra, DomainBoxMappable box dtrbox varid domra (DomTransl domra), Eq dtrbox) => ERFnDomApprox box varid domra ranra (ERFnDomTranslApprox dtrbox varid ufa domra)
instance (ERUnitFnApprox box varid domra ranra ufa, DomainIntBox box varid domra, DomainBoxMappable dtrbox box varid (DomTransl domra) domra, DomainBoxMappable box dtrbox varid domra (DomTransl domra), Eq dtrbox) => ERFnApprox box varid domra ranra (ERFnDomTranslApprox dtrbox varid ufa domra)
instance (ERUnitFnApprox box varid domra ranra ufa, ERApproxElementary ufa, DomainBoxMappable dtrbox box varid (DomTransl domra) domra, Eq dtrbox) => ERApproxElementary (ERFnDomTranslApprox dtrbox varid ufa domra)
instance (ERUnitFnApprox box varid domra ranra ufa, ERIntApprox ufa, DomainBoxMappable dtrbox box varid (DomTransl domra) domra, Eq dtrbox) => ERIntApprox (ERFnDomTranslApprox dtrbox varid ufa domra)
instance (ERUnitFnApprox box varid domra ranra ufa, DomainBoxMappable dtrbox box varid (DomTransl domra) domra, Eq dtrbox) => ERApprox (ERFnDomTranslApprox dtrbox varid ufa domra)
instance (ERUnitFnApprox box varid domra ranra ufa, DomainBoxMappable dtrbox box varid (DomTransl domra) domra, Eq dtrbox) => Fractional (ERFnDomTranslApprox dtrbox varid ufa domra)
instance (ERUnitFnApprox box varid domra ranra ufa, DomainBoxMappable dtrbox box varid (DomTransl domra) domra, Eq dtrbox) => Num (ERFnDomTranslApprox dtrbox varid ufa domra)
instance (ERUnitFnApprox box varid domra ranra ufa, Ord ufa, Eq dtrbox) => Ord (ERFnDomTranslApprox dtrbox varid ufa domra)
instance (ERUnitFnApprox box varid domra ranra ufa, Eq dtrbox) => Eq (ERFnDomTranslApprox dtrbox varid ufa domra)
instance (ERUnitFnApprox box varid domra ranra ufa, DomainBoxMappable dtrbox box varid (DomTransl domra) domra) => Show (ERFnDomTranslApprox dtrbox varid ufa domra)
instance (ERIntApprox domra) => Show (DomTransl domra)
instance (ERIntApprox domra) => Eq (DomTransl domra)
instance (Binary a) => Binary (DomTransl a)
instance (Binary a, Binary b, Binary c, Binary d) => Binary (ERFnDomTranslApprox a b c d)
module Data.Number.ER.RnToRm.Approx.DomEdges
-- | Use some function approximation type and for each domain box keep a
-- structure of function approximations of this type indexed by the
-- hyper-edge structure. For each hyper-edge of the domain, the
-- approximation has this edge as its domain.
--
-- E.g. for a 2D square domain there are:
--
--
-- - one approximation for the whole square
-- - four 1D approximations, one for each edge
-- - eight 0D approximations, one for each endpoint of each edge
--
data ERFnDomEdgesApprox varid fa
ERFnDomEdgesApprox :: fa -> Map (varid, PlusMinus) (ERFnDomEdgesApprox varid fa) -> ERFnDomEdgesApprox varid fa
erfnMainVolume :: ERFnDomEdgesApprox varid fa -> fa
erfnEdges :: ERFnDomEdgesApprox varid fa -> Map (varid, PlusMinus) (ERFnDomEdgesApprox varid fa)
instance Typeable2 ERFnDomEdgesApprox
instance (Data varid, Data fa, Ord varid) => Data (ERFnDomEdgesApprox varid fa)
instance (ERFnDomApprox box varid domra ranra fa, VariableID varid) => ERFnDomApprox box varid domra ranra (ERFnDomEdgesApprox varid fa)
instance (ERFnDomApprox box varid domra ranra fa, VariableID varid) => ERFnApprox box varid domra ranra (ERFnDomEdgesApprox varid fa)
instance (ERFnDomApprox box varid domra ranra fa, ERApproxElementary fa, VariableID varid) => ERApproxElementary (ERFnDomEdgesApprox varid fa)
instance (ERFnDomApprox box varid domra ranra fa, ERIntApprox fa, VariableID varid) => ERIntApprox (ERFnDomEdgesApprox varid fa)
instance (ERFnDomApprox box varid domra ranra fa, VariableID varid) => ERApprox (ERFnDomEdgesApprox varid fa)
instance (ERFnDomApprox box varid domra ranra fa, VariableID varid) => Fractional (ERFnDomEdgesApprox varid fa)
instance (ERFnDomApprox box varid domra ranra fa, VariableID varid) => Num (ERFnDomEdgesApprox varid fa)
instance (ERFnApprox box varid domra ranra fa, Ord fa) => Ord (ERFnDomEdgesApprox varid fa)
instance (ERFnApprox box varid domra ranra fa) => Eq (ERFnDomEdgesApprox varid fa)
instance (ERFnDomApprox box varid domra ranra fa, Ord varid, VariableID varid) => Show (ERFnDomEdgesApprox varid fa)
instance (Ord a, Binary a, Binary b) => Binary (ERFnDomEdgesApprox a b)
-- | Lists of function approximations over the same domain.
module Data.Number.ER.RnToRm.Approx.Tuple
-- | A tuple of function approximations allowing one to get from functions
-- R^n->R to a function R^n -> R^m.
data ERFnTuple fa
ERFnTuple :: [fa] -> ERFnTuple fa
erfnTuple :: ERFnTuple fa -> [fa]
instance Typeable1 ERFnTuple
instance (Data fa) => Data (ERFnTuple fa)
instance (ERFnDomApprox box varid domra ranra fa) => ERFnDomApprox box varid domra ranra (ERFnTuple fa)
instance (ERFnDomApprox box varid domra ranra fa) => ERFnApprox box varid domra ranra (ERFnTuple fa)
instance (ERFnDomApprox box varid domra ranra fa, ERApproxElementary fa) => ERApproxElementary (ERFnTuple fa)
instance (ERFnDomApprox box varid domra ranra fa, ERIntApprox fa) => ERIntApprox (ERFnTuple fa)
instance (ERFnDomApprox box varid domra ranra fa) => ERApprox (ERFnTuple fa)
instance (ERFnDomApprox box varid domra ranra fa) => Fractional (ERFnTuple fa)
instance (ERFnDomApprox box varid domra ranra fa) => Num (ERFnTuple fa)
instance (ERFnApprox box varid domra ranra fa, Ord fa) => Ord (ERFnTuple fa)
instance (ERFnApprox box varid domra ranra fa) => Eq (ERFnTuple fa)
instance (ERFnDomApprox box varid domra ranra fa) => Show (ERFnTuple fa)
instance (Binary a) => Binary (ERFnTuple a)
-- | Arbitrary precision piece-wise something (eg linear, polynomial,
-- rational) enclosures of functions R^n->R^m.
--
-- The type of approximation within segments is specified by an instance
-- of ERFnDomApprox.
--
-- The piece-wise construction defines another instance of
-- ERFnDomApprox.
module Data.Number.ER.RnToRm.Approx.PieceWise
-- | Arbitrary precision piece-wise something (eg linear, polynomial,
-- rational) enclosures of functions R^n->R^m.
--
-- The type of approximation within segments is specified by an instance
-- of ERFnDomApprox.
--
-- The piece-wise construction defines another instance of
-- ERFnDomApprox.
data ERFnPiecewise box varid domra fa
ERFnPiecewise :: (BisectionTree box varid domra fa) -> ERFnPiecewise box varid domra fa
instance Typeable4 ERFnPiecewise
instance (Data box, Data varid, Data domra, Data fa) => Data (ERFnPiecewise box varid domra fa)
instance (ERFnDomApprox box varid domra ranra fa, ERIntApprox fa, Show box, DomainBoxMappable box box varid domra domra) => ERFnDomApprox box varid domra ranra (ERFnPiecewise box varid domra fa)
instance (ERFnDomApprox box varid domra ranra fa, ERIntApprox fa, DomainBoxMappable box box varid domra domra, Show box) => ERFnApprox box varid domra ranra (ERFnPiecewise box varid domra fa)
instance (ERFnDomApprox box varid domra ranra fa, ERApproxElementary fa, VariableID varid) => ERApproxElementary (ERFnPiecewise box varid domra fa)
instance (ERFnDomApprox box varid domra ranra fa, ERIntApprox fa, VariableID varid) => ERIntApprox (ERFnPiecewise box varid domra fa)
instance (ERFnDomApprox box varid domra ranra fa, VariableID varid) => ERApprox (ERFnPiecewise box varid domra fa)
instance (ERFnDomApprox box varid domra ranra fa, VariableID varid) => Fractional (ERFnPiecewise box varid domra fa)
instance (ERFnDomApprox box varid domra ranra fa, VariableID varid) => Num (ERFnPiecewise box varid domra fa)
instance (ERFnDomApprox box varid domra ranra fa) => Ord (ERFnPiecewise box varid domra fa)
instance (ERFnDomApprox box varid domra ranra fa) => Eq (ERFnPiecewise box varid domra fa)
instance (ERFnDomApprox box varid domra ranra fa, VariableID varid) => Show (ERFnPiecewise box varid domra fa)
instance (Binary a, Binary b, Binary c, Binary d) => Binary (ERFnPiecewise a b c d)
-- | Utilities for addressing and modifying leaves of binary bisection
-- trees.
module Data.Number.ER.RnToRm.BisectionTree.Path
-- | A path in a binary tree. It is used mainly in connection with
-- BisectionTree.BisectionTree.
data BisecTreePath
BTP_H :: BisecTreePath
BTP_R :: BisecTreePath -> BisecTreePath
BTP_L :: BisecTreePath -> BisecTreePath
-- | Assuming that bisection happens at default points as defined by
-- bisectDomain and starts from the given root interval.
path2dom :: (ERIntApprox ira) => ira -> BisecTreePath -> ira
-- | A representation of a binary tree with a hole that can be efficiently
-- filled.
data FnZipper f
FnZ_H :: f -> FnZipper f
FnZ_L :: (FnZipper f) -> f -> FnZipper f
FnZ_R :: f -> (FnZipper f) -> FnZipper f
-- | Lookup a subdomain of a function according to a bisection path. Return
-- the restrited function as well as a zipper that allows an efficient
-- modification of the function on the looked up subdomain.
lookupSubdomain :: (ERFnDomApprox box varid domra ranra fa) => fa -> BisecTreePath -> (fa, FnZipper fa)
-- | Modify a function in its subdomain as expressed by the zipper.
updateFnZ :: (ERFnDomApprox box varid domra ranra fa) => (FnZipper fa) -> fa -> fa
instance Typeable BisecTreePath
instance Eq BisecTreePath
instance Data BisecTreePath
instance Read BisecTreePath
instance Show BisecTreePath
instance Binary BisecTreePath
-- | This module supplies default instances for the real number and
-- function classes described in Data.Number.ER.RnToRm.
--
-- These classes form loosely coupled boundaries between abstraction
-- layers. Nevertheless, we usually have particular implementations in
-- mind, as shown here.
--
-- To preserve the intended loose coupling, please use these definitions
-- only in functions that cannot infer from their input or output data
-- which type of function enclosures they should use. Eg a function to
-- add 1 to an enclosure should have the type:
--
--
-- add1 :: (ERFnApprox box varid domra ranra fa) => fa -> fa
-- add1 f = f + 1
--
--
-- and not: add1 :: FAPWP -> FAPWP
module Data.Number.ER.RnToRm.DefaultRepr
type FAPU = ERFnInterval (ERChebPoly (Box Int) B) IRA
type FAPD = ERFnDomTranslApprox (Box (DomTransl IRA)) VarID FAPU IRA
type FAPT = ERFnTuple FAPD
type FAPE = ERFnDomEdgesApprox VarID FAPT
type FAPWP = ERFnPiecewise (Box IRA) VarID IRA FAPE
type FA = FAPWP
-- | A few definitions useful for testing the enclosures code, eg in ghci.
module Data.Number.ER.RnToRm.TestingDefs
-- | This module bundles some of the most important functionality of the
-- AERN-RnToRm package. It is intended to be imported *qualified*.
--
-- AERN-RnToRm provides datatypes and abstractions for approximating
-- functions of type D -> R^m where D is a bounded
-- interval in R^n with non-empty interior.
--
-- Abstractions are provided via 4 type classes:
--
--
-- - ERUnitFnBase: generalises polynomials with floating point
-- coefficients. (Not exported here, used only internally.)
-- - ERFnApprox: generalises functions enclosures on a certain
-- unspecified domain.
-- - ERUnitFnApprox (extends ERFnApprox): generalises
-- function graph enclosures on the domain [-1,1]^n. (Not
-- exported here, used only internally.)
-- - ERFnDomApprox (extends ERFnApprox): generalises
-- function enclosures over a specified and queriable domain box
-- (instance of class DomainBox).
--
--
-- At all levels, all field operations are supported as well as some
-- elementary operations, namely exp, sin and cos. Log and sqrt are
-- planned to be added soon.
--
-- Implementations of ERUnitFnBase:
--
--
--
-- By using the Chebyshev basis on domain [-1,1]^n, we gain
-- simple and optimally rounding degree reduction as well as relatively
-- simple handling of rounding in other operations.
--
-- Implementations of ERUnitFnApprox:
--
--
--
-- Implementations of ERFnDomApprox:
--
--
-- - ERFnDomTranslApprox: builds a basic implementation using an
-- instance of ERUnitFnApprox.
-- - ERFnTuple: extends another implementation of
-- ERFnDomApprox to work with lists of functions
-- simultaneously.
-- - ERFnDomEdgesApprox: separately enclose a function on its
-- domain box as well as on all the domain's hyper-edges (including the
-- corners) using another implementation of ERFnDomApprox.
-- - ERFnPiecewise: allows the domain box to be bisected to an
-- arbitrary finite depth and uses another implementation of
-- ERFnDomApprox to approximate the function on each segment.
--
module Data.Number.ER.RnToRm