INTERFACE SPFunction; (* General functions on the sphere *) IMPORT Wr, LR3; TYPE T = OBJECT METHODS eval(READONLY p: Point): LONGREAL; grad(READONLY p: Point): Gradient; slap(READONLY p: Point): LONGREAL; toMaple(wr: Wr.T); END; TYPE LONG = LONGREAL; LONGS = ARRAY OF LONGREAL; Point = LR3.T; (* A point on the unit sphere *) Points = ARRAY OF Point; Gradient = LR3.T; (* A vector tangent to the unit sphere. *) Basis = ARRAY OF T; PROCEDURE SamplePoints(N: CARDINAL): REF Points; (* Generates N points, roughly uniformly distributed on the sphere. *) PROCEDURE Sample(f: T; READONLY p: Points): REF LONGS; (* Evaluates "f" at each point of "p", returns the results. *) PROCEDURE DotProduct( f, g: T; depth: CARDINAL; ): LONGREAL; (* Computes the dot product of "f" and "g", that is the integral of "f*g" over the whole sphere, using "(order+1)*(order+2)/2" points over each octant. *) PROCEDURE CustomDotProduct( f, g: T; READONLY p: Points; ): LONG; (* Computes the dot product of "f" and "g", defined as "(A/N)*SUM(f(p[k])*g(p[k]))", "N = NUMBER(p)", "A" is the area of the sphere, and the "p[k]" is a client-specified set of sample points on the sphere. *) END SPFunction.