LinearAlgebra - Maple Help

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

LinearAlgebra

 FromSplitForm
 translate split form to native Maple form

 Calling Sequence FromSplitForm(Ai, B, opts)

Parameters

 Ai - list of integer index Vectors B - data Vector opts - optional equations controlling the details of the computation

Options

 • dimensions = [d1, ..., dn]
 This option controls the dimensions of $X$. Its value needs to be a list of $n$ positive integers, giving the dimensions of $X$. For example, when constructing a sparse Vector, the value should be a list containing a single positive integer, and for a Matrix it should be a list of two positive integers. If the option is not specified, Maple uses the maximal value in the $i$th index vector $\mathrm{Ai}$ as the $i$th dimension.
 • scan = true or scan = false
 This option determines whether or not $B$ is scanned for zeroes. If scan = true, the default, then $B$ 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.

Description

 • The FromSplitForm function constructs a sparse rtable $X$ from its split form, performing the opposite function to SplitForm.
 • The split form of an $n$-dimensional rtable $X$ with $k$ nonzero entries consists of $n+1$ Vectors, $\mathrm{A1}$, $\mathrm{A2}$, ..., $\mathrm{An}$, and $B$, each with $k$ entries: for every nonzero entry ${X}_{\mathrm{a1},\mathrm{a2},\mathrm{...},\mathrm{an}}=b$, there is an index $i$ such that ${\mathrm{A1}}_{i}=\mathrm{a1}$, ${\mathrm{A2}}_{i}=\mathrm{a2}$, ..., ${\mathrm{An}}_{i}=\mathrm{an}$, and ${B}_{i}=b$. (If $X$ is a Vector, then $n=1$; if $X$ is a Matrix, then $n=2$.)
 • The Vectors $\mathrm{Aj}$ need to be of word-size integer data type; that is, on 32-bit platforms they will have data type $\mathrm{integer}[4]$ and on 64-bit platforms data type $\mathrm{integer}[8]$. The Vector $B$ needs to have a data type compatible with NAG-sparse rtables; that is, the datatype of $B$ as returned by rtable_options needs to be one of these values:
 $\mathrm{sfloat},\mathrm{complex}\left(\mathrm{sfloat}\right),\mathrm{integer}[1],\mathrm{integer}[2],\mathrm{integer}[4],\mathrm{integer}[8],\mathrm{float}[4],\mathrm{float}[8],\mathrm{complex}[8]$

Examples

 > $\mathrm{with}\left(\mathrm{LinearAlgebra}\right):$

Let us examine the split form of an arbitrary matrix.

 > $m≔\mathrm{Matrix}\left(5,6,\left\{\left(1,2\right)=-81,\left(2,3\right)=-55,\left(2,4\right)=-15,\left(3,1\right)=-46,\left(3,3\right)=-17,\left(3,4\right)=99,\left(3,5\right)=-61,\left(4,2\right)=18,\left(4,5\right)=-78,\left(5,6\right)=22\right\},\mathrm{datatype}=\mathrm{integer}[4]\right)$
 ${m}{:=}\left[\begin{array}{rrrrrr}{0}& {-}{81}& {0}& {0}& {0}& {0}\\ {0}& {0}& {-}{55}& {-}{15}& {0}& {0}\\ {-}{46}& {0}& {-}{17}& {99}& {-}{61}& {0}\\ {0}& {18}& {0}& {0}& {-}{78}& {0}\\ {0}& {0}& {0}& {0}& {0}& {22}\end{array}\right]$ (1)
 > $\mathrm{ai},b≔\mathrm{SplitForm}\left(m\right)$
 ${\mathrm{ai}}{,}{b}{:=}\left[\left[\begin{array}{r}{1}\\ {2}\\ {2}\\ {3}\\ {3}\\ {3}\\ {3}\\ {4}\\ {4}\\ {5}\end{array}\right]{,}\left[\begin{array}{r}{2}\\ {3}\\ {4}\\ {1}\\ {3}\\ {4}\\ {5}\\ {2}\\ {5}\\ {6}\end{array}\right]\right]{,}\left[\begin{array}{r}{-}{81}\\ {-}{55}\\ {-}{15}\\ {-}{46}\\ {-}{17}\\ {99}\\ {-}{61}\\ {18}\\ {-}{78}\\ {22}\end{array}\right]$ (2)
 > $\mathrm{FromSplitForm}\left(\mathrm{ai},b\right)$
 $\left[\begin{array}{rrrrrr}{0}& {-}{81}& {0}& {0}& {0}& {0}\\ {0}& {0}& {-}{55}& {-}{15}& {0}& {0}\\ {-}{46}& {0}& {-}{17}& {99}& {-}{61}& {0}\\ {0}& {18}& {0}& {0}& {-}{78}& {0}\\ {0}& {0}& {0}& {0}& {0}& {22}\end{array}\right]$ (3)
 > $\mathrm{FromSplitForm}\left(\left[{\mathrm{ai}}_{2},{\mathrm{ai}}_{1}\right],b\right)$
 $\left[\begin{array}{rrrrr}{0}& {0}& {-}{46}& {0}& {0}\\ {-}{81}& {0}& {0}& {18}& {0}\\ {0}& {-}{55}& {-}{17}& {0}& {0}\\ {0}& {-}{15}& {99}& {0}& {0}\\ {0}& {0}& {-}{61}& {-}{78}& {0}\\ {0}& {0}& {0}& {0}& {22}\end{array}\right]$ (4)

If $X$ has a dimension $d$ such that all entries where index $d$ is at its maximal value, are zero, then these are not reflected in the split form. For example, if the last entry in a sparse Vector is zero, or the last row or column of a Matrix.

 > $\mathrm{m1}≔\mathrm{Matrix}\left(\left[\left[0,1,0\right],\left[2,0,0\right],\left[3,0,4\right]\right],'\mathrm{datatype}=\mathrm{float}'\right)$
 ${\mathrm{m1}}{:=}\left[\begin{array}{ccc}{0.}& {1.}& {0.}\\ {2.}& {0.}& {0.}\\ {3.}& {0.}& {4.}\end{array}\right]$ (5)
 > $\mathrm{m2}≔\mathrm{Matrix}\left(\left[\left[0,1,0\right],\left[2,0,0\right],\left[3,0,4\right],\left[0,0,0\right]\right],'\mathrm{datatype}=\mathrm{float}'\right)$
 ${\mathrm{m2}}{:=}\left[\begin{array}{ccc}{0.}& {1.}& {0.}\\ {2.}& {0.}& {0.}\\ {3.}& {0.}& {4.}\\ {0.}& {0.}& {0.}\end{array}\right]$ (6)
 > $\mathrm{ai1},\mathrm{b1}≔\mathrm{SplitForm}\left(\mathrm{m1}\right)$
 ${\mathrm{ai1}}{,}{\mathrm{b1}}{:=}\left[\left[\begin{array}{r}{1}\\ {2}\\ {3}\\ {3}\end{array}\right]{,}\left[\begin{array}{r}{2}\\ {1}\\ {1}\\ {3}\end{array}\right]\right]{,}\left[\begin{array}{c}{1.}\\ {2.}\\ {3.}\\ {4.}\end{array}\right]$ (7)
 > $\mathrm{ai2},\mathrm{b2}≔\mathrm{SplitForm}\left(\mathrm{m2}\right)$
 ${\mathrm{ai2}}{,}{\mathrm{b2}}{:=}\left[\left[\begin{array}{r}{1}\\ {2}\\ {3}\\ {3}\end{array}\right]{,}\left[\begin{array}{r}{2}\\ {1}\\ {1}\\ {3}\end{array}\right]\right]{,}\left[\begin{array}{c}{1.}\\ {2.}\\ {3.}\\ {4.}\end{array}\right]$ (8)

Therefore, to recover the original rtable, you may need to use the dimensions option.

 > $\mathrm{FromSplitForm}\left(\mathrm{ai2},\mathrm{b2}\right)$
 $\left[\begin{array}{ccc}{0.}& {1.}& {0.}\\ {2.}& {0.}& {0.}\\ {3.}& {0.}& {4.}\end{array}\right]$ (9)
 > $\mathrm{FromSplitForm}\left(\mathrm{ai2},\mathrm{b2},'\mathrm{dimensions}'=\left[4,3\right]\right)$
 $\left[\begin{array}{ccc}{0.}& {1.}& {0.}\\ {2.}& {0.}& {0.}\\ {3.}& {0.}& {4.}\\ {0.}& {0.}& {0.}\end{array}\right]$ (10)

To construct the Vectors $\mathrm{Ai}$ from scratch in a cross-platform way, one can use kernelopts to find the right integer data type.

 > $\mathrm{dt}≔{'\mathrm{integer}'}_{\frac{\mathrm{kernelopts}\left('\mathrm{wordsize}'\right)}{8}}$
 ${\mathrm{dt}}{:=}{{\mathrm{integer}}}_{{8}}$ (11)
 > $\mathrm{A1}≔\mathrm{Vector}\left(\left[5,4,3,2,1\right],'\mathrm{datatype}'=\mathrm{dt}\right)$
 ${\mathrm{A1}}{:=}\left[\begin{array}{r}{5}\\ {4}\\ {3}\\ {2}\\ {1}\end{array}\right]$ (12)
 > $\mathrm{A2}≔\mathrm{Vector}\left(\left[3,2,1,2,3\right],'\mathrm{datatype}'=\mathrm{dt}\right)$
 ${\mathrm{A2}}{:=}\left[\begin{array}{r}{3}\\ {2}\\ {1}\\ {2}\\ {3}\end{array}\right]$ (13)
 > $\mathrm{A3}≔\mathrm{Vector}\left(\left[2,1,5,4,3\right],'\mathrm{datatype}'=\mathrm{dt}\right)$
 ${\mathrm{A3}}{:=}\left[\begin{array}{r}{2}\\ {1}\\ {5}\\ {4}\\ {3}\end{array}\right]$ (14)
 > $B≔\mathrm{Vector}\left(\left[I,2+I,I-3,-2-I,-I\right],'\mathrm{datatype}'='\mathrm{complex}[8]'\right)$
 ${B}{:=}\left[\begin{array}{c}{0.}{+}{1.}{}{I}\\ {2.}{+}{1.}{}{I}\\ {-}{3.}{+}{1.}{}{I}\\ {-}{2.}{-}{1.}{}{I}\\ {0.}{-}{1.}{}{I}\end{array}\right]$ (15)
 > $\mathrm{FromSplitForm}\left(\left[\mathrm{A1},\mathrm{A2},\mathrm{A3}\right],B\right)$
 $\left[\begin{array}{c}{\mathrm{1..5 x 1..3 x 1..5}}{\mathrm{Array}}\\ {\mathrm{Data Type:}}{{\mathrm{complex}}}_{{8}}\\ {\mathrm{Storage:}}{\mathrm{sparse}}\\ {\mathrm{Order:}}{\mathrm{Fortran_order}}\end{array}\right]$ (16)

Compatibility

 • The LinearAlgebra[FromSplitForm] command was introduced in Maple 17.