Chapter 14
MATRIX – Blocks for matrix and vector operations

The MATRIX library is designed for advanced matrix computations and manipulations. It encompasses a wide range of blocks such as MB_DGEMM, MB_DTRMM, and MB_DGER for matrix-matrix and matrix-vector operations. The library includes functions for matrix decomposition (ML_DGEBRD, ML_DGEQRF), eigenvalue problems (ML_DGEEV, ML_DGEES), and singular value decomposition (ML_DGESDD). Additionally, it offers utility blocks like MX_MAT, MX_VEC, and MX_FILL for matrix creation and manipulation, as well as specialized blocks such as MX_DTRNSP for matrix transposition and MX_RAND for generating random matrices. This library is essential for complex mathematical operations involving matrices in various applications.

Implementation notices
First element of a matrix has index (0,0), first element of a vector has index (0).

The vector is one-column-matrix, not separate object. One-row-matrix is called a row vector, but that object should not be used as vector in REXYGEN.

The matrix inputs and outputs are references. It means one block (the MX_MAT block or the MX_VEC block most often) reserve memory for the matrix and other block (using same reference) write/read same space. The MB_DCOPY block (and second the MX_MAT block) must be used to create copy of the matrix.

Some blocks using vector (MB_DCPY, RTOV, VTOR) not check exact dimensions (for example a 10x10 matrix is regard as 100-elements vector). Matrix is linearize into vector column by column, because a matrix is stored this way in memory (e.g. for a 10x10 matrix: element (1,0) has index 1 in vector, element (2,0) has index 2 in vector, element (0,1) has index 10 in vector, element (0,2) has index 11 in vector, etc.). These type of blocks could not be used with submatrix returned by the MX_DSAREF block. Behavior is undefined in this case.

The most matrix blocks has input and output matrix reference. Both are equal, but connecting input reference to output reference of previous block define execution order (the blocks are executed according signal flow in REXYGEN) and therefore computed matrix equation.

 CNA – Array (vector/matrix) constant
 MB_DASUM – Sum of the absolute values
 MB_DAXPY – Performs y := a*x + y for vectors x,y
 MB_DCOPY – Copies vector x to vector y
 MB_DDOT – Dot product of two vectors
 MB_DGEMM – Performs C := alpha*op(A)*op(B) + beta*C, where op(X) = X or op(X) = X^T
 MB_DGEMV – Performs y := alpha*A*x + beta*y or y := alpha*A^T*x + beta*y
 MB_DGER – Performs A := alpha*x*y^T + A
 MB_DNRM2 – Euclidean norm of a vector
 MB_DROT – Plain rotation of a vector
 MB_DSCAL – Scales a vector by a constant
 MB_DSWAP – Interchanges two vectors
 MB_DTRMM – Performs B := alpha*op(A)*B or B := alpha*B*op(A), where op(X) = X or op(X) = X^T for triangular matrix A
 MB_DTRMV – Performs x := A*x or x := A^T*x for triangular matrix A
 MB_DTRSV – Solves one of the system of equations A*x = b or A^T*x = b for triangular matrix A
 ML_DGEBAK – Backward transformation to ML_DGEBAL of left or right eigenvectors
 ML_DGEBAL – Balancing of a general real matrix
 ML_DGEBRD – Reduces a general real matrix to bidiagonal form by an orthogonal transformation
 ML_DGECON – Estimates the reciprocal of the condition number of a general real matrix
 ML_DGEES – Computes the eigenvalues, the Schur form, and, optionally, the matrix of Schur vectors
 ML_DGEEV – Computes the eigenvalues and, optionally, the left and/or right eigenvectors
 ML_DGEHRD – Reduces a real general matrix A to upper Hessenberg form
 ML_DGELQF – Computes an LQ factorization of a real M-by-N matrix A
 ML_DGELSD – Computes the minimum-norm solution to a real linear least squares problem
 ML_DGEQRF – Computes an QR factorization of a real M-by-N matrix A
 ML_DGESDD – Computes the singular value decomposition (SVD) of a real M-by-N matrix A
 ML_DLACPY – Copies all or part of one matrix to another matrix
 ML_DLANGE – Computes one of the matrix norms of a general matrix
 ML_DLASET – Initilizes the off-diagonal elements and the diagonal elements of a matrix to given values
 ML_DTRSYL – Solves the real Sylvester matrix equation for quasi-triangular matrices A and B
 MX_AT – Get Matrix/Vector element
 MX_ATSET – Set Matrix/Vector element
 MX_CNADD – Add scalar to each Matrix/Vector element
 MX_CNMUL – Multiply a Matrix/Vector by a scalar
 MX_CTODPA – Discretizes continuous model given by (A,B) to (Ad,Bd) using Pade approximations
 MX_DIM – Matrix/Vector dimensions
 MX_DIMSET – Set Matrix/Vector dimensions
 MX_DSAGET – Set subarray of A into B
 MX_DSAREF – Set reference to subarray of A into B
 MX_DSASET – Set A into subarray of B
 MX_DTRNSP – General matrix transposition: B := alpha*A^T
 MX_DTRNSQ – Square matrix in-place transposition: A := alpha*A^T
 MX_FILL – Fill real matrix or vector
 MX_MAT – Matrix data storage block
 MX_RAND – Randomly generated matrix or vector
 MX_REFCOPY – Copies input references of matrices A and B to their output references
 MX_SLFS – Save or load a Matrix/Vector into file or string
 MX_VEC – Vector data storage block
 MX_WRITE – Write a Matrix/Vector to the console/system log
 RTOV – Vector multiplexer
 SWVMR – Vector/matrix/reference signal switch
 VTOR – Vector demultiplexer

2024 © REX Controls s.r.o., www.rexygen.com