⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 libroutines

📁 IML package provides efficient routines to solve nonsingular systems of linear equations, certifie
💻
📖 第 1 页 / 共 3 页
字号:
 * * Summary: *   Compute a mod p row-echelon transform of a mod p input matrix * * Description: *   Given a n x m mod p matrix A, a row-echelon transform of A is a 4-tuple  *   (U,P,rp,d) with rp the rank profile of A (the unique and strictly  *   increasing list [j1,j2,...jr] of column indices of the row-echelon form  *   which contain the pivots), P a permutation matrix such that all r leading *   submatrices of (PA)[0..r-1,rp] are nonsingular, U a nonsingular matrix  *   such that UPA is in row-echelon form, and d the determinant of  *   (PA)[0..r-1,rp]. * *   Generally, it is required that p be a prime, as inverses are needed, but *   in some cases it is possible to obtain an echelon transform when p is  *   composite. For the cases where the echelon transform cannot be obtained *   for p composite, the function returns an error indicating that p is  *   composite. * *   The matrix U is structured, and has last n-r columns equal to the last n-r *   columns of the identity matrix, n the row dimension of A. * *   The first r rows of UPA comprise a basis in echelon form for the row  *   space of A, while the last n-r rows of U comprise a basis for the left  *   nullspace of PA. * *   For efficiency, this function does not output an echelon transform  *   (U,P,rp,d) directly, but rather the expression sequence (Q,rp,d). *   Q, rp, d are the form of arrays and pointers in order to operate inplace, *   which require to preallocate spaces and initialize them. Initially,  *   Q[i] = i (i=0..n), rp[i] = 0 (i=0..n), and *d = 1. Upon completion, rp[0] *   stores the rank r, rp[1..r] stores the rank profile. i<=Q[i]<=n for  *   i=1..r. The input Matrix A is modified inplace and used to store U.  *   Let A' denote the state of A on completion. Then U is obtained from the *   identity matrix by replacing the first r columns with those of A', and P *   is obtained from the identity matrix by swapping row i with row Q[i], for *   i=1..r in succession. * *   Parameters flrows, lrows, redflag, eterm control the specific operations *   this function will perform. Let (U,P,rp,d) be as constructed above. If  *   frows=0, the first r rows of U will not be correct. If lrows=0, the last *   n-r rows of U will not be correct. The computation can be up to four  *   times faster if these flags are set to 0. * *   If redflag=1, the row-echelon form is reduced, that is (UPA)[0..r-1,rp]  *   will be the identity matrix. If redflag=0, the row-echelon form will not *   be reduced, that is (UPA)[1..r,rp] will be upper triangular and U is unit *   lower triangular. If frows=0 then redflag has no effect. * *   If eterm=1, then early termination is triggered if a column of the  *   input matrix is discovered that is linearly dependant on the previous *   columns. In case of early termination, the third return value d will be 0 *   and the remaining components of the echelon transform will not be correct. * * Input: *         p: FiniteField, modulus *         A: 1-dim Double array length n*m, representation of a n x m input *            matrix *         n: long, row dimension of A *         m: long, column dimension of A *     frows: 1/0,  *          - if frows = 1, the first r rows of U will be correct *          - if frows = 0, the first r rows of U will not be correct *     lrows: 1/0, *          - if lrows = 1, the last n-r rows of U will be correct *          - if lrows = 0, the last n-r rows of U will not be correct *   redflag: 1/0, *          - if redflag = 1, compute row-echelon form *          - if redflag = 0, not compute reow-echelon form *     eterm: 1/0, *          - if eterm = 1, terminate early if not in full rank *          - if eterm = 0, not terminate early *         Q: 1-dim long array length n+1, compact representation of  *            permutation vector, initially Q[i] = i, 0 <= i <= n *        rp: 1-dim long array length n+1, representation of rank profile,  *            initially rp[i] = 0, 0 <= i <= n *         d: pointer to FiniteField, storing determinant of the matrix,  *            initially *d = 1 * * Precondition: *   ceil(n/2)*(p-1)^2+(p-1) <= 2^53-1 = 9007199254740991 (n >= 2) * */extern Double * mAdjoint (const FiniteField p, Double *A, const long n);/*  * Calling Sequence: *   Adj <-- mAdjoint(p, A, n) * * Summary: *   Compute the adjoint of a mod p square matrix *   * Description: *   Given a n x n mod p matrix A, the function computes adjoint of A. Input *   A is not modified upon completion. * * Input: *   p: FiniteField, prime modulus *      if p is a composite number, the routine will still work if no error  *      message is returned *   A: 1-dim Double array length n*n, representation of a n x n mod p matrix. *      The entries of A are casted from integers *   n: long, dimension of A * * Return: *   1-dim Double matrix length n*n, repesentation of a n x n mod p matrix, *   adjoint of A * * Precondition: *   n*(p-1)^2 <= 2^53-1 = 9007199254740991 * */extern long mBasis (const FiniteField p, Double *A, const long n,   		    const long m, const long basis, const long nullsp, 		    Double **B, Double **N);/*  * Calling Sequence: *   r/-1 <-- mBasis(p, A, n, m, basis, nullsp, B, N) * * Summary: *   Compute a basis for the rowspace and/or a basis for the left nullspace  *   of a mod p matrix *   * Description: *   Given a n x m mod p matrix A, the function computes a basis for the *   rowspace B and/or a basis for the left nullspace N of A. Row vectors in  *   the r x m matrix B consist of basis of A, where r is the rank of A in *   Z/pZ. If r is zero, then B will be NULL. Row vectors in the n-r x n *   matrix N consist of the left nullspace of A. N will be NULL if A is full *   rank. * *   The pointers are passed into argument lists to store the computed basis  *   and nullspace. Upon completion, the rank r will be returned. The  *   parameters basis and nullsp control whether to compute basis and/or *   nullspace. If set basis and nullsp in the way that both basis and  *   nullspace will not be computed, an error message will be printed and  *   instead of rank r, -1 will be returned. *   * Input: *        p: FiniteField, prime modulus *           if p is a composite number, the routine will still work if no  *           error message is returned *        A: 1-dim Double array length n*m, representation of a n x m mod p  *           matrix. The entries of A are casted from integers *        n: long, row dimension of A *        m: long, column dimension of A *    basis: 1/0, flag to indicate whether to compute basis for rowspace or  *           not *         - basis = 1, compute the basis *         - basis = 0, not compute the basis *   nullsp: 1/0, flag to indicate whether to compute basis for left nullspace *           or not *         - nullsp = 1, compute the nullspace *         - nullsp = 0, not compute the nullspace * * Output: *   B: pointer to (Double *), if basis = 1, *B will be a 1-dim r*m Double *      array, representing the r x m basis matrix. If basis = 1 and r = 0,  *      *B = NULL *   *   N: pointer to (Double *), if nullsp = 1, *N will be a 1-dim (n-r)*n Double *      array, representing the n-r x n nullspace matrix. If nullsp = 1 and *      r = n, *N = NULL. * * Return: *   - if basis and/or nullsp are set to be 1, then return the rank r of A  *   - if both basis and nullsp are set to be 0, then return -1 * * Precondition: *   n*(p-1)^2 <= 2^53-1 = 9007199254740991 * * Note: *   - In case basis = 0, nullsp = 1, A will be destroyed inplace. Otherwise, *     A will not be changed. *   - Space of B and/or N will be allocated in the function * */extern long mDeterminant (const FiniteField p, Double *A, const long n);/* * Calling Sequence: *   det <-- mDeterminant(p, A, n) *  * Summary: *   Compute the determinant of a square mod p matrix * * Input: *   p: FiniteField, prime modulus *      if p is a composite number, the routine will still work if no error  *      message is returned *   A: 1-dim Double array length n*n, representation of a n x n mod p matrix. *      The entries of A are casted from integers *   n: long, dimension of A * * Output: *   det(A) mod p, the determinant of square matrix A * * Precondition: *   ceil(n/2)*(p-1)^2+(p-1) <= 2^53-1 = 9007199254740991 (n >= 2) * * Note: *   A is destroyed inplace * */extern long mInverse (const FiniteField p, Double *A, const long n);/* * Calling Sequence: *   1/0 <-- mInverse(p, A, n) *  * Summary: *   Certified compute the inverse of a mod p matrix inplace * * Description: *   Given a n x n mod p matrix A, the function computes A^(-1) mod p  *   inplace in case A is a nonsingular matrix in Z/Zp. If the inverse does *   not exist, the function returns 0. * *   A will be destroyed at the end in both cases. If the inverse exists, A is *   inplaced by its inverse. Otherwise, the inplaced A is not the inverse. * * Input: *   p: FiniteField, prime modulus *      if p is a composite number, the routine will still work if no error  *      message is returned *   A: 1-dim Double array length n*n, representation of a n x n mod p matrix. *      The entries of A are casted from integers *   n: long, dimension of A * * Return:  *   - 1, if A^(-1) mod p exists *   - 0, if A^(-1) mod p does not exist * * Precondition: *   ceil(n/2)*(p-1)^2+(p-1) <= 2^53-1 = 9007199254740991 (n >= 2) * * Note: *   A is destroyed inplace * */extern long mRank (const FiniteField p, Double *A, const long n, const long m);/* * Calling Sequence: *   r <-- mRank(p, A, n, m) * * Summary: *   Compute the rank of a mod p matrix * * Input: *   p: FiniteField, prime modulus *      if p is a composite number, the routine will still work if no  *      error message is returned *   A: 1-dim Double array length n*m, representation of a n x m mod p  *      matrix. The entries of A are casted from integers *   n: long, row dimension of A *   m: long, column dimension of A *    * Return: *   r: long, rank of matrix A * * Precondition: *   ceil(n/2)*(p-1)^2+(p-1) <= 2^53-1 = 9007199254740991 (n >= 2) * * Note: *   A is destroyed inplace * */extern long * mRankProfile (const FiniteField p, Double *A,                             const long n, const long m);/* * Calling Sequence: *   rp <-- mRankProfile(p, A, n, m) * * Summary: *   Compute the rank profile of a mod p matrix * * Input: *   p: FiniteField, prime modulus *      if p is a composite number, the routine will still work if no  *      error message is returned *   A: 1-dim Double array length n*m, representation of a n x m mod p  *      matrix. The entries of A are casted from integers *   n: long, row dimension of A *   m: long, column dimension of A *    * Return: *   rp: 1-dim long array length n+1, where *     - rp[0] is the rank of matrix A *     - rp[1..r] is the rank profile of matrix A * * Precondition: *   ceil(n/2)*(p-1)^2+(p-1) <= 2^53-1 = 9007199254740991 (n >= 2) * * Note: *   A is destroyed inplace * */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -