Matrix representation is a method used by a computer language to store matrices of more than one dimension in memory. Fortran and C use different schemes for their native arrays. Fortran uses "Column Major", in which all the elements for a given column are stored contiguously in memory. C uses "Row Major", which stores all the elements for a given row contiguously in memory. LAPACK defines various matrix representations in memory. There is also Sparse matrix representation and Morton-order matrix representation. According to the documentation, in LAPACK the unitary matrix representation is optimized. Some languages such as Java store matrices using Iliffe vectors. These are particularly useful for storing irregular matrices. Matrices are of primary importance in linear algebra.
Video Matrix representation
Basic mathematical operations
An m × n (read as m by n) order matrix is a set of numbers arranged in m rows and n columns. Matrices of the same order can be added by adding the corresponding elements. Two matrices can be multiplied, the condition being that the number of columns of the first matrix is equal to the number of rows of the second matrix. Hence, if an m × n matrix is multiplied with an n × r matrix, then the resultant matrix will be of the order m × r.
Operations like row operations or column operations can be performed on a matrix, using which we can obtain the inverse of a matrix. The inverse may be obtained by determining the adjoint as well. rows and columns are the different classes of matrices
Maps Matrix representation
Basics of 2D array
The mathematical definition of a matrix finds applications in computing and database management, a basic starting point being the concept of arrays. A two-dimensional array can function exactly like a matrix. Two-dimensional arrays can be visualized as a table consisting of rows and columns.
int a[3][4]
, declares an integer array of 3 rows and 4 columns. Index of row will start from 0 and will go up to 2.- Similarly, index of column will start from 0 and will go up to 3.
This table shows arrangement of elements with their indices.
Initializing Two-Dimensional arrays: Two-Dimensional arrays may be initialized by providing a list of initial values.
or
Calculation of Address
An m x n matrix (a[1...m][1...n]
) where the row index varies from 1 to m and column index from 1 to n,aij denotes the number in the ith row and the jth column. In the computer memory, all elements are stored linearly using contiguous addresses. Therefore,in order to store a two-dimensional matrix a, two dimensional address space must be mapped to one-dimensional address space. In the computer's memory matrices are stored in either Row-major order or Column-major order form.
In 3D graphics
The choice of representation for 4x4 matrices commonly used in 3D graphics affects the implementation of matrix/vector operations in systems with packed SIMD instructions:
row major
With row major matrix order, it is easy to transform vectors using dot product operations, since the coefficients of each component are sequential in memory. Consequently, this layout may be desirable if a processor supports dot product operations natively. It is also possible to efficiently use a '3x4' affine transformation matrix without padding or awkward permutes.
column major
With column major order, a "matrix x vector" multiply can be implemented with vectorized multiply-add operations, if the vector's components are broadcast to each SIMD lane. It is also easy to access the basis vectors represented by a transformation matrix as individual column vectors, as these are contiguous in memory.
See also
- Row- and column-major order
- Sparse matrix
- Skyline matrix
References
External links
- a description of sparse matrices in R.
^1 R. LEHOUCQ, The computation of elementary unitary matrices, Computer Science Dept. Technical Report CS-94-233, University of Tennessee, Knoxville, 1994. (LAPACK Working Note 72).
Source of the article : Wikipedia