Multidimensional Array Toolbox for Octave (Beta version 0.5, 19 Aug 2003) by Ronald Kumon ************************************************************* WARNING: These scripts are in beta form. I believe that they work properly, but you use them at your own risk. The author takes no responsibility for the results of these scripts. No support is available. ************************************************************* Description: The scripts in this directory provide some basic tools for creating and manipulating the equivalent of multidimensional arrays in Octave (at the time of this writing such arrays are not natively implemented). With these scripts the multidimensional arrays are implemented internally in Octave as structures. The arrays (even two-dimensional arrays) cannot be used with Octave's native matrices. There are, however, scripts in the toolbox to convert between matrices and arrays. The dimension of the arrays is not inherently limited, although performance will likely be very slow for many dimensions. Array structures: Each array structure consists of a scalar with the number of dimensions (ndim), a vector with the number of elements in each dimension (dims), and then a vector containing all the elements (elems). The various scripts which manipulate the arrays figure out how to access and display the elements in a somewhat intuitive way. Octave version: These scripts have been tested on Octave 2.0.*. I do not know about their behavior on other versions. Licensing: GNU Public License (GPL) Installation: The files in the compressed archive "array.tar.gz" should be unpacked to a directory which is somewhere on your Octave path. Documentation: Please see the files themselves for documentation. If properly installed, a basic description of each file is available by using Octave's "help" function along with the name of the script. Basic Testing: There are a couple of test scripts which give some idea about how some of the scripts work. testdefmat.m: Defines some arrays testcontr.m : Tests some array contractions More Examples: The subdirectory "elasticity" has some scripts which show how the arrays could be used to implement some basic calculations in the theory of linear elasticity. Needed improvements: 1. Better documentation. 2. More error-checking. 3. More efficient implementation, perhaps with special functions for three-dimensional arrays. 4. Ability to interact more easily with Octave's matrices. 5. More testing for correctness and robustness. MATLAB compatibility: None, really, because MATLAB has multidimensional arrays built in. However, I tried to make the behavior of these scripts similar to MATLAB where I thought it was sensible to do so. Summary of scripts: arr2mat.m : Convert array (2D or less) to matrix arradd.m : Add two arrays arrassg.m : Assigns elements to an array arrcompare.m : Compare arrays arrcontr.m : Contract arrays over specified index ranges arrcoord2index.m : Converts matrix coordinates to array indices arrdef.m : Defines array structure arrdim.m : Gives array dimension arrdirprod.m : Computes array direct product arrdisplay.m : Displays array arrelemassg.m : Assigns individual element to array location arrelemval.m : Provides individual value of array location arrforloops.m : Generates nested for loops arrindex2coord.m : Converts array indices to matrix coordinates arrindexorderdec.m: Generates matrix with decimal elements corresponding to index values (for testing) arrindexorder.m : Generates matrix with array coordinates (for testing) arrindexperm.m : Permutes array elements in specified manner arrkronecker.m : Generates 2D array for Kronecker delta arrlevicivita3.m : Generates 3D array for Levi-Civita symbol arrscalmult.m : Multiplies array by scalar multiple arrsize.m : Provides array size arrsubarr.m : Extracts subarray from specified locations arrsubarrmatrix.m : An alternative way to extract subarrays arrsubarrranges.m : An alternative way to extract subarrays arrsubassg.m : Assigns subarray to larger array arrtrace.m : Computes trace of tensor arrtranspose.m : Generates transpose of 2D array arrval.m : Converts array structure to column vector is_tensor.m : Tests array to see if it is a tensor (or at least that all dimensions have same number of indices) mat2arr.m : Convert matrix to 2D array