This shows you the differences between two versions of the page.
calculator [2017/04/19 13:31] |
calculator [2017/04/19 13:31] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | =====Polyhedral Calculator===== | ||
+ | This page provides examples of how to use the calculator feature in the AlphaZ system. | ||
+ | The calculator is simply an interface to the underlying polyhedral libraries. | ||
+ | There are a number of commands available in the script interface with prefix " | ||
+ | (Eclipse has a very good context-sensitive assist feature; the default key binding is ctrl+space) | ||
+ | |||
+ | The calculator manipulates Domain and AffineFunction objects that are created by the following commands. | ||
+ | ===ReadDomain=== | ||
+ | Parses a domain in alphabets syntax and returns a Domain object. | ||
+ | <sxh cs; gutter: | ||
+ | dom = calc_ReadDomain(" | ||
+ | </ | ||
+ | ===ReadFunction=== | ||
+ | Parses an affine function in alphabets syntax and returns a AffineFunction object. | ||
+ | <sxh cs; gutter: | ||
+ | func = calc_ReadFunction(" | ||
+ | </ | ||
+ | ===echo=== | ||
+ | These objects (and any other objects) can be printed out to the console by the echo command. | ||
+ | <sxh cs; gutter: | ||
+ | dom = calc_ReadDomain(" | ||
+ | echo(dom); | ||
+ | </ | ||
+ | ====Domain Operations==== | ||
+ | ===Intersection=== | ||
+ | Returns the intersection of two domains. | ||
+ | <sxh cs; gutter: | ||
+ | domA = calc_ReadDomain(" | ||
+ | domB = calc_ReadDomain(" | ||
+ | echo(calc_Intersection(domA, | ||
+ | </ | ||
+ | ===Union=== | ||
+ | Returns the union of two domains. | ||
+ | <sxh cs; gutter: | ||
+ | domA = calc_ReadDomain(" | ||
+ | domB = calc_ReadDomain(" | ||
+ | echo(calc_Union(domA, | ||
+ | </ | ||
+ | ===Image=== | ||
+ | Returns the image of a domain by an affine function. | ||
+ | <sxh cs; gutter: | ||
+ | dom = calc_ReadDomain(" | ||
+ | fun = calc_ReadFunction(" | ||
+ | echo(calc_Image(fun, | ||
+ | </ | ||
+ | ===PreImage=== | ||
+ | Returns the pre-image of a domain by an affine function. | ||
+ | <sxh cs; gutter: | ||
+ | dom = calc_ReadDomain(" | ||
+ | fun = calc_ReadFunction(" | ||
+ | echo(calc_PreImage(fun, | ||
+ | </ | ||
+ | ===Difference=== | ||
+ | Returns the difference of two domains. | ||
+ | <sxh cs; gutter: | ||
+ | domA = calc_ReadDomain(" | ||
+ | domB = calc_ReadDomain(" | ||
+ | echo(calc_Difference(domA, | ||
+ | </ | ||
+ | ===IsEmpty=== | ||
+ | Returns true if the given domain is empty. | ||
+ | <sxh cs; gutter: | ||
+ | dom = calc_ReadDomain(" | ||
+ | echo(calc_IsEmpty(dom)); | ||
+ | </ | ||
+ | ===IsEquivalent=== | ||
+ | Returns true if the given domains are equivalent. | ||
+ | <sxh cs; gutter: | ||
+ | dom = calc_ReadDomain(" | ||
+ | fun = calc_ReadFunction(" | ||
+ | domI = calc_Image(fun, | ||
+ | domIPI = calc_PreImage(fun, | ||
+ | echo(calc_IsEquivalent(dom, | ||
+ | </ | ||
+ | |||
+ | ====Function Operations==== | ||
+ | ===Compose=== | ||
+ | Returns f = f1 o f2. | ||
+ | f(z) = f1(f2(z)). | ||
+ | <sxh cs; gutter: | ||
+ | f1 = calc_ReadFunction(" | ||
+ | f2 = calc_ReadFunction(" | ||
+ | echo(calc_Compose(f1, | ||
+ | </ | ||
+ | ===Inverse=== | ||
+ | Returns the inverse of an affine function if it exists. | ||
+ | <sxh cs; gutter: | ||
+ | f = calc_ReadFunction(" | ||
+ | echo(calc_Inverse(f)); | ||
+ | </ | ||
+ | ===InverseInContext=== | ||
+ | Returns the inverse of an affine function in the context of a given domain if it exists. | ||
+ | <sxh cs; gutter: | ||
+ | f = calc_ReadFunction(" | ||
+ | context = calc_ReadDomain(" | ||
+ | echo(calc_InverseInContext(context, | ||
+ | </ | ||
+ | ===IsEquivalent=== | ||
+ | Returns true if the given functions are equivalent. | ||
+ | <sxh cs; gutter: | ||
+ | f1 = calc_ReadFunction(" | ||
+ | f2 = calc_ReadFunction(" | ||
+ | echo(calc_IsEquivalent(calc_Compose(f1, | ||
+ | </ | ||
+ | |||