hafar-0.1.1.0: Affine arithmetic library for Haskell

Safe HaskellNone
LanguageHaskell2010

Numeric.AffineForm.Subdivision

Description

Subdivision contains an implementation of the branch-and-bound algorithm. This method divides interval-like values into smaller subdivisions and then applies a function to those values. This results in a more accurate output at the cost of having to repeat the calculations multiple times

Synopsis

Documentation

class Subdivisible a where Source #

The Subdivisible class is used for datatypes that can be broken down into smaller pieces and combined together

The subdivide function subdivides the value into n smaller values and combine joins the subdivisions together into a bigger value

Subdividing and then combining a value is expected to give the initial value (sans rounding errors)

Minimal complete definition

subdivide

Methods

subdivide :: a -> Int -> [a] Source #

combine2 :: a -> a -> a Source #

combine :: [a] -> a Source #

Instances
Subdivisible a => Subdivisible [a] Source # 
Instance details

Defined in Numeric.AffineForm.Subdivision

Methods

subdivide :: [a] -> Int -> [[a]] Source #

combine2 :: [a] -> [a] -> [a] Source #

combine :: [[a]] -> [a] Source #

(Ord a, Fractional a) => Subdivisible (Interval a) Source # 
Instance details

Defined in Numeric.AffineForm.Subdivision

(Ord a, Fractional a, ExplicitRounding a) => Subdivisible (AF s a) Source # 
Instance details

Defined in Numeric.AffineForm.Internal

Methods

subdivide :: AF s a -> Int -> [AF s a] Source #

combine2 :: AF s a -> AF s a -> AF s a Source #

combine :: [AF s a] -> AF s a Source #

data SubdivisionEnvironment a b e Source #

A data structure for configuring the branchAndBound method

function is the function that gets evaluated errorFun is the error measuring function of the result maxError specifies the maximum permitted error of an evaluation maxDepth specifies how deep the subdivision can go subdivs specifies the number of subdivisions per value

Constructors

SubdivisionEnvironment 

Fields

defaultEnvironment :: Fractional e => (a -> b) -> (b -> e) -> SubdivisionEnvironment a b e Source #

This function creates a simple subdivision configuration. It requires the evaluator function and an error measuring function as its parameters.

branchAndBound :: (Subdivisible a, Subdivisible b, Ord e) => a -> SubdivisionEnvironment a b e -> b Source #

This function iteratively subdivides a value to arrive at a more accurate result