Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Essential Math Module User's Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

3.12 Data Storage Schemes

The existence of the subscripting operators generally makes the storage scheme used by the vector, matrix, and array classes completely transparent to the user. In fact, one of the great benefits of object-oriented programming is that such an implementation detail can be completely hidden without any loss of performance or functionality. There area a few cases, however, where knowing how the data is organized in the data block is useful:

There are two conventional methods of organizing multidimensional arrays in memory: row major order, as used by C and C++ array types; and column major order, which is used by Fortran. Rather than decide between these two alternatives, we chose a storage scheme flexible enough to accommodate both. The appropriate matrix and array constructors and member functions have an optional final argument of type RWDataView::Storage. This type is an enum with two possible values: ROW_MAJOR and COLUMN_MAJOR. By setting this variable, you can control how the matrix or array is stored. The default setting is always COLUMN_MAJOR. Here's an example of how you can use this feature to construct an RWGenMat<double> from a regular C++ array of doubles:

The ROW_MAJOR parameter in the constructor specifies that the new matrix be stored in row major order, and that the data be interpreted as row major data.

Here's an example of passing a matrix to a C function:



Previous fileTop of DocumentContentsNo linkNext file

Copyright © Rogue Wave Software, Inc. All Rights Reserved.

The Rogue Wave name and logo, and SourcePro, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.