translate compressed sparse row and column forms to native Maple form
FromCompressedSparseForm(CB, R, X, opts)
integer vector of column bounds
integer vector of row coordinates
hardware datatype vector with values
optional equations controlling the details of the computation
form = row or form = column
This option determines whether CB, R, and X are interpreted as the compressed sparse column form of A or as its compressed sparse row form. The default is compressed sparse column form.
otherdimension = n
This option determines the number of columns of A in the case of compressed sparse column form, and the number of rows of A in the case of compressed sparse row form. If the option is not specified, Maple uses the maximal entry in R.
scan = true or scan = false
This option determines whether or not X is scanned for zeroes. If scan = true, the default, then X is scanned to test if it contains any entries that are equal to 0. If this is the case, the operation is aborted with an error message: such entries are not allowed. If you are certain that there are no entries equal to 0, you can save a little bit of processing time by disabling this scan by passing scan = false to the procedure. Use this option with extreme caution.
rbase = posint
This option determines at what number Maple starts numbering the rows, for compressed sparse column form, or the columns, for compressed sparse row form. The default is 1, corresponding to the standard Maple convention. Other values, in particular 0, are mainly useful if the data come from external code.
The inverse command, CompressedSparseForm, also has a cbbase option. This corresponds to the first entry of CB and cannot be set manually for FromCompressedSparseForm.
The FromCompressedSparseForm function constructs a sparse Matrix A from either its compressed sparse row form or its compressed sparse column form, performing the opposite function to CompressedSparseForm.
The compressed sparse column form of an n by m Matrix A with k nonzero entries consists of three Vectors, CB, R, and X. These are obtained by sorting the k nonzero entries of A first by column, and then within each column sorting the entries by row. Now X is the k-element Vector of these nonzero values in A in this order, and R is the k-element Vector of row indices at which these values occur. CB is an n+1-element Vector; CBi is the index in both X and R where the ith column starts. We always have CBn+1=CB1+k, so that the entries in column i have indices CBi up to, but not including, CBi+1.
The compressed sparse row form is very similar, but with the roles of rows and columns interchanged. Specifically, we first sort A by row and then within each row by column; X is still the nonzero values occurring in A. However, R is the k-element Vector of column indices. Similarly, CBi is the index in X and R where the ith row starts.
The code for FromCompressedSparseForm relies on being able to construct A as a NAG-sparse Matrix; that is, the datatype of X as returned by rtable_options needs to be one of these values:
Let us examine the compressed sparse row and column form of an arbitrary matrix.
If the matrix has zero rows at the bottom, these are not reflected in the compressed sparse column form. (Similarly, zero columns at the right are not reflected in the compressed sparse row form.)
Therefore, to recover the original Matrix, you may need to use the otherdimension option.
The LinearAlgebra[FromCompressedSparseForm] command was introduced in Maple 17.
For more information on Maple 17 changes, see Updates in Maple 17.
Download Help Document
What kind of issue would you like to report? (Optional)