Functions | |
matrix | AddCols (matrix M, matrix A) |
Produces horizontal concatenation of two appropriate matrices. | |
matrix | AddRows (matrix M, matrix A) |
Produces vertical concatenation of two appropriate matrices. | |
matrix | Col2Sym (tensor T) |
Transforms the vector in one index of a tensor into a symmetric matrix. | |
matrix | Col2Sym (matrix V) |
Transforms a single column matrix into a symmetric matrix. | |
scalar | det (tensor T) |
Evaluates the determinant in two indices of a tensor. | |
scalar | det (matrix M) |
Evaluates the determinant of a matrix. | |
matrix | Diag2Row (matrix M) |
Transforms the diagonal of a matrix to a matrix with a single row, i.e. a row-vector. | |
matrix | DiagToRow (matrix M) |
Transforms the diagonal of a matrix to a matrix with a single row, i.e. a row-vector. | |
list | Eigen (tensor T) |
Evaluates the eigenvalues and eigenvectors of a sub-matrix of a tensor. | |
list | Eigen (matrix M) |
Find eigenvalues and eigenvectors. | |
list | EigenValues (tensor T) |
Evaluates the eigenvalues of a sub-matrix of a tensor. | |
list | EigenValues (matrix M) |
Find eigenvalues of a matrix. | |
list | FindMainNRows (matrix M, counter N) |
Get a list of N matrix rows which mainly span the row space. | |
matrix | GetMVProductMatrix (list L, counter ProductId, counter Left, list Mask) |
Generates a matrix based on a list of multivectors and a product. | |
matrix | GetMVProductMatrix (list L, counter ProductId, list Mask, counter Left) |
Generates a matrix based on a list of multivector and a product. | |
matrix | GetMVProductMatrix (multivector A, counter ProductId, counter Left, list Mask) |
Generates a matrix based on a multivector and a product. | |
matrix | GetMVProductMatrix (multivector A, counter ProductId, list Mask, counter Left) |
Generates a matrix based on a multivector and a product. | |
matrix | GetRows (matrix M, list Idx) |
Construct matrix from rows of another matrix. | |
matrix | IdMatrix (counter rows, counter cols) |
Generates an identity matrix. | |
matrix | Matrix (multivector A) |
Generates a symmetric 3 by 3 matrix from a vector from 2D-conic space. | |
matrix | Matrix (counter rows, counter cols) |
Generates a matrix with zeroed entries of the given dimension. | |
matrix | Matrix (tensor T) |
Transforms a tensor or part of a tensor into a matrix. | |
matrix | Matrix (list L) |
Generates a matrix from a nested list of scalar values. | |
matrix | Matrix2MV (matrix M, list Mask) |
Generates a multivector from a column vector or the column vectors of a matrix. | |
matrix | MV2Matrix (list L, list Mask) |
Generates a column vector based on a multivector. | |
matrix | MV2Matrix (multivector A, list Mask) |
Generates a column vector based on a multivector. | |
matrix | ReadMatrix (string filename, string sepsym) |
Reads a matrix from a text file. | |
matrix | ReshapeMatrix (matrix M, counter Rows, counter Cols) |
Changes the shape of a matrix. | |
matrix | ResizeMatrix (matrix M, counter Rows, counter Cols) |
Changes the size of a matrix. | |
matrix | Row2Diag (matrix M) |
Transforms a row-vector to a diagonal matrix. | |
list | RowSpace (matrix M, scalar prec) |
Reduce matrix to those rows that span the row space and have highest magnitude. | |
matrix | RowToDiag (matrix M) |
Transforms a row-vector to a diagonal matrix. | |
list | Size (matrix M) |
Returns the dimension of a matrix. | |
list | SVD (tensor T) |
Evaluates the singular value decomposition (SVD) of a submatrix of a tensor. | |
list | SVD (matrix M) |
Evaluates a singular value decomposition (SVD) of a matrix. | |
matrix | Sym2Col (tensor T) |
Transforms the upper triangular part including the diagonal of a symmetric matrix into a column vector. | |
matrix | Sym2Col (matrix M) |
Transforms the upper triangular part including the diagonal of a symmetric matrix into a column vector. |
|
Produces horizontal concatenation of two appropriate matrices.
|
|
Produces vertical concatenation of two appropriate matrices.
|
|
Transforms the vector in one index of a tensor into a symmetric matrix.
Output: T (2x3)=
M (2x2)=
Note that the components in the column vector that are mapped to off-diagonal elements of the symmetric matrix, are divided by the square root of 2. |
|
Transforms a single column matrix into a symmetric matrix.
Output: V (3x1)=
M (2x2)=
Note that the components in the column vector that are mapped to off-diagonal elements of the symmetric matrix, are divided by the square root of 2. |
|
Evaluates the determinant in two indices of a tensor.
produces the output T (2x2x2)=
dV = -2 |
|
Evaluates the determinant of a matrix.
produces the output M = (| 1 2|, | 3 4|) DetM = -2 |
|
Transforms the diagonal of a matrix to a matrix with a single row, i.e. a row-vector.
produces the output M = (| 1 0 0|, | 0 1 0|, | 0 0 1|) R = (| 1 1 1|) |
|
Transforms the diagonal of a matrix to a matrix with a single row, i.e. a row-vector.
produces the output M = (| 1 0 0|, | 0 1 0|, | 0 0 1|) R = (| 1 1 1|) |
|
Evaluates the eigenvalues and eigenvectors of a sub-matrix of a tensor.
T is given by T = Tensor(3, [2,3,3]) you can evaluate the eigenvalues and eigenvectors a submatrix by Eigen(T(1,-1,-2)) . |
|
Find eigenvalues and eigenvectors.
![]() ![]() ![]() ![]() L(1) and L(3) give the real parts. Elements with even list index give the corresponding imaginary parts. The eigenvalues are sorted in descending order according to their magnitude. The order of the eigenvectors, i.e. the columns of matrix ![]() Eigen .
_FrameBoxSize = 0; M = Matrix([ [0,3,1,4], [3,0,1,5], [1,1,0,9],[ 4,5,9,0] ]); L = Eigen( M ); ? "Size of list L = " + Size( L ); StartOverlay(); SetLatexAlign(0,1); SetLatexMagStep(4); :White; P1 = DrawLatex( 5, 5,0, "$M\, =\, " + Latex( M ) + "$", "1"); P2 = DrawLatex( 5, P1(2)+5,0, "$L(1)\, =\, D_{\mbox{real}}\, =\, " + Latex( Row2Diag(L(1)) ) + "$", "2"); P3 = DrawLatex(P2(4)+5, P1(2)+5,0, "$L(3)\, =\, V_{\mbox{real}}\, =\, " + Latex( L(3) ) + "$", "4"); P2 = DrawLatex( 5, P3(2)+5,0, "$L(2)\, =\, D_{\mbox{imag}}\, =\, " + Latex( Row2Diag(L(2)) ) + "$", "3"); P2 = DrawLatex(P2(4)+5, P3(2)+5,0, "$L(4)\, =\, V_{\mbox{imag}}\, =\, " + Latex( L(4) ) + "$", "5"); EndOverlay(); Matrix is symmetric --> pure real ? V = L(3); ? D = Row2Diag( L(1) ); ? M = V * D * !V; ? M = V * D * ~V; // Since V is nomalized (!).
![]() |
|
Evaluates the eigenvalues of a sub-matrix of a tensor.
T is given by T = Tensor(3, [2,3,3]) you can evaluate the eigenvalues of a submatrix by EigenValues(T(1,-1,-2)) . |
|
Find eigenvalues of a matrix.
Eigen , i.e. with L1 = Eigenvalues(M) and L2 = (Eigen(M))([ [1], [2] ]) we have that L1 is equal to L2 . |
|
Get a list of N matrix rows which mainly span the row space.
|
|
Generates a matrix based on a list of multivectors and a product.
|
|
Generates a matrix based on a list of multivector and a product.
|
|
Generates a matrix based on a multivector and a product.
|
|
Generates a matrix based on a multivector and a product.
|
|
Construct matrix from rows of another matrix.
Idx = [ 1, 4 ]; ? M = Matrix( [ [16, 2, 3, 13], [5, 11, 10, 8], [9, 7, 6, 12], [4, 14, 5, 1] ] ); ? R = GetRows( M, Idx );
M = (| 16 2 3 13|, | 5 11 10 8|, | 9 7 6 12|, | 4 14 5 1|) R = (| 16 2 3 13|, | 4 14 5 1|) |
|
Generates an identity matrix.
produces the output M = (| 1 0 0|, | 0 1 0|, | 0 0 1|) M = (| 0 0 0 0|, | 0 0 0 0|, | 0 0 0 0|) |
|
Generates a symmetric 3 by 3 matrix from a vector from 2D-conic space.
produces the output M = (| 1 2 1|, | 2 4 2|, | 1 2 1|) |
|
Generates a matrix with zeroed entries of the given dimension.
?M = Matrix( 3, 4 ); produces the output M = (| 0 0 0 0|, | 0 0 0 0|, | 0 0 0 0|)
where the elements enclodes in |
|
Transforms a tensor or part of a tensor into a matrix.
Output: M1 (2x3)=
M2 (3x4)=
|
|
Generates a matrix from a nested list of scalar values.
?M = Matrix( ((1, 2), (3, 4)) ); produces the output M = (| 1 2|, | 3 4|)
where the elements enclodes in |
|
Generates a multivector from a column vector or the column vectors of a matrix.
For example, DefVarsE3(); ?A = 1*e1 + 2*e2^e3 + 3*I; ?MA = MV2Matrix(A); ?B = Matrix2MV(MA); Mask = (0, 1, 0, 0, 2, 0, 0, 3); ?MA2 = MV2Matrix(A, Mask); ?B2 = Matrix2MV(MA2, Mask); produces the output A = 1^e1 + 2^e23 + 3^I MA = (| 0|, | 1|, | 0|, | 0|, | 2|, | 0|, | 0|, | 3|) B = 1^e1 + 2^e23 + 3^I MA2 = (| 1|, | 2|, | 3|) B2 = 1^e1 + 2^e23 + 3^I |
|
Generates a column vector based on a multivector.
For example, DefVarsE3(); ?A = 1*e1 + 2*e2^e3 + 3*I; ?B = 3*e1 + 1*e2^e3 + 2*I; ?MAB = MV2Matrix([A,B]); Mask = [0, 1, 0, 0, 2, 0, 0, 3]; ?MAB2 = MV2Matrix([A,B], Mask); produces the output
A = 1 e1 + 2 e23 + 3 I
</font> MAB2 <font size="12">(3x2)</font> = <font size="12">
</font> |
|
Generates a column vector based on a multivector.
For example, DefVarsE3(); ?A = 1*e1 + 2*e2^e3 + 3*I; ?MA = MV2Matrix(A); Mask = [0, 1, 0, 0, 2, 0, 0, 3]; ?MA2 = MV2Matrix(A, Mask); produces the output A = 1^e1 + 2^e23 + 3^I MA = (| 0|, | 1|, | 0|, | 0|, | 2|, | 0|, | 0|, | 3|) MA2 = (| 1|, | 2|, | 3|) |
|
Reads a matrix from a text file.
[Rows] [Col] [Value Row 1, Col 1] [Value Row1, Col 2] ... [Value Row 2, Col 1] [Value Row2, Col 2] ... ...
For example, if a text file with the name '
2 3 1 2 3 3 2 1 the script
?M = ReadMatrix("Mat.txt"); results in the output M <font size="12">(2x3)</font> = <font size="12">
</font> |
|
Changes the shape of a matrix.
For example,
?M = Matrix( 2, 2 ); M[1,1] = 1; M[1,2] = 2; M[2,1] = 3; M[2,2] = 4; ?M; ?V = ReshapeMatrix( M, 4, 1 ); produces the output M = (| 0 0|, | 0 0|) M = (| 1 2|, | 3 4|) V = (| 1|, | 2|, | 3|, | 4|) |
|
Changes the size of a matrix.
?M = Matrix( 2, 2 ); M[1,1] = 1; M[1,2] = 2; M[2,1] = 3; M[2,2] = 4; ?M; ?P = ResizeMatrix( M, 3, 3 ); produces the output M = (| 0 0|, | 0 0|) M = (| 1 2|, | 3 4|) P = (| 1 2 0|, | 3 4 0|, | 0 0 0|) |
|
Transforms a row-vector to a diagonal matrix.
produces the output M = (| 0 0 0|) M = (| 1 2 3|) D = (| 1 0 0|, | 0 2 0|, | 0 0 3|) |
|
Reduce matrix to those rows that span the row space and have highest magnitude.
![]()
In the subsequent example a matrix M is created which is linear dependent since dFac = 1.0; // change this value to 0.2 ! ? M = Matrix( [ [ 1,0,0,0 ], [ 0,1,0,0 ], [ 0,0,1,0 ], [ 1,2,3,0 ] * dFac, [ 0,0,0,1e-5] ] ); L = RowSpace( M ); ? Rows = L(2); ? R = L(1);
M = (| 1 0 0 0|, | 0 1 0 0|, | 0 0 1 0|, | 1 2 3 0|, | 0 0 0 1.0e-05|) Rows = [4, 1, 2, 5] R = (| 1 2 3 0|, | 1 0 0 0|, | 0 1 0 0|, | 0 0 0 1.0e-05|) |
|
Transforms a row-vector to a diagonal matrix.
produces the output M = (| 0 0 0|) M = (| 1 2 3|) D = (| 1 0 0|, | 0 2 0|, | 0 0 3|) |
|
Returns the dimension of a matrix.
The result will be Rows = 2 Cols = 5 Size applied to a scalar val is equivalent to ![]() |
|
Evaluates the singular value decomposition (SVD) of a submatrix of a tensor.
![]() ![]() |
|
Evaluates a singular value decomposition (SVD) of a matrix.
![]() ![]()
// Define a matrix ?M = Matrix( ((1,2), (3,4)) ); // Evaluate its singular value decomposition L = SVD(M); // Extract the three matrices from the list L ?U = L[1]; ?D = L[2]; ?V = L[3]; // Check that M can be reconstructed ?U*D*~V; // Check the inverse of M ?M * (V*!D*~U); produces the output M = (| 1 2|, | 3 4|) U = (| 0.914514 0.404554|, | -0.404554 0.914514|) D = (| 0.365966 0|, | 0 5.464986|) V = (| -0.817416 0.576048|, | 0.576048 0.817416|) Constant = (| 1 2|, | 3 4|) Constant = (| 1 0|, | 0 1|) |
|
Transforms the upper triangular part including the diagonal of a symmetric matrix into a column vector.
Output: T (2x3x3)=
V (6x1)=
|
|
Transforms the upper triangular part including the diagonal of a symmetric matrix into a column vector.
Output: M (3x3)=
V (6x1)=
Note that the off-diagonal elements are multiplied with the square root of 2, such that the scalar product of the matrix M with some other symmetric matrix is equal to the scalar product of the vector V with another vector generated in this way. |