1 /* ========================================================================== */ 2 /* === umfpack_col_to_triplet =============================================== */ 3 /* ========================================================================== */ 4 5 /* -------------------------------------------------------------------------- */ 6 /* Copyright (c) 2005-2012 by Timothy A. Davis, http://www.suitesparse.com. */ 7 /* All Rights Reserved. See ../Doc/License.txt for License. */ 8 /* -------------------------------------------------------------------------- */ 9 10 int umfpack_di_col_to_triplet 11 ( 12 int n_col, 13 const int Ap [ ], 14 int Tj [ ] 15 ) ; 16 17 SuiteSparse_long umfpack_dl_col_to_triplet 18 ( 19 SuiteSparse_long n_col, 20 const SuiteSparse_long Ap [ ], 21 SuiteSparse_long Tj [ ] 22 ) ; 23 24 int umfpack_zi_col_to_triplet 25 ( 26 int n_col, 27 const int Ap [ ], 28 int Tj [ ] 29 ) ; 30 31 SuiteSparse_long umfpack_zl_col_to_triplet 32 ( 33 SuiteSparse_long n_col, 34 const SuiteSparse_long Ap [ ], 35 SuiteSparse_long Tj [ ] 36 ) ; 37 38 /* 39 double int Syntax: 40 41 #include "umfpack.h" 42 int n_col, *Tj, *Ap, status ; 43 status = umfpack_di_col_to_triplet (n_col, Ap, Tj) ; 44 45 double SuiteSparse_long Syntax: 46 47 #include "umfpack.h" 48 SuiteSparse_long n_col, *Tj, *Ap, status ; 49 status = umfpack_dl_col_to_triplet (n_col, Ap, Tj) ; 50 51 complex int Syntax: 52 53 #include "umfpack.h" 54 int n_col, *Tj, *Ap, status ; 55 status = umfpack_zi_col_to_triplet (n_col, Ap, Tj) ; 56 57 complex SuiteSparse_long Syntax: 58 59 #include "umfpack.h" 60 SuiteSparse_long n_col, *Tj, *Ap, status ; 61 status = umfpack_zl_col_to_triplet (n_col, Ap, Tj) ; 62 63 Purpose: 64 65 Converts a column-oriented matrix to a triplet form. Only the column 66 pointers, Ap, are required, and only the column indices of the triplet form 67 are constructed. This routine is the opposite of umfpack_*_triplet_to_col. 68 The matrix may be singular and/or rectangular. Analogous to [i, Tj, x] = 69 find (A) in MATLAB, except that zero entries present in the column-form of 70 A are present in the output, and i and x are not created (those are just Ai 71 and Ax+Az*1i, respectively, for a column-form matrix A). 72 73 Returns: 74 75 UMFPACK_OK if successful 76 UMFPACK_ERROR_argument_missing if Ap or Tj is missing 77 UMFPACK_ERROR_n_nonpositive if n_col <= 0 78 UMFPACK_ERROR_invalid_matrix if Ap [n_col] < 0, Ap [0] != 0, or 79 Ap [j] > Ap [j+1] for any j in the range 0 to n-1. 80 Unsorted columns and duplicate entries do not cause an error (these would 81 only be evident by examining Ai). Empty rows and columns are OK. 82 83 Arguments: 84 85 Int n_col ; Input argument, not modified. 86 87 A is an n_row-by-n_col matrix. Restriction: n_col > 0. 88 (n_row is not required) 89 90 Int Ap [n_col+1] ; Input argument, not modified. 91 92 The column pointers of the column-oriented form of the matrix. See 93 umfpack_*_*symbolic for a description. The number of entries in 94 the matrix is nz = Ap [n_col]. Restrictions on Ap are the same as those 95 for umfpack_*_transpose. Ap [0] must be zero, nz must be >= 0, and 96 Ap [j] <= Ap [j+1] and Ap [j] <= Ap [n_col] must be true for all j in 97 the range 0 to n_col-1. Empty columns are OK (that is, Ap [j] may equal 98 Ap [j+1] for any j in the range 0 to n_col-1). 99 100 Int Tj [nz] ; Output argument. 101 102 Tj is an integer array of size nz on input, where nz = Ap [n_col]. 103 Suppose the column-form of the matrix is held in Ap, Ai, Ax, and Az 104 (see umfpack_*_*symbolic for a description). Then on output, the 105 triplet form of the same matrix is held in Ai (row indices), Tj (column 106 indices), and Ax (numerical values). Note, however, that this routine 107 does not require Ai and Ax (or Az for the complex version) in order to 108 do the conversion. 109 */ 110