| |||||||||
| |||||||||
![]() | |||||||||
Description | |||||||||
TwoD Storage Type SelectorsThis is the most common way of storing matrices, and consists of one contiguous piece of memory that is divided up into rows or columns of equal length. The following example shows how a matrix can be mapped to linear memory in either a row-major or column-major fashion.[ 1 2 3 ] [ 4 5 6 ] [ 7 8 9 ] row major: [ 1 2 3 4 5 6 7 8 9 ] column major: [ 1 4 7 2 5 8 3 6 9 ] OneD Storage Type SelectorsThis specifies a normal dense vector to be used as the OneD part of matrix with array storage. | |||||||||
![]() | |||||||||
Example | |||||||||
In swap_rows.cc:
typedef matrix< double, rectangle<>, dense<external>, column_major>::type Matrix; const Matrix::size_type N = 3; Matrix::size_type large; double dA[] = { 1, 3, 2, 1.5, 2.5, 3.5, 4.5, 9.5, 5.5 }; Matrix A(dA, N, N); // Find the largest element in column 1. large = max_index(A[0]); // Swap the first row with the row containing the largest // element in column 1. swap( rows(A)[0] , rows(A)[large]); More examples can be found in general_matvec_mult.cc | |||||||||
![]() | |||||||||
Definition | |||||||||
matrix.h | |||||||||
![]() | |||||||||
Template Parameters | |||||||||
| |||||||||
![]() | |||||||||
Model of | |||||||||
![]() | |||||||||
Members | |||||||||
| |||||||||
![]() | |||||||||
New members | |||||||||
![]() | |||||||||
Notes | |||||||||
![]() | |||||||||
See also | |||||||||
Copyright ©
1998,1999 University of Notre Dame. All Rights Reserved.