|
Calling Sequence
|
|
FromCompressedSparseForm(CB, R, X, opts)
|
|
Parameters
|
|
CB
|
-
|
integer vector of column bounds
|
R
|
-
|
integer vector of row coordinates
|
X
|
-
|
hardware datatype vector with values
|
opts
|
-
|
optional equations controlling the details of the computation
|
|
|
|
|
Options
|
|
•
|
form = row or form = column
|
|
This option determines whether , , and are interpreted as the compressed sparse column form of or as its compressed sparse row form. The default is compressed sparse column form.
|
|
This option determines the number of columns of in the case of compressed sparse column form, and the number of rows of in the case of compressed sparse row form. If the option is not specified, Maple uses the maximal entry in .
|
•
|
scan = true or scan = false
|
|
This option determines whether or not is scanned for zeroes. If scan = true, the default, then 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: if there are zeroes when you pass the scan = false option, Maple may malfunction.
|
|
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 and cannot be set manually for FromCompressedSparseForm.
|
|
|
Description
|
|
•
|
The FromCompressedSparseForm function constructs a sparse Matrix 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 by Matrix with nonzero entries consists of three Vectors, , , and . These are obtained by sorting the nonzero entries of first by column, and then within each column sorting the entries by row. Now is the -element Vector of these nonzero values in in this order, and is the -element Vector of row indices at which these values occur. is an -element Vector; is the index in both and where the th column starts. We always have , so that the entries in column have indices up to, but not including, .
|
•
|
The compressed sparse row form is very similar, but with the roles of rows and columns interchanged. Specifically, we first sort by row and then within each row by column; is still the nonzero values occurring in . However, is the -element Vector of column indices. Similarly, is the index in and where the th row starts.
|
•
|
The code for FromCompressedSparseForm relies on being able to construct as a NAG-sparse Matrix; that is, the datatype of as returned by rtable_options needs to be one of these values:
|
|
|
|
|
Examples
|
|
>
|
|
Let us examine the compressed sparse row and column form of an arbitrary matrix.
>
|
|
| (1) |
>
|
|
| (2) |
>
|
|
| (3) |
>
|
|
| (4) |
>
|
|
| (5) |
>
|
|
| (6) |
>
|
|
| (7) |
>
|
|
| (8) |
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.)
>
|
|
| (9) |
>
|
|
| (10) |
>
|
|
| (11) |
>
|
|
| (12) |
Therefore, to recover the original Matrix, you may need to use the otherdimension option.
>
|
|
>
|
|
| (14) |
|
|
Compatibility
|
|
•
|
The LinearAlgebra[FromCompressedSparseForm] command was introduced in Maple 17.
|
|
|
|