LinearAlgebra
SplitForm
compute split form of a sparse rtable
Calling Sequence
Parameters
Options
Description
Examples
Compatibility
SplitForm(X, opts)
X
-
sparse rtable with hardware data type
opts
optional equations controlling the details of the computation
sort = 0, 1, or 2
With sort = 1 (the default) or sort = 2, the nonzero entries of X are sorted by index before computing the split form. With sort = 1, they are sorted lexicographically by index: that is, sorted by the first index, ties (if any) being broken by the second index, further ties (if any) being broken by the third index, and so on. In other words, in the result, A1 will be sorted, and among entries with equal values for A1, the corresponding entries of A2 will be sorted.
The option sort = 2 can only be used if X is two-dimensional (a Matrix or a 2-dimensional Array). It sorts the entries by the second index, breaking ties using the first index. This groups entries in the same column together.
The option sort = 0 does not sort the entries; they are returned in the order in which they are stored in memory.
The SplitForm function computes the split form of the input rtable X, which needs to have one of the hardware data types. It thus performs the opposite function to FromSplitForm.
The split form of an n-dimensional rtable X with k nonzero entries consists of n+1 Vectors, A1, A2, ..., An, and B, each with k entries: for every nonzero entry Xa1,a2,...,an=b, there is an index i such that A1i=a1, A2i=a2, ..., Ani=an, and Bi=b. (If X is a Vector, then n=1; if X is a Matrix, then n=2.)
The Vectors Aj are of word-size integer data type; that is, on 32-bit platforms they will have data type integer4 and on 64-bit platforms data type integer8. The Vector B has the same data type as X.
SplitForm returns a sequence of two objects; the first is the list A1,A2,...,An, and the second is B.
The split form is most useful for sparse rtables. If X does not have sparse storage (as determined by rtable_option⁡X,storage being either sparse or sparseupper or sparselower), then a sparse storage copy is made before determining the split form.
If X has any indexing functions (as determined by rtable_indfns⁡X), then these are bypassed when determining the split form: since SplitForm is a low-level command, Maple returns the split form of the stored entries only. For example, if a Matrix is defined with option shape=symmetric and storage=sparseupper, then only one of each pair of off-diagonal entries will be represented in the split form. However, if X has indexing functions but no sparse storage, then the copy made to give it sparse storage, as explained above, typically gets rid of the indexing function and stores all nonzero entries.
The code for SplitForm relies on X being a NAG-sparse Matrix (potentially after copying it to give it sparse storage); that is, its datatype as returned by rtable_options needs to be one of these values:
sfloat,complex⁡sfloat,integer1,integer2,integer4,integer8,float4,float8,complex8
with⁡LinearAlgebra:
A basic example with a sparse Vector.
V≔Vector⁡10,datatype=float8,storage=sparse
V≔0.0.0.0.0.0.0.0.0.0.
V2≔1.;V6≔−3.
V2≔1.
V6≔−3.
SplitForm⁡V
26,1.−3.
Notice below that the symmetric indexing function is ignored when constructing the split form.
M≔Matrix⁡6,datatype=integer4,shape=symmetric,storage=sparseupper,i,j↦`if`⁡irem⁡i+j,2=1,abs⁡i−j,0
M≔010305101030010103301010030101503010
SplitForm⁡M
111223345,246354656,135131311
The split form cannot be computed for rtables that don't have a suitable data type.
M2≔Matrix⁡3,3,i,j↦i−j
M2≔0−1−210−1210
SplitForm⁡M2
Error, (in LinearAlgebra:-SplitForm) cannot compute split form of an rtable with non-hardware datatype anything
To make this work, we need to recreate M2 with, for example, option datatype=integer8.
M2≔Matrix⁡M2,datatype=integer8
SplitForm⁡M2,sort=2
231312,112233,12−11−2−1
Here is an example with a 4-dimensional Array that has a nonzero entry whenever the indices form a permutation of 1,2,3,4 that is not a derangement.
A≔Array⁡1..4,1..4,1..4,1..4,datatype=integer1,storage=sparse
with⁡GroupTheory:
permutations≔Elements⁡SymmetricGroup⁡4
permutations≔2,4,3,1,3,4,1,4,2,3,2,4,3,4,,2,3,1,2,3,1,2,4,3,1,2,4,1,23,4,1,3,2,4,1,32,4,1,3,2,1,3,4,2,1,3,1,4,2,1,4,3,2,1,4,1,4,3,1,42,3,2,3,4,1,2,3,4,1,2
forperminpermutationsdolst≔convert⁡perm,permlist,4;Aop⁡lst≔4−numelems⁡PermSupport⁡permenddo:
interface⁡rtablesize=15
10,10
SplitForm⁡A
111111222333444,223344134122122,342423313214313,434232441441231,422112211121112
The LinearAlgebra[SplitForm] command was introduced in Maple 17.
For more information on Maple 17 changes, see Updates in Maple 17.
See Also
LinearAlgebra[CompressedSparseForm]
LinearAlgebra[FromCompressedSparseForm]
LinearAlgebra[FromSplitForm]
rtable_indfns
rtable_options
Download Help Document