From 7951cc330abe7383612799b53f39067229bba0d1 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sun, 4 Sep 2011 08:22:53 -0400 Subject: [PATCH] Add the PolynomialArray module. --- src/PolynomialArray.hs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/PolynomialArray.hs 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) ) -- 2.43.2