11.07.2015 Views

Advanced Programming Guide

Advanced Programming Guide

Advanced Programming Guide

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

A.3 The Use of Hashing in Maple • 371Maple Language Arrays and TablesTables and arrays are provided as data types in the Maple language viathe table and array functions. An array is a table for which the componentindices must be integers lying within specified bounds. Tables andarrays are implemented using Maple’s internal hash tables. Because ofthis, sparse arrays are equally as efficient as dense arrays. A table objectconsists of the following:1. Index bounds (for arrays only)2. A hash table of components3. An indexing functionThe components of a table T are accessed using a subscript syntax (forexample, T[a,b*cos(x)]). Since a simplified expression is guaranteed tohave a unique instance in memory, the address of the simplified index isused as the hash key for a component. If no component exists for a givenindex, then the indexed expression is returned.The semantics of indexing into a table are described by its indexingfunction. Aside from the default, general indexing, some indexing functionsare provided by the Maple kernel. Other indexing functions areloaded from the library or are supplied by the user.Maple Language Rectangular TablesRectangular tables (as implemented by the RTABLE structure), can use avariety of storage formats. One format, Maple-sparse, is identical to thatused in tables and arrays, namely a hash table. There is another sparseformat, NAG-sparse, which uses one vector for each dimension to recordindices, and a third vector to record the values of the entries. The majorityof RTABLE storage formats are dense, the simplest being the rectangular.Other dense formats include upper-triangular and band, where storage isallocated only for the upper triangle or a band of elements respectively. Tothe user, rectangular tables manifest themselves as objects of type Array,Matrix, Vector[row], and Vector[column]. Note that an Array is notthe same thing as an array. For defintions, see the ?Array and ?arrayhelp pages.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!