From: Michael Orlitzky Date: Wed, 11 May 2011 19:18:22 +0000 (-0400) Subject: Move the three example 3x3x3 arrays to the Examples module. X-Git-Tag: 0.0.1~295 X-Git-Url: http://gitweb.michael.orlitzky.com/?p=spline3.git;a=commitdiff_plain;h=ec2c118022bc46a191ebc323f6be17d4f017fcfb Move the three example 3x3x3 arrays to the Examples module. --- diff --git a/src/Examples.hs b/src/Examples.hs new file mode 100644 index 0000000..8dc59cf --- /dev/null +++ b/src/Examples.hs @@ -0,0 +1,47 @@ +module Examples +where + +-- | Values of the function f(x,y,z) = 1 + x + xy + xyz taken at nine +-- points (hi, hj, jk) with h = 1. From example one in the paper. +-- Used in the next bunch of tests. +trilinear :: [[[Double]]] +trilinear = [ [ [ 1, 2, 3 ], + [ 1, 3, 5 ], + [ 1, 4, 7 ] ], + [ [ 1, 2, 3 ], + [ 1, 4, 7 ], + [ 1, 6, 11 ] ], + [ [ 1, 2, 3 ], + [ 1, 5, 9 ], + [ 1, 8, 15 ]]] + + +-- | A 3x3x3 array of zeros. +zeros :: [[[Double]]] +zeros = [ [ [ 0, 0, 0 ], + [ 0, 0, 0 ], + [ 0, 0, 0 ] ], + + [ [ 0, 0, 0 ], + [ 0, 0, 0 ], + [ 0, 0, 0 ] ], + + [ [ 0, 0, 0 ], + [ 0, 0, 0 ], + [ 0, 0, 0 ]]] + + +-- | A 3x3x3 array of numbers, starting at (0,0,0) == 0 and counting +-- up to (2,2,2) == 26 in x,y,z order. +naturals :: [[[Double]]] +naturals = [ [ [ 0, 1, 2 ], + [ 3, 4, 5 ], + [ 6, 7, 8 ] ], + + [ [ 9, 10, 11 ], + [ 12, 13, 14 ], + [ 15, 16, 17 ] ], + + [ [ 18, 19, 20 ], + [ 21, 22, 23 ], + [ 24, 25, 26 ]]] diff --git a/src/Main.hs b/src/Main.hs index 9ad6199..a2d6b1f 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -10,42 +10,6 @@ where --import Tetrahedron --import ThreeDimensional -trilinear :: [[[Double]]] -trilinear = [ [ [ 1, 2, 3 ], - [ 1, 3, 5 ], - [ 1, 4, 7 ] ], - [ [ 1, 2, 3 ], - [ 1, 4, 7 ], - [ 1, 6, 11 ] ], - [ [ 1, 2, 3 ], - [ 1, 5, 9 ], - [ 1, 8, 15 ]]] - -zeros :: [[[Double]]] -zeros = [ [ [ 0, 0, 0 ], - [ 0, 0, 0 ], - [ 0, 0, 0 ] ], - -- - [ [ 0, 0, 0 ], - [ 0, 0, 0 ], - [ 0, 0, 0 ] ], - -- - [ [ 0, 0, 0 ], - [ 0, 0, 0 ], - [ 0, 0, 0 ]]] - -dummy :: [[[Double]]] -dummy = [ [ [ 0, 1, 2 ], - [ 3, 4, 5 ], - [ 6, 7, 8 ] ], - -- - [ [ 9, 10, 11 ], - [ 12, 13, 14 ], - [ 15, 16, 17 ] ], - -- - [ [ 18, 19, 20 ], - [ 21, 22, 23 ], - [ 24, 25, 26 ]]] --find_point_value :: RealFunction Point diff --git a/src/Tests/Grid.hs b/src/Tests/Grid.hs index 6fdbb13..fbe8bc1 100644 --- a/src/Tests/Grid.hs +++ b/src/Tests/Grid.hs @@ -7,6 +7,7 @@ import Test.QuickCheck import Assertions import Cube +import Examples import Grid import Tetrahedron @@ -18,20 +19,6 @@ instance Arbitrary Grid where return (make_grid h' fvs) --- | Values of the function f(x,y,z) = 1 + x + xy + xyz taken at nine --- points (hi, hj, jk) with h = 1. From example one in the paper. --- Used in the next bunch of tests. -trilinear :: [[[Double]]] -trilinear = [ [ [ 1, 2, 3 ], - [ 1, 3, 5 ], - [ 1, 4, 7 ] ], - [ [ 1, 2, 3 ], - [ 1, 4, 7 ], - [ 1, 6, 11 ] ], - [ [ 1, 2, 3 ], - [ 1, 5, 9 ], - [ 1, 8, 15 ]]] - -- | Check the value of c0030 for tetrahedron0 belonging to the -- cube centered on (1,1,1) with a grid constructed from the -- trilinear values. See example one in the paper.