From: Michael Orlitzky Date: Sun, 4 Sep 2011 12:22:53 +0000 (-0400) Subject: Add the PolynomialArray module. X-Git-Tag: 0.0.1~165 X-Git-Url: http://gitweb.michael.orlitzky.com/?p=spline3.git;a=commitdiff_plain;h=7951cc330abe7383612799b53f39067229bba0d1 Add the PolynomialArray module. --- diff --git a/src/PolynomialArray.hs b/src/PolynomialArray.hs new file mode 100644 index 0000000..2cf96dd --- /dev/null +++ b/src/PolynomialArray.hs @@ -0,0 +1,26 @@ +-- | The PolynomialArray module contains one type, 'PolynomialArray', +-- and a smart constructor for it. The array is essentially a hash; +-- the unique keys can be thought of as a cube/tetrahedron pair, and +-- the associated value is the polynomial function over that +-- tetrahedron. Rather than define 'Ord' instances and a proper map, +-- we just use the indices i,j,k along with the tetrahedron number +-- as the keys. +module PolynomialArray ( + PolynomialArray, + make_polynomial_array + ) +where + +import RealFunction(RealFunction) +import Point (Point) + +import Data.Array (Array, array) + +type PolynomialArray = + Array (Int,Int,Int,Int) (RealFunction Point) + +make_polynomial_array :: (Int, Int, Int, Int) -> + [( (Int,Int,Int,Int), (RealFunction Point) )] -> + PolynomialArray +make_polynomial_array (max_i, max_j, max_k, max_tetrahedron_number) = + array ( (0,0,0,0), (max_i,max_j,max_k, max_tetrahedron_number) )