compute split form of a sparse rtable - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Mathematics : Linear Algebra : LinearAlgebra Package : Solvers : LinearAlgebra/SplitForm

LinearAlgebra[SplitForm] - compute split form of a sparse rtable

Calling Sequence

SplitForm(X, opts)

Parameters

X

-

sparse rtable with hardware data type

opts

-

optional equations controlling the details of the computation

Description

• 

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_optionX,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_indfnsX), 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,complexsfloat,integer1,integer2,integer4,integer8,float4,float8,complex8

Examples

withLinearAlgebra:

A basic example with a sparse Vector.

V:=Vector10,datatype=float8,storage=sparse

V:=0.0.0.0.0.0.0.0.0.0.

(1)

V2:=1.;V6:=3.

V2:=1.

V6:=3.

(2)

SplitFormV

26,1.3.

(3)

Notice below that the symmetric indexing function is ignored when constructing the split form.

M:=Matrix6,datatype=integer4,shape=symmetric,storage=sparseupper,i,j→`if`iremi+j,2=1,ij,0

M:=010305101030010103301010030101503010

(4)

SplitFormM

111223345,246354656,135131311

(5)

The split form cannot be computed for rtables that don't have a suitable data type.

M2:=Matrix3,3,i,j→ij

M2:=012101210

(6)

SplitFormM2

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:=MatrixM2,'datatype=integer8'

M2:=012101210

(7)

SplitFormM2,'sort=2'

231312,112233,121121

(8)

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:=Array1..4,1..4,1..4,1..4,'datatype=integer1','storage=sparse'

A:= 1..4 x 1..4 x 1..4 x 1..4 ArrayData Type: integer1Storage: sparseOrder: Fortran_order

(9)

withGroupTheory:

permutations:=ElementsSymmetricGroup4

permutations:=,1,2,1,3,1,4,2,3,2,4,3,4,1,2,3,1,2,4,1,3,2,1,3,4,1,4,2,1,4,3,2,3,4,2,4,3,1,2,3,4,1,2,4,3,1,3,2,4,1,3,4,2,1,4,2,3,1,4,3,2,1,23,4,1,32,4,1,42,3

(10)

forperminpermutationsdolst:=convertperm,'permlist',4;Aoplst:=4numelemsPermSupportpermend do:

interfacertablesize=15

10

(11)

SplitFormA

111111222333444,223344134122122,342423313214313,434232441441231,422112211121112

(12)

See Also

LinearAlgebra[CompressedSparseForm], LinearAlgebra[FromCompressedSparseForm], LinearAlgebra[FromSplitForm], rtable_indfns, rtable_options


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam