Abstract

This paper discusses some of the pros and cons of extending functional languages by high-level array operations similar to those that are available in APL. This extension is based on the lp~calculus, an algebra of arrays which provides a small set of essential array operations defined in terms of dimensionalities, shapes and indexing functions. Since these operations specify context-free substitutions of array expressions by others, the lpcalculus fits perfectly into a functional programming paradigm.

In order to demonstrate the programming techniques made possible by the lp-calculus, we study a functional program for the approximation of numerical solutions of partial differential equations by multigrid relaxation. This application is not only of practical relevance but also fully exposes the flavors of using high-level array operations. In contrast to an equivalent imperative program, the functional program is well structured, reasonably concise, and - what is most important - invariant against dimensionalities and shapes. However, some problems arise with the correct treatment of boundary conditions and with the mapping of arrays of different shapes into each other, which require rather unusual programming techniques. Moreover, sophisticated compilation (reduction) techniques are necessary to avoid, whenever possible, the creation of temporary arrays and to eliminate redundant operations.

Department(s)

Computer Science

Report Number

CSc-94-28

Document Type

Technical Report

Document Version

Final Version

File Type

text

Language(s)

English

Rights

© 1994 University of Missouri - Rolla, All rights reserved

Publication Date

1 January, 1995

Share

 
COinS