Skip to main content Accessibility help
×
Hostname: page-component-848d4c4894-5nwft Total loading time: 0 Render date: 2024-05-05T11:02:46.370Z Has data issue: false hasContentIssue false

Eight - Arrays and Matrices

Published online by Cambridge University Press:  15 October 2009

Ed Akin
Affiliation:
Rice University, Houston
Get access

Summary

Subscripted Variables: Arrays

It is common in engineering and mathematics to employ a notation in which one or more subscripts are appended to a variable that is a member of some larger set. Such a variable may be a member of a list of scalars, or it may represent an element in a vector, matrix, or Cartesian tensor. In engineering computation, we usually refer to subscripted variables as arrays. Since programming languages do not have a convenient way to append the subscripts, we actually denote them by placing them in parentheses or square brackets. Thus, an element usually written as Ajk becomes A(j,k) in Fortran and Matlab, and A[j] [k] in C++.

Arrays have properties that need to be understood in order to utilize them correctly in any programming language. The primary feature of an array is that it must have at least one subscript. The “rank” of an array is the number of subscripts, or dimensions, it has. Fortran allows an array to have up to seven subscripts, C++ allows four, and Matlab allows only two since it deals only with matrices. An array with two subscripts is called a rank-two array, and one with a single subscript is called a rank-one array, or a vector. Matrices are rank-two arrays that obey special mathematical operations. A scalar variable has no subscripts and is sometimes called a rank-zero array. Rank-one arrays with an extent of one are also viewed as a scalar.

Type
Chapter
Information
Publisher: Cambridge University Press
Print publication year: 2003

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

Save book to Kindle

To save this book to your Kindle, first ensure coreplatform@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

  • Arrays and Matrices
  • Ed Akin, Rice University, Houston
  • Book: Object-Oriented Programming via Fortran 90/95
  • Online publication: 15 October 2009
  • Chapter DOI: https://doi.org/10.1017/CBO9780511530111.009
Available formats
×

Save book to Dropbox

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.

  • Arrays and Matrices
  • Ed Akin, Rice University, Houston
  • Book: Object-Oriented Programming via Fortran 90/95
  • Online publication: 15 October 2009
  • Chapter DOI: https://doi.org/10.1017/CBO9780511530111.009
Available formats
×

Save book to Google Drive

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.

  • Arrays and Matrices
  • Ed Akin, Rice University, Houston
  • Book: Object-Oriented Programming via Fortran 90/95
  • Online publication: 15 October 2009
  • Chapter DOI: https://doi.org/10.1017/CBO9780511530111.009
Available formats
×