J3/04-253 To: J3 From: Craig Dedo Date: February 16, 2004 Subject: Row Major Arrays Number: Title: Row Major Arrays Submitted By: Craig Dedo Status: For Consideration References: Basic Functionality: The new Fortran standard should provide support for defining arrays as row-major as well as the current column-major approach. With this attribute, an array would have the last dimension vary most frequently rather than having the first dimension vary most frequently. Rationale: Most other languages use row-major array storage. If a Fortran program needs to pass an array to a routine written in another language, there are usually serious problems due to differing storage arrangements. In addition, row-major storage is usually a much more intuitive and natural method of arranging elements in the minds of most people, at least in the important two-dimensional case. The first index represents the primary (or most important) division, the second index represents the next most important, etc. Except for matrices, I doubt that the efficiency of most programs would be affected. Estimated Impact: This requirement has no impact on existing Fortran code. Column-major arrays would still be supported. There would be little impact on existing column-major arrays. The committee would need to define what the result of operations would be if operations combined row-major and column-major arrays. Implementing this feature should only involve a minor cost to implementors since row-major storage is used in most other languages, hence the technology is well understood. Detailed Specification: This could be done by defining a ROW_MAJOR keyword which would declare an array to have row-major storage allocation. History: