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.3 Data and Views

The vector, matrix, and array classes are built on a powerful and simple architecture which we call the data-view model. Understanding this architecture will help you use the Essential Math Module to write efficient, simple code that is easy to maintain. Here is the key point:


Vectors, matrices, and arrays provide views into blocks of data. While more than one object can view the same block of data, they need not share the same view of it. Associated with each vector, matrix, and array is information describing which data in the block is being viewed, and how to interpret the data.

As an example of the data-view model, consider the following figure:

Figure 1: Different views into a single data block

Figure 1 illustrates a 3 x 3 matrix A, a 2 x 2 matrix Atl, which is a view of the top left corner of A, and a vector v, which is a view of A's middle row. All three of these objects are different views into a single data block. Since the views share the same data, changing the middle element 5 in the vector v, for example, also changes the corresponding element in A and Atl. Assigning different names to views of the same data is sometimes called aliasing. In later sections, we will show how to use the data-view concept effectively, why it leads to efficient code, and how to avoid aliasing when necessary.



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.