naginterfaces.library.sparse.direct_real_gen_setup¶
- naginterfaces.library.sparse.direct_real_gen_setup(spec, n, icolzp, irowix, iprm)[source]¶
direct_real_gen_setup
computes a column permutation suitable for factorization (bydirect_real_gen_lu()
) of a real sparse matrix in compressed column (Harwell–Boeing) format and applies it to the matrix. This function must be called prior todirect_real_gen_lu()
.For full information please refer to the NAG Library document for f11md
https://support.nag.com/numeric/nl/nagdoc_30.2/flhtml/f11/f11mdf.html
- Parameters
- specstr, length 1
Indicates the permutation to be applied.
The identity permutation is used (i.e., the columns are not permuted).
The permutation in the array is used, as supplied by you.
The permutation computed by the COLAMD algorithm is used
- nint
, the order of the matrix .
- icolzpint, array-like, shape
The new column index array of sparse matrix . See the F11 Introduction.
- irowixint, array-like, shape
contains the row index in for element . See the F11 Introduction.
- iprmint, array-like, shape
The first entries contain the column permutation if supplied by the user. This will be used if , and ignored otherwise. If used, it must consist of a permutation of all the integers in the range , the leftmost column of the matrix denoted by and the rightmost by . Labelling columns in this way, means that column of is in position in , where expresses the factorization to be performed.
- Returns
- iprmint, ndarray, shape
The column permutation given or computed is returned in the second entries. The rest of the array contains data structures that will be used by other functions in the suite. The function computes the column elimination tree for and a post-order permutation on the tree. It then compounds the permutation given or computed by the COLAMD algorthm with the post-order permutation and this permutation is returned in the first entries. This whole array is needed by the factorization function
direct_real_gen_lu()
and associated functionsdirect_real_gen_solve()
,direct_real_gen_refine()
anddirect_real_gen_diag()
and should be passed to them unchanged.
- Raises
- NagValueError
- (errno )
On entry, .
Constraint: .
- (errno )
On entry, .
Constraint: , or .
- (errno )
Incorrect column permutations in array .
- (errno )
COLAMD algorithm failed.
- (errno )
Incorrect specification of argument .
- (errno )
Incorrect specification of argument .
- Notes
Given a sparse matrix in compressed column (Harwell–Boeing) format and a choice of column permutation schemes, the function computes those data structures that will be needed by the factorization function
direct_real_gen_lu()
and associated functionsdirect_real_gen_diag()
,direct_real_gen_solve()
anddirect_real_gen_refine()
. The column permutation choices are:original order (that is, no permutation);
user-supplied permutation;
a permutation, computed by the function, designed to minimize fill-in during the factorization.
The algorithm for this computed permutation is based on the approximate minimum degree column ordering algorithm COLAMD. The computed permutation is not sensitive to the magnitude of the nonzero values of .
- References
Amestoy, P R, Davis, T A and Duff, I S, 1996, An approximate minimum degree ordering algorithm, SIAM J. Matrix Anal. Appl. (17), 886–905
Gilbert, J R and Larimore, S I, 2004, A column approximate minimum degree ordering algorithm, ACM Trans. Math. Software (30,3), 353–376
Gilbert, J R, Larimore, S I and Ng, E G, 2004, Algorithm 836: COLAMD, an approximate minimum degree ordering algorithm, ACM Trans. Math. Software (30, 3), 377–380