Extracts a matrix in echelon form from a compact storage A=L\U of rank R obtained by ReducedRowEchelonForm or ReducedColumnEchelonForm with transform = true.
Computes MathP1 x Diag (I_R, P2) where MathP1 is a MathPermutation and P2 a LAPACK permutation and store the result in MathP1 as a MathPermutation format.
Pick uniformly at random a symmetric R-subpermutation of dimension N x N : a symmetric matrix with only R non-zeros, all equal to one, in a random rook placement.
Random Matrix with prescribed rank, with random rank profile matrix Creates an m x n matrix with random entries, rank r and with a rank profile matrix chosen uniformly at random.
Random Matrix with prescribed rank, with random rank profile matrix Creates an m x n matrix with random entries, rank r and with a rank profile matrix chosen uniformly at random.
Random Symmetric Matrix with prescribed rank, with random rank profile matrix Creates an n x n matrix with random entries, rank r and with a rank profile matrix chosen uniformly at random.
Random Symmetric Matrix with prescribed rank, with random rank profile matrix Creates an n x n matrix with random entries, rank r and with a rank profile matrix chosen uniformly at random.
Computes P1 x Diag (I_R, P2) where P1 is a LAPACK and P2 a LAPACK permutation and store the result in P1 as a LAPACK permutation.
Parameters
[in,out]
P1
a LAPACK permutation of size N
P2
a LAPACK permutation of size N-R
Applies a permutation P to the matrix A. Apply a permutation P, stored in the LAPACK format (a sequence of transpositions) between indices ibeg and iend of P to (iend-ibeg) vectors of size M stored in A (as column for NoTrans and rows for Trans). Side==FFLAS::FflasLeft for row permutation Side==FFLAS::FflasRight for a column permutation Trans==FFLAS::FflasTrans for the inverse permutation of P
Parameters
F
base field
Side
decides if rows (FflasLeft) or columns (FflasRight) are permuted
Trans
decides if the matrix is seen as columns (FflasTrans) or rows (FflasNoTrans)
M
size of the elements to permute
ibeg
first index to consider in P
iend
last index to consider in P
A
input matrix
lda
leading dimension of A
P
permutation in LAPACK format
psh
(optional): a sequential or parallel helper, to choose between sequential or parallel execution
Warning
not sure the submatrix is still a permutation and the one we expect in all cases... examples for iend=2, ibeg=1 and P=[2,2,2]
Apply a R-monotonically increasing permutation P, to the matrix A.
MonotonicApplyP Apply a permutation defined by the first R entries of the vector P (the pivots).
The permutation represented by P is defined as follows:
the first R values of P is a LAPACK reprensentation (a sequence of transpositions)
the remaining iend-ibeg-R values of the permutation are in a monotonically increasing progression Side==FFLAS::FflasLeft for row permutation Side==FFLAS::FflasRight for a column permutation Trans==FFLAS::FflasTrans for the inverse permutation of P
Parameters
F
base field
Side
selects if it is a row (FflasLeft) or column (FflasRight) permutation
Trans
inverse permutation (FflasTrans/NoTrans)
M
ibeg
iend
A
input matrix
lda
leading dimension of A
P
LAPACK permuation
R
first values of P
The non pivot elements, are located in montonically increasing order.
Solving using the PLUQ decomposition of A already computed inplace with PLUQ (FFLAS::FflasNonUnit). Version for A square. If A is rank deficient, a solution is returned if the system is consistent, Otherwise an info is 1
Parameters
F
base field
Side
Determine wheter the resolution is left (FflasLeft) or right (FflasRight) looking.
M
row dimension of B
N
col dimension of B
R
rank of A
A
input matrix
lda
leading dimension of A
P
row permutation of the PLUQ decomposition of A
Q
column permutation of the PLUQ decomposition of A
B
Right/Left hand side matrix. Initially stores B, finally stores the solution X.
ldb
leading dimension of B
info
Success of the computation: 0 if successfull, >0 if system is inconsistent
Solving using the PLUQ decomposition of A already computed inplace with PLUQ(FFLAS::FflasNonUnit). Version for A rectangular. If A is rank deficient, a solution is returned if the system is consistent, Otherwise an info is 1
Parameters
F
base field
Side
Determine wheter the resolution is left (FflasLeft) or right (FflasRight) looking.
Determine wheter the resolution is left (FflasLeft) or right (FflasRight) looking
M
row dimension of B
N
col dimension of B
A
input matrix
lda
leading dimension of A
B
Right/Left hand side matrix. Initially contains B, finally contains the solution X.
ldb
leading dimension of B
info
Success of the computation: 0 if successfull, >0 if system is inconsistent
Returns
the rank of the system
Solve the system A X = B or X A = B. Version for A square. If A is rank deficient, a solution is returned if the system is consistent, Otherwise an info is 1
Right/Left hand side matrix. Initially contains B, finally contains the solution X.
ldb
leading dimension of B
X
ldx
info
Success of the computation: 0 if successfull, >0 if system is inconsistent
Returns
the rank of the system
Solve the system A X = B or X A = B. Version for A square. If A is rank deficient, a solution is returned if the system is consistent, Otherwise an info is 1
Determine wheter to store the upper (FflasUpper) or lower (FflasLower) triangular factor
N
order of the matrix A
[in,out]
A
input matrix
lda
leading dimension of A
Returns
false if the A does not have generic rank profile, making the computation fail.
Compute the a triangular factorization of the matrix A: if UpLo = FflasLower or otherwise. D is a diagonal matrix. The matrices L and U are unit diagonal lower (resp. upper) triangular and overwrite the input matrix A. The matrix D is stored on the diagonal of A, as the diagonal of L or U is known to be all ones. If A does not have generic rank profile, the LDLT or UTDU factorizations is not defined, and the algorithm returns false.
Determine wheter to store the upper (FflasUpper) or lower (FflasLower) triangular factor
N
order of the matrix A
[in,out]
A
input matrix
[in,out]
D
lda
leading dimension of A
Returns
false if the A does not have generic rank profile, making the computation fail.
Compute the a triangular factorization of the matrix A: if UpLo = FflasLower or otherwise. D is a diagonal matrix. The matrices L and U are lower (resp. upper) triangular and overwrite the input matrix A. The matrix D need to be stored separately, as the diagonal of L or U are not unit. If A does not have generic rank profile, the LDLT or UTDU factorizations is not defined, and the algorithm returns false.
Compute the Column Echelon form of the input matrix in-place.
If LuTag == FfpackTileRecursive, then after the computation A = [ M \ V ] such that AU = C is a column echelon decomposition of A, with U = P^T [ V ] and C = M + Q [ Ir ] [ 0 In-r ] [ 0 ] If LuTag == FfpackTileRecursive then A = [ N \ V ] such that the same holds with M = Q N
Qt = Q^T If transform=false, the matrix V is not computed. See also test-colechelon for an example of use
Parameters
F
base field
M
number of rows
N
number of columns
[in]
A
input matrix
lda
leading dimension of A
P
the column permutation
Qt
the row position of the pivots in the echelon form
transform
decides whether V is computed
LuTag
chooses the elimination algorithm. SlabRecursive for LUdivine, TileRecursive for PLUQ
Compute the Row Echelon form of the input matrix in-place.
If LuTag == FfpackTileRecursive, then after the computation A = [ L \ M ] such that X A = R is a row echelon decomposition of A, with X = [ L 0 ] P and R = M + [Ir 0] Q^T [ In-r] If LuTag == FfpackTileRecursive then A = [ L \ N ] such that the same holds with M = N Q^T Qt = Q^T If transform=false, the matrix L is not computed. See also test-rowechelon for an example of use
Parameters
F
base field
M
number of rows
N
number of columns
[in]
A
the input matrix
lda
leading dimension of A
P
the row permutation
Qt
the column position of the pivots in the echelon form
transform
decides whether L is computed
LuTag
chooses the elimination algorithm. SlabRecursive for LUdivine, TileRecursive for PLUQ
Compute the Reduced Column Echelon form of the input matrix in-place.
After the computation A = [ V ] such that AX = R is a reduced col echelon [ M 0 ] decomposition of A, where X = P^T [ V ] and R = Q [ Ir ] [ 0 In-r ] [ M 0 ] Qt = Q^T If transform=false, the matrix X is not computed and the matrix A = R
Parameters
F
base field
M
number of rows
N
number of columns
[in]
A
input matrix
lda
leading dimension of A
P
the column permutation
Qt
the row position of the pivots in the echelon form
transform
decides whether X is computed
LuTag
chooses the elimination algorithm. SlabRecursive for LUdivine, TileRecursive for PLUQ
Compute the Reduced Row Echelon form of the input matrix in-place.
After the computation A = [ V1 M ] such that X A = R is a reduced row echelon [ V2 0 ] decomposition of A, where X = [ V1 0 ] P and R = [ Ir M ] Q^T [ V2 In-r ] [ 0 ] Qt = Q^T If transform=false, the matrix X is not computed and the matrix A = R
Parameters
F
base field
M
number of rows
N
number of columns
[in]
A
input matrix
lda
leading dimension of A
P
the row permutation
Qt
the column position of the pivots in the echelon form
transform
decides whether X is computed
LuTag
chooses the elimination algorithm. SlabRecursive for LUdivine, TileRecursive for PLUQ
The method is a block elimination with early termination
using LQUP factorization with early termination. If M != N, then the matrix is virtually padded with zeros to make it square and it's determinant is zero.
Returns the determinant of the given square matrix.
The method is a block elimination using PLUQ factorization. The input matrix A is overwritten.
Warning
The input matrix is modified.
Parameters
F
base field
[out]
det
the determinant of A
N
the order of the square matrix A.
[in,out]
A
input matrix
lda
leading dimension of A
psH
(optional) a ParSeqHelper to choose between sequential and parallel execution
P,Q
(optional) row and column permutations to be used by the PLUQ factorization. randomized checkers (see cherckes/checker_det.inl) need them for certification
L is M*M if Side == FFLAS::FflasLeft and N*N if Side == FFLAS::FflasRight, B is M*N. Only the R non trivial column of L are stored in the M*R matrix L Requirement : so that L could be expanded in-place Computes a vector of the Left/Right nullspace of the matrix A.
Parameters
F
The computation domain
Side
decides whether it computes the left (FflasLeft) or right (FflasRight) nullspace
M
number of rows
N
number of columns
[in,out]
A
input matrix of dimension M x N, A is modified to its LU version
Recovers the column/row rank profile from the permutation of an LU decomposition.
Works with both the CUP/PLE decompositions (obtained by LUdivine) or the PLUQ decomposition. Assumes that the output vector containing the rank profile is already allocated.
Parameters
P
the permutation carrying the rank profile information
N
the row/col dimension for a row/column rank profile
R
the rank of the matrix
[out]
rkprofile
return the rank profile as an array of indices
LuTag
chooses the elimination algorithm. SlabRecursive for LUdivine, TileRecursive for PLUQ
Extracts a matrix in echelon form from a compact storage A=L\U of rank R obtained by RowEchelonForm or ColumnEchelonForm.
Either L or U is in Echelon form (depending on Uplo) The echelon structure is defined by the first R values of the array P. row and column dimension of T are greater or equal to that of A
Parameters
F
base field
UpLo
selects if the upper (FflasUpper) or lower (FflasLower) triangular matrix is returned
diag
selects if the echelon matrix has unit pivots (FflasUnit/NoUnit)
M
row dimension of T
N
column dimension of T
R
rank of the triangular matrix (how many rows/columns need to be copied)
P
positions of the R pivots
[in]
A
input matrix
lda
leading dimension of A
[out]
T
output matrix
ldt
leading dimension of T
OnlyNonZeroVectors
decides whether the last zero rows/columns should be ignored
LuTag
which factorized form (CUP/PLE if FfpackSlabRecursive, PLUQ if FfpackTileRecursive)
Extracts a transformation matrix to echelon form from a compact storage A=L\U of rank R obtained by RowEchelonForm or ColumnEchelonForm.
If Uplo == FflasLower: T is N x N (already allocated) such that A T = C is a transformation of A in Column echelon form Else T is M x M (already allocated) such that T A = E is a transformation of A in Row Echelon form
Parameters
F
base field
UpLo
Lower (FflasLower) means Transformation to Column Echelon Form, Upper (FflasUpper), to Row Echelon Form
diag
selects if the echelon matrix has unit pivots (FflasUnit/NoUnit)
M
row dimension of A
N
column dimension of A
R
rank of the triangular matrix
P
permutation matrix
[in]
A
input matrix
lda
leading dimension of A
[out]
T
output matrix
ldt
leading dimension of T
LuTag
which factorized form (CUP/PLE if FfpackSlabRecursive, PLUQ if FfpackTileRecursive)
Extracts a matrix in echelon form from a compact storage A=L\U of rank R obtained by ReducedRowEchelonForm or ReducedColumnEchelonForm with transform = true.
Either L or U is in Echelon form (depending on Uplo) The echelon structure is defined by the first R values of the array P. row and column dimension of T are greater or equal to that of A
Parameters
F
base field
UpLo
selects if the upper (FflasUpper) or lower (FflasLower) triangular matrix is returned
diag
selects if the echelon matrix has unit pivots (FflasUnit/NoUnit)
M
row dimension of T
N
column dimension of T
R
rank of the triangular matrix (how many rows/columns need to be copied)
P
positions of the R pivots
[in]
A
input matrix
lda
leading dimension of A
ldt
leading dimension of T
LuTag
which factorized form (CUP/PLE if FfpackSlabRecursive, PLUQ if FfpackTileRecursive)
OnlyNonZeroVectors
decides whether the last zero rows/columns should be ignored
Extracts a transformation matrix to echelon form from a compact storage A=L\U of rank R obtained by RowEchelonForm or ColumnEchelonForm.
If Uplo == FflasLower: T is N x N (already allocated) such that A T = C is a transformation of A in Column echelon form Else T is M x M (already allocated) such that T A = E is a transformation of A in Row Echelon form
Parameters
F
base field
UpLo
selects Col (FflasLower) or Row (FflasUpper) Echelon Form
diag
selects if the echelon matrix has unit pivots (FflasUnit/NoUnit)
M
row dimension of A
N
column dimension of A
R
rank of the triangular matrix
P
permutation matrix
[in]
A
input matrix
lda
leading dimension of A
[out]
T
output matrix
ldt
leading dimension of T
LuTag
which factorized form (CUP/PLE if FfpackSlabRecursive, PLUQ if FfpackTileRecursive)
Suppose A has been factorized as L.Q.U.P, with rank r. Then Qt.A.Pt has an invertible leading principal r x r submatrix This procedure efficiently computes the inverse of this minor and puts it into X.
Note
It changes the lower entries of A_factors in the process (NB: unless A was nonsingular and square)
Parameters
F
base field
rank
rank of the matrix.
A_factors
matrix containing the L and U entries of the factorization
L is M*M if Side == FFLAS::FflasLeft and N*N if Side == FFLAS::FflasRight, B is M*N. Only the R non trivial column of L are stored in the M*R matrix L Requirement : so that L could be expanded in-place Computes a vector of the Left/Right nullspace of the matrix A.
Parameters
F
The computation domain
Side
decides whether it computes the left (FflasLeft) or right (FflasRight) nullspace
M
number of rows
N
number of columns
[in,out]
A
input matrix of dimension M x N, A is modified to its LU version
Computes MathP1 x Diag (I_R, P2) where MathP1 is a MathPermutation and P2 a LAPACK permutation and store the result in MathP1 as a MathPermutation format.
Pick uniformly at random a symmetric R-subpermutation of dimension N x N : a symmetric matrix with only R non-zeros, all equal to one, in a random rook placement.
Parameters
N
matrix order
[out]
rows
the row position of each non zero element (pre-allocated)
[out]
cols
the column position of each non zero element (pre-allocated)
Random Matrix with prescribed rank, with random rank profile matrix Creates an m x n matrix with random entries, rank r and with a rank profile matrix chosen uniformly at random.
Parameters
F
field
m
number of rows in A
n
number of cols in A
r
rank of the matrix to build
A
the matrix (preallocated to at least m x lda field elements)
Random Matrix with prescribed rank, with random rank profile matrix Creates an m x n matrix with random entries, rank r and with a rank profile matrix chosen uniformly at random.
Parameters
F
field
m
number of rows in A
n
number of cols in A
r
rank of the matrix to build
A
the matrix (preallocated to at least m x lda field elements)
Random Symmetric Matrix with prescribed rank, with random rank profile matrix Creates an n x n matrix with random entries, rank r and with a rank profile matrix chosen uniformly at random.
Parameters
F
field
n
order of A
r
rank of A
A
the matrix (preallocated to at least n x lda field elements)
Random Symmetric Matrix with prescribed rank, with random rank profile matrix Creates an n x n matrix with random entries, rank r and with a rank profile matrix chosen uniformly at random.
Parameters
F
field
n
order of A
r
rank of A
A
the matrix (preallocated to at least n x lda field elements)